r66593 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66592‎ | r66593 | r66594 >
Date:23:02, 17 May 2010
Author:neilk
Status:deferred
Tags:
Comment:
first pass at colored tooltips
Modified paths:
  • /trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tipsy.js (modified) (history)
  • /trunk/extensions/UploadWizard/js/mw.UploadWizard.js (modified) (history)
  • /trunk/extensions/UploadWizard/styles/jquery.tipsy.css (modified) (history)
  • /trunk/extensions/UploadWizard/styles/jquery.tipsy.error.gif (added) (history)
  • /trunk/extensions/UploadWizard/styles/jquery.tipsy.help.gif (added) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/styles/jquery.tipsy.help.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/UploadWizard/styles/jquery.tipsy.help.gif
___________________________________________________________________
Name: svn:mime-type
11 + application/octet-stream
Index: trunk/extensions/UploadWizard/styles/jquery.tipsy.error.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/UploadWizard/styles/jquery.tipsy.error.gif
___________________________________________________________________
Name: svn:mime-type
22 + application/octet-stream
Index: trunk/extensions/UploadWizard/styles/jquery.tipsy.css
@@ -10,3 +10,21 @@
1111 .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; }
1212 .tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; }
1313 .tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; }
 14+
 15+
 16+.tipsy-help .tipsy-inner { background-color: #96d8d9; color: black; }
 17+.tipsy-help .tipsy-arrow { background: url('jquery.tipsy.help.gif') }
 18+
 19+.tipsy-error .tipsy-inner { background-color: #f89c90; color: black; }
 20+.tipsy-error .tipsy-arrow { background: url('jquery.tipsy.error.gif') }
 21+
 22+.shadow {
 23+ /* offset left, top, thickness, color with alpha */
 24+ -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
 25+ -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
 26+ box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2);
 27+ /* IE */
 28+ filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray');
 29+ /* slightly different syntax for IE8 */
 30+ -ms-filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray')";
 31+}
Index: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tipsy.js
@@ -24,7 +24,7 @@
2525 if (title && this.enabled) {
2626 var $tip = this.tip();
2727 $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
28 - $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
 28+ // $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
2929 // the remove strips events
3030 //$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
3131 $tip.css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
@@ -97,8 +97,11 @@
9898 },
9999
100100 tip: function() {
 101+ var type = 'tipsy-' + this.options.type;
 102+ var shadow = this.options.shadow ? 'shadow' : '';
101103 if (!this.$tip) {
102 - this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>');
 104+ this.$tip = $('<div class="tipsy ' + type + '"></div>')
 105+ .html('<div class="tipsy-arrow"></div><div class="tipsy-inner ' + shadow + '"/></div>');
103106 }
104107 return this.$tip;
105108 },
@@ -173,9 +176,10 @@
174177 html: false,
175178 live: false,
176179 offset: 0,
177 - opacity: 0.8,
 180+ opacity: 1.0,
178181 title: 'title',
179 - trigger: 'hover'
 182+ trigger: 'hover',
 183+ type: 'help',
180184 };
181185
182186 // Overwrite this method to provide options on a per-element basis.
Index: trunk/extensions/UploadWizard/js/mw.UploadWizard.js
@@ -1,4 +1,3 @@
2 -
32 /**
43 * Include all the uploadWizard msgs
54 */
@@ -48,7 +47,6 @@
4948 mw.ProgressBar = function( selector, text ) {
5049 var _this = this;
5150 // XXX need to figure out a way to put text inside bar
52 -
5351 _this.$selector = $j( selector );
5452 _this.$selector.html(
5553 '<div class="mwe-upwiz-progress">'
@@ -369,6 +367,7 @@
370368 _this.transportProgress = 1;
371369 $j( _this ).trigger( 'transportedEvent' );
372370
 371+ debugger;
373372 if ( result.upload && result.upload.imageinfo && result.upload.imageinfo.descriptionurl ) {
374373 // success
375374 _this.extractUploadInfo( result );
@@ -383,7 +382,8 @@
384383 }
385384
386385 // and other errors that result in a stash
387 - } else if ( 0 /* actual failure */ ) {
 386+ } else {
 387+ alert("failure!");
388388 // we may want to tag or otherwise queue it as an upload to retry
389389 }
390390
@@ -967,7 +967,7 @@
968968 // descriptions
969969 _this.descriptionsDiv = $j( '<div class="mwe-upwiz-details-descriptions mwe-upwiz-details-input"></div>' );
970970
971 -
 971+ // XXX use plurals
972972 _this.descriptionAdder = $j( '<a class="mwe-upwiz-desc-add"/>' )
973973 .attr( 'href', '#' )
974974 .html( gM( 'mwe-upwiz-desc-add-0' ) )
@@ -985,7 +985,7 @@
986986 // XXX make sure they can't use ctrl characters or returns or any other bad stuff.
987987 _this.titleInput = $j( '<textarea type="text" rows="1" class="mwe-title mwe-long-textarea"></textarea>' )
988988 .attr( 'title', gM( 'mwe-upwiz-tooltip-title' ) )
989 - .tipsy( { gravity: 'w', trigger: 'focus' } )
 989+ .tipsyPlus()
990990 .keyup( function() {
991991 _this.setFilenameFromTitle();
992992 } )
@@ -1055,7 +1055,7 @@
10561056 _this.otherInformationInput = $j( '<textarea class="mwe-upwiz-other-textarea"></textarea>' )
10571057 .growTextArea()
10581058 .attr( 'title', gM( 'mwe-upwiz-tooltip-other' ) )
1059 - .tipsy( { gravity: 'w', trigger: 'focus' } );
 1059+ .tipsyPlus();
10601060
10611061 var otherInformationDiv = $j('<div></div>')
10621062 .append( $j( '<div class="mwe-upwiz-details-more-label">' ).append( gM( 'mwe-upwiz-other' ) ) )
@@ -1243,6 +1243,7 @@
12441244 recountDescriptions: function() {
12451245 var _this = this;
12461246 // if there is some maximum number of descriptions, deal with that here
 1247+ // XXX use mediawiki PLURAL, not -0 -n
12471248 $j( _this.descriptionAdder ).html( gM( 'mwe-upwiz-desc-add-' + ( _this.descriptions.length == 0 ? '0' : 'n' ) ) );
12481249 },
12491250
@@ -1827,7 +1828,7 @@
18281829 + '<div id="mwe-upwiz-macro">'
18291830 + '<div id="mwe-upwiz-macro-progress" class="ui-helper-clearfix"></div>'
18301831 + '<div id="mwe-upwiz-macro-choice">'
1831 - + '<div>' + gM( 'mwe-upwiz-details-intro' ) + '</div>'
 1832+ + '<div>' + gM( 'mwe-upwiz-details-intro' ) + '</div>' // XXX PLURAL
18321833 + '</div>'
18331834 + '<div id="mwe-upwiz-macro-files"></div>'
18341835 + '</div>'
@@ -1909,6 +1910,7 @@
19101911 }
19111912 } );
19121913
 1914+ // XXX mediawiki PLURAL
19131915 $j( '#mwe-upwiz-deeds-intro' ).html( gM( 'mwe-upwiz-deeds-intro' ) );
19141916
19151917 $j( '#mwe-upwiz-stepdiv-deeds .mwe-upwiz-button-next').click( function() {
@@ -2245,12 +2247,14 @@
22462248 if ( _this.uploads.length ) {
22472249 $j( '#mwe-upwiz-upload-ctrl' ).removeAttr( 'disabled' );
22482250 $j( '#proceed' ).show();
 2251+ // XXX should use PLURAL
22492252 $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-n' ) );
22502253 $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-0');
22512254 $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-n');
22522255 } else {
22532256 $j( '#mwe-upwiz-upload-ctrl' ).attr( 'disabled', 'disabled' );
22542257 $j( '#proceed' ).hide();
 2258+ // XXX should use PLURAL
22552259 $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-0' ) );
22562260 $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-0');
22572261 $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-n');
@@ -2467,6 +2471,7 @@
24682472 },
24692473
24702474 // modify various interface strings depending on singular, multiple deeds
 2475+ // XXX use PLURAL when possible
24712476 setQuantity: function() {
24722477 var _this = this;
24732478 mw.log( "setting quantity of deed to " + _this.count );
@@ -2678,7 +2683,7 @@
26792684 title: gM( 'mwe-upwiz-tooltip-sign' ),
26802685 value: mw.getConfig( 'userName' )
26812686 } )
2682 - .tipsy( { trigger: 'focus', gravity: 'w' } )
 2687+ .tipsyPlus()
26832688 .keyup( function() {
26842689 var thisInput = this;
26852690 var thisVal = $j( thisInput ).val();
@@ -2710,11 +2715,11 @@
27112716 var sourceInput = $j('<textarea class="mwe-source mwe-long-textarea" name="source" rows="1" cols="40"></textarea>' )
27122717 .growTextArea()
27132718 .attr( 'title', gM( 'mwe-upwiz-tooltip-source' ) )
2714 - .tipsy( { trigger: 'focus', gravity: 'w' } );
 2719+ .tipsyPlus();
27152720 var authorInput = $j('<textarea class="mwe-author mwe-long-textarea" name="author" rows="1" cols="40"></textarea>' )
27162721 .growTextArea()
27172722 .attr( 'title', gM( 'mwe-upwiz-tooltip-author' ) )
2718 - .tipsy( { trigger: 'focus', gravity: 'w' } );
 2723+ .tipsyPlus();
27192724 licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' );
27202725 licenseInput = new mw.UploadWizardLicenseInput( licenseInputDiv );
27212726 licenseInput.setDefaultValues();
@@ -3071,8 +3076,15 @@
30723077 ( function( $j ) {
30733078
30743079 $j.fn.tipsyPlus = function( options ) {
 3080+ // use extend!
30753081 var titleOption = 'title';
30763082 var htmlOption = false;
 3083+
 3084+ var options = $j.extend(
 3085+ { type: 'help', shadow: true },
 3086+ options
 3087+ );
 3088+
30773089 var el = this;
30783090
30793091 if (options.plus) {
@@ -3104,7 +3116,9 @@
31053117 gravity: 'w',
31063118 trigger: 'focus',
31073119 title: titleOption,
3108 - html: htmlOption
 3120+ html: htmlOption,
 3121+ type: options.type,
 3122+ shadow: options.shadow
31093123 } );
31103124
31113125 }

Status & tagging log