http://www.mediawiki.org/wiki/Special:Code/MediaWiki/66593
Revision: 66593 Author: neilk Date: 2010-05-17 23:02:11 +0000 (Mon, 17 May 2010) Log Message: ----------- first pass at colored tooltips Modified Paths: -------------- trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tipsy.js trunk/extensions/UploadWizard/js/mw.UploadWizard.js trunk/extensions/UploadWizard/styles/jquery.tipsy.css Added Paths: ----------- trunk/extensions/UploadWizard/styles/jquery.tipsy.error.gif trunk/extensions/UploadWizard/styles/jquery.tipsy.help.gif Modified: trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tipsy.js =================================================================== --- trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tipsy.js 2010-05-17 23:01:28 UTC (rev 66592) +++ trunk/extensions/UploadWizard/js/jquery/plugins/jquery.tipsy.js 2010-05-17 23:02:11 UTC (rev 66593) @@ -24,7 +24,7 @@ if (title && this.enabled) { var $tip = this.tip(); $tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title); - $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity + // $tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity // the remove strips events //$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); $tip.css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body); @@ -97,8 +97,11 @@ }, tip: function() { + var type = 'tipsy-' + this.options.type; + var shadow = this.options.shadow ? 'shadow' : ''; if (!this.$tip) { - this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"/></div>'); + this.$tip = $('<div class="tipsy ' + type + '"></div>') + .html('<div class="tipsy-arrow"></div><div class="tipsy-inner ' + shadow + '"/></div>'); } return this.$tip; }, @@ -173,9 +176,10 @@ html: false, live: false, offset: 0, - opacity: 0.8, + opacity: 1.0, title: 'title', - trigger: 'hover' + trigger: 'hover', + type: 'help', }; // Overwrite this method to provide options on a per-element basis. Modified: trunk/extensions/UploadWizard/js/mw.UploadWizard.js =================================================================== --- trunk/extensions/UploadWizard/js/mw.UploadWizard.js 2010-05-17 23:01:28 UTC (rev 66592) +++ trunk/extensions/UploadWizard/js/mw.UploadWizard.js 2010-05-17 23:02:11 UTC (rev 66593) @@ -1,4 +1,3 @@ - /** * Include all the uploadWizard msgs */ @@ -48,7 +47,6 @@ mw.ProgressBar = function( selector, text ) { var _this = this; // XXX need to figure out a way to put text inside bar - _this.$selector = $j( selector ); _this.$selector.html( '<div class="mwe-upwiz-progress">' @@ -369,6 +367,7 @@ _this.transportProgress = 1; $j( _this ).trigger( 'transportedEvent' ); + debugger; if ( result.upload && result.upload.imageinfo && result.upload.imageinfo.descriptionurl ) { // success _this.extractUploadInfo( result ); @@ -383,7 +382,8 @@ } // and other errors that result in a stash - } else if ( 0 /* actual failure */ ) { + } else { + alert("failure!"); // we may want to tag or otherwise queue it as an upload to retry } @@ -967,7 +967,7 @@ // descriptions _this.descriptionsDiv = $j( '<div class="mwe-upwiz-details-descriptions mwe-upwiz-details-input"></div>' ); - + // XXX use plurals _this.descriptionAdder = $j( '<a class="mwe-upwiz-desc-add"/>' ) .attr( 'href', '#' ) .html( gM( 'mwe-upwiz-desc-add-0' ) ) @@ -985,7 +985,7 @@ // XXX make sure they can't use ctrl characters or returns or any other bad stuff. _this.titleInput = $j( '<textarea type="text" rows="1" class="mwe-title mwe-long-textarea"></textarea>' ) .attr( 'title', gM( 'mwe-upwiz-tooltip-title' ) ) - .tipsy( { gravity: 'w', trigger: 'focus' } ) + .tipsyPlus() .keyup( function() { _this.setFilenameFromTitle(); } ) @@ -1055,7 +1055,7 @@ _this.otherInformationInput = $j( '<textarea class="mwe-upwiz-other-textarea"></textarea>' ) .growTextArea() .attr( 'title', gM( 'mwe-upwiz-tooltip-other' ) ) - .tipsy( { gravity: 'w', trigger: 'focus' } ); + .tipsyPlus(); var otherInformationDiv = $j('<div></div>') .append( $j( '<div class="mwe-upwiz-details-more-label">' ).append( gM( 'mwe-upwiz-other' ) ) ) @@ -1243,6 +1243,7 @@ recountDescriptions: function() { var _this = this; // if there is some maximum number of descriptions, deal with that here + // XXX use mediawiki PLURAL, not -0 -n $j( _this.descriptionAdder ).html( gM( 'mwe-upwiz-desc-add-' + ( _this.descriptions.length == 0 ? '0' : 'n' ) ) ); }, @@ -1827,7 +1828,7 @@ + '<div id="mwe-upwiz-macro">' + '<div id="mwe-upwiz-macro-progress" class="ui-helper-clearfix"></div>' + '<div id="mwe-upwiz-macro-choice">' - + '<div>' + gM( 'mwe-upwiz-details-intro' ) + '</div>' + + '<div>' + gM( 'mwe-upwiz-details-intro' ) + '</div>' // XXX PLURAL + '</div>' + '<div id="mwe-upwiz-macro-files"></div>' + '</div>' @@ -1909,6 +1910,7 @@ } } ); + // XXX mediawiki PLURAL $j( '#mwe-upwiz-deeds-intro' ).html( gM( 'mwe-upwiz-deeds-intro' ) ); $j( '#mwe-upwiz-stepdiv-deeds .mwe-upwiz-button-next').click( function() { @@ -2245,12 +2247,14 @@ if ( _this.uploads.length ) { $j( '#mwe-upwiz-upload-ctrl' ).removeAttr( 'disabled' ); $j( '#proceed' ).show(); + // XXX should use PLURAL $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-n' ) ); $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-0'); $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-n'); } else { $j( '#mwe-upwiz-upload-ctrl' ).attr( 'disabled', 'disabled' ); $j( '#proceed' ).hide(); + // XXX should use PLURAL $j( '#mwe-upwiz-add-file' ).html( gM( 'mwe-upwiz-add-file-0' ) ); $j( '#mwe-upwiz-add-file-container' ).addClass('mwe-upwiz-add-files-0'); $j( '#mwe-upwiz-add-file-container' ).removeClass('mwe-upwiz-add-files-n'); @@ -2467,6 +2471,7 @@ }, // modify various interface strings depending on singular, multiple deeds + // XXX use PLURAL when possible setQuantity: function() { var _this = this; mw.log( "setting quantity of deed to " + _this.count ); @@ -2678,7 +2683,7 @@ title: gM( 'mwe-upwiz-tooltip-sign' ), value: mw.getConfig( 'userName' ) } ) - .tipsy( { trigger: 'focus', gravity: 'w' } ) + .tipsyPlus() .keyup( function() { var thisInput = this; var thisVal = $j( thisInput ).val(); @@ -2710,11 +2715,11 @@ var sourceInput = $j('<textarea class="mwe-source mwe-long-textarea" name="source" rows="1" cols="40"></textarea>' ) .growTextArea() .attr( 'title', gM( 'mwe-upwiz-tooltip-source' ) ) - .tipsy( { trigger: 'focus', gravity: 'w' } ); + .tipsyPlus(); var authorInput = $j('<textarea class="mwe-author mwe-long-textarea" name="author" rows="1" cols="40"></textarea>' ) .growTextArea() .attr( 'title', gM( 'mwe-upwiz-tooltip-author' ) ) - .tipsy( { trigger: 'focus', gravity: 'w' } ); + .tipsyPlus(); licenseInputDiv = $j( '<div class="mwe-upwiz-deed-license"></div>' ); licenseInput = new mw.UploadWizardLicenseInput( licenseInputDiv ); licenseInput.setDefaultValues(); @@ -3071,8 +3076,15 @@ ( function( $j ) { $j.fn.tipsyPlus = function( options ) { + // use extend! var titleOption = 'title'; var htmlOption = false; + + var options = $j.extend( + { type: 'help', shadow: true }, + options + ); + var el = this; if (options.plus) { @@ -3104,7 +3116,9 @@ gravity: 'w', trigger: 'focus', title: titleOption, - html: htmlOption + html: htmlOption, + type: options.type, + shadow: options.shadow } ); } Modified: trunk/extensions/UploadWizard/styles/jquery.tipsy.css =================================================================== --- trunk/extensions/UploadWizard/styles/jquery.tipsy.css 2010-05-17 23:01:28 UTC (rev 66592) +++ trunk/extensions/UploadWizard/styles/jquery.tipsy.css 2010-05-17 23:02:11 UTC (rev 66593) @@ -10,3 +10,21 @@ .tipsy-se .tipsy-arrow { bottom: 0; right: 10px; background-position: bottom left; } .tipsy-e .tipsy-arrow { top: 50%; margin-top: -4px; right: 0; width: 5px; height: 9px; background-position: top right; } .tipsy-w .tipsy-arrow { top: 50%; margin-top: -4px; left: 0; width: 5px; height: 9px; } + + +.tipsy-help .tipsy-inner { background-color: #96d8d9; color: black; } +.tipsy-help .tipsy-arrow { background: url('jquery.tipsy.help.gif') } + +.tipsy-error .tipsy-inner { background-color: #f89c90; color: black; } +.tipsy-error .tipsy-arrow { background: url('jquery.tipsy.error.gif') } + +.shadow { + /* offset left, top, thickness, color with alpha */ + -webkit-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2); + -moz-box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2); + box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.2); + /* IE */ + filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray'); + /* slightly different syntax for IE8 */ + -ms-filter:"progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color='gray')"; +} Added: trunk/extensions/UploadWizard/styles/jquery.tipsy.error.gif =================================================================== (Binary files differ) Property changes on: trunk/extensions/UploadWizard/styles/jquery.tipsy.error.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/extensions/UploadWizard/styles/jquery.tipsy.help.gif =================================================================== (Binary files differ) Property changes on: trunk/extensions/UploadWizard/styles/jquery.tipsy.help.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs