r87219 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87218‎ | r87219 | r87220 >
Date:21:32, 1 May 2011
Author:siebrand
Status:ok
Tags:
Comment:
Trailing whitespace removed.
Modified paths:
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizard.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
@@ -17,12 +17,12 @@
1818 this.extension = undefined;
1919
2020 this.sessionKey = undefined;
21 -
22 - // this should be moved to the interface, if we even keep this
 21+
 22+ // this should be moved to the interface, if we even keep this
2323 this.transportWeight = 1; // default
2424 this.detailsWeight = 1; // default
2525
26 - // details
 26+ // details
2727 this.ui = new mw.UploadWizardUploadInterface( this, filesDiv );
2828
2929 // handler -- usually ApiUploadHandler
@@ -45,11 +45,11 @@
4646 var _this = this;
4747 _this.setTransportProgress(0.0);
4848 //_this.ui.start();
49 - _this.handler.start();
 49+ _this.handler.start();
5050 },
5151
5252 /**
53 - * remove this upload. n.b. we trigger a removeUpload this is usually triggered from
 53+ * remove this upload. n.b. we trigger a removeUpload this is usually triggered from
5454 */
5555 remove: function() {
5656 this.state = 'aborted';
@@ -57,13 +57,13 @@
5858 this.deedThumbnailDiv.remove();
5959 }
6060 if ( this.details && this.details.div ) {
61 - this.details.div.remove();
 61+ this.details.div.remove();
6262 }
6363 if ( this.thanksDiv ) {
6464 this.thanksDiv.remove();
6565 }
66 - // we signal to the wizard to update itself, which has to delete the final vestige of
67 - // this upload (the ui.div). We have to do this silly dance because we
 66+ // we signal to the wizard to update itself, which has to delete the final vestige of
 67+ // this upload (the ui.div). We have to do this silly dance because we
6868 // trigger through the div. Triggering through objects doesn't always work.
6969 // TODO v.1.1 fix, don't need to use the div any more -- this now works in jquery 1.4.2
7070 $j( this.ui.div ).trigger( 'removeUploadEvent' );
@@ -92,16 +92,16 @@
9393 },
9494
9595 /**
96 - * Stop the upload -- we have failed for some reason
 96+ * Stop the upload -- we have failed for some reason
9797 */
98 - setError: function( code, info ) {
 98+ setError: function( code, info ) {
9999 this.state = 'error';
100100 this.transportProgress = 0;
101101 this.ui.showError( code, info );
102102 },
103103
104104 /**
105 - * To be executed when an individual upload finishes. Processes the result and updates step 2's details
 105+ * To be executed when an individual upload finishes. Processes the result and updates step 2's details
106106 * @param result the API result in parsed JSON form
107107 */
108108 setTransported: function( result ) {
@@ -125,11 +125,11 @@
126126 info = _this.filenameToUrl( existsFileName ).toString();
127127 } catch ( e ) {
128128 code = 'unknown';
129 - info = 'Warned about existing filename, but filename is unparseable: "' + existsFileName + "'";
 129+ info = 'Warned about existing filename, but filename is unparseable: "' + existsFileName + "'";
130130 }
131131 _this.addWarning( code, info );
132132 _this.extractUploadInfo( result.upload );
133 - var success = function( imageinfo ) {
 133+ var success = function( imageinfo ) {
134134 if ( imageinfo === null ) {
135135 _this.setError( 'noimageinfo' );
136136 } else {
@@ -151,13 +151,13 @@
152152 $j.each( result.upload.warnings, function( k, v ) {
153153 warningInfo.push( k + ': ' + v );
154154 } );
155 - info = warningInfo.join( ', ' );
156 - _this.setError( code, [ info ] );
 155+ info = warningInfo.join( ', ' );
 156+ _this.setError( code, [ info ] );
157157 }
158158 } else if ( result.upload && result.upload.result === 'Success' ) {
159159 if ( result.upload.imageinfo ) {
160160 _this.setSuccess( result );
161 - } else {
 161+ } else {
162162 _this.setError( 'noimageinfo', info );
163163 }
164164 } else {
@@ -184,13 +184,13 @@
185185 duplicateErrorInfo: function( code, resultDuplicate ) {
186186 var _this = this;
187187 var duplicates;
188 - if ( typeof resultDuplicate === 'object' ) {
 188+ if ( typeof resultDuplicate === 'object' ) {
189189 duplicates = resultDuplicate;
190190 } else if ( typeof resultDuplicate === 'string' ) {
191191 duplicates = [ resultDuplicate ];
192192 }
193193 var $ul = $j( '<ul></ul>' );
194 - $j.each( duplicates, function( i, filename ) {
 194+ $j.each( duplicates, function( i, filename ) {
195195 var $a = $j( '<a/>' ).append( filename );
196196 try {
197197 var href = _this.filenameToUrl( filename );
@@ -224,24 +224,24 @@
225225 var _this = this; // was a triumph
226226 _this.state = 'transported';
227227 _this.transportProgress = 1;
228 -
 228+
229229 // I'm making a note here
230230 _this.ui.setStatus( 'mwe-upwiz-getting-metadata' );
231231 if ( result.upload ) {
232232 _this.extractUploadInfo( result.upload );
233 - _this.getThumbnail(
 233+ _this.getThumbnail(
234234 function( image ) {
235235 // n.b. if server returns a URL, which is a 404, we do NOT get broken image
236236 _this.ui.setPreview( image ); // make the thumbnail the preview image
237237 },
238 - mw.UploadWizard.config[ 'thumbnailWidth' ],
239 - mw.UploadWizard.config[ 'thumbnailMaxHeight' ]
 238+ mw.UploadWizard.config[ 'thumbnailWidth' ],
 239+ mw.UploadWizard.config[ 'thumbnailMaxHeight' ]
240240 );
241241 // create the large thumbnail that the other thumbnails link to
242 - _this.getThumbnail(
 242+ _this.getThumbnail(
243243 function( image ) {},
244 - mw.UploadWizard.config[ 'largeThumbnailWidth' ],
245 - mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ]
 244+ mw.UploadWizard.config[ 'largeThumbnailWidth' ],
 245+ mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ]
246246 );
247247 _this.deedPreview.setup();
248248 _this.details.populate();
@@ -250,9 +250,9 @@
251251 } else {
252252 _this.setError( 'noimageinfo' );
253253 }
254 -
 254+
255255 },
256 -
 256+
257257 /**
258258 * Called when the file is entered into the file input
259259 * Get as much data as possible -- maybe exif, even thumbnail maybe
@@ -262,22 +262,22 @@
263263 this.transportWeight = getFileSize();
264264 }
265265 // XXX sanitize filename
266 - try {
 266+ try {
267267 this.title = new mw.Title( mw.UploadWizardUtil.getBasename( filename ).replace( /:/g, '_' ), 'file' );
268268 } catch ( e ) {
269269 this.setError( 'mwe-upwiz-unparseable-filename', filename );
270270 }
271271 },
272272
273 - /**
274 - * Accept the result from a successful API upload transport, and fill our own info
 273+ /**
 274+ * Accept the result from a successful API upload transport, and fill our own info
275275 *
276276 * @param result The JSON object from a successful API upload result.
277277 */
278278 extractUploadInfo: function( resultUpload ) {
279279 if ( resultUpload.sessionkey ) {
280280 this.sessionKey = resultUpload.sessionkey;
281 - }
 281+ }
282282 if ( resultUpload.imageinfo ) {
283283 this.extractImageInfo( resultUpload.imageinfo );
284284 } else if ( resultUpload.stashimageinfo ) {
@@ -288,7 +288,7 @@
289289 },
290290
291291 /**
292 - * Extract image info into our upload object
 292+ * Extract image info into our upload object
293293 * Image info is obtained from various different API methods
294294 * @param imageinfo JSON object obtained from API result.
295295 */
@@ -309,18 +309,18 @@
310310 _this.imageinfo[key] = imageinfo[key];
311311 }
312312 }
313 -
 313+
314314 if ( _this.title.getExtension() === null ) {
315315 1;
316316 // TODO v1.1 what if we don't have an extension? Should be impossible as it is currently impossible to upload without extension, but you
317317 // never know... theoretically there is no restriction on extensions if we are uploading to the stash, but the check is performed anyway.
318 - /*
 318+ /*
319319 var extension = mw.UploadWizardUtil.getExtension( _this.imageinfo.url );
320320 if ( !extension ) {
321321 if ( _this.imageinfo.mimetype ) {
322322 if ( mw.UploadWizardUtil.mimetypeToExtension[ _this.imageinfo.mimetype ] ) {
323 - extension = mw.UploadWizardUtil.mimetypeToExtension[ _this.imageinfo.mimetype ];
324 - }
 323+ extension = mw.UploadWizardUtil.mimetypeToExtension[ _this.imageinfo.mimetype ];
 324+ }
325325 }
326326 }
327327 */
@@ -340,7 +340,7 @@
341341
342342 if (!mw.isDefined( props ) ) {
343343 props = [];
344 - }
 344+ }
345345
346346 var params = {
347347 'prop': 'stashimageinfo',
@@ -353,7 +353,7 @@
354354 props.push( 'url' );
355355 }
356356 if ( mw.isDefined( width ) ) {
357 - params['siiurlwidth'] = width;
 357+ params['siiurlwidth'] = width;
358358 }
359359 if ( mw.isDefined( height ) ) {
360360 params['siiurlheight'] = height;
@@ -368,7 +368,7 @@
369369 }
370370 callback( data.query.stashimageinfo );
371371 };
372 -
 372+
373373 var err = function( code, result ) {
374374 mw.log( 'mw.UploadWizardUpload::getStashImageInfo> error: ' + code, 'debug' );
375375 callback( null );
@@ -378,7 +378,7 @@
379379 },
380380
381381 /**
382 - * Fetch a thumbnail for a stashed upload of the desired width.
 382+ * Fetch a thumbnail for a stashed upload of the desired width.
383383 * It is assumed you don't call this until it's been transported.
384384 *
385385 * @param callback - callback to execute once thumbnail has been obtained -- must accept Image object for success, null for error
@@ -394,7 +394,7 @@
395395 if ( mw.isDefined( _this.thumbnails[key] ) ) {
396396 callback( _this.thumbnails[key] );
397397 } else {
398 - var apiCallback = function( thumbnails ) {
 398+ var apiCallback = function( thumbnails ) {
399399 if ( thumbnails === null ) {
400400 callback( null );
401401 } else {
@@ -425,11 +425,11 @@
426426 *
427427 * @param selector
428428 * @param width
429 - * @param height (optional)
 429+ * @param height (optional)
430430 */
431431 setThumbnail: function( selector, width, height ) {
432432 var _this = this;
433 - if ( typeof width === 'undefined' || width === null || width <= 0 ) {
 433+ if ( typeof width === 'undefined' || width === null || width <= 0 ) {
434434 width = mw.UploadWizard.config[ 'thumbnailWidth' ];
435435 }
436436 width = parseInt( width, 10 );
@@ -453,7 +453,7 @@
454454 // set up lightbox behavior for thumbnail
455455 .click( function() {
456456 // get large preview image
457 - _this.getThumbnail(
 457+ _this.getThumbnail(
458458 // open large preview in modal dialog box
459459 function( image ) {
460460 var dialogWidth = ( image.width > 200 ) ? image.width : 200;
@@ -467,27 +467,27 @@
468468 'resizable': false
469469 } );
470470 },
471 - mw.UploadWizard.config[ 'largeThumbnailWidth' ],
472 - mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ]
 471+ mw.UploadWizard.config[ 'largeThumbnailWidth' ],
 472+ mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ]
473473 );
474474 return false;
475475 } ); // close thumbnail click function
476476 } // close if
477 -
 477+
478478 $j( selector ).html(
479479 // insert the thumbnail into the anchor
480480 $thumbnailLink.append(
481481 $j( '<img/>' )
482482 .attr( {
483 - 'width': image.width,
 483+ 'width': image.width,
484484 'height': image.height,
485485 'src': image.src
486 - } )
 486+ } )
487487 ) // close append
488488 ); // close html
489489 } // close image !== null else condition
490490 };
491 -
 491+
492492 _this.getThumbnail( callback, width, height );
493493 },
494494
@@ -500,10 +500,10 @@
501501 var fileUrl = new mw.Uri( document.URL );
502502 fileUrl.path = wgScript;
503503 var fileTitle = new mw.Title( filename, 'file' );
504 - fileUrl.query = { title: fileTitle, action: 'view' };
 504+ fileUrl.query = { title: fileTitle, action: 'view' };
505505 return fileUrl;
506506 }
507 -
 507+
508508 };
509509
510510
@@ -521,7 +521,7 @@
522522 // elsewhere
523523 mw.UploadWizard.config = config;
524524
525 - // XXX need a robust way of defining default config
 525+ // XXX need a robust way of defining default config
526526 this.maxUploads = mw.UploadWizard.config[ 'maxUploads' ] || 10;
527527 this.maxSimultaneousConnections = mw.UploadWizard.config[ 'maxSimultaneousConnections' ] || 2;
528528
@@ -577,20 +577,20 @@
578578 this.removeMatchingUploads( function() { return true; } );
579579 },
580580
581 -
 581+
582582 /**
583583 * create the basic interface to make an upload in this div
584584 * @param div The div in the DOM to put all of this into.
585585 */
586586 createInterface: function( selector ) {
587587 var _this = this;
588 -
 588+
589589 // load list of languages so we'll have it ready when description interfaces are created
590590 // XXX replace this code once any of the following bugs are fixed: 25845, 27535, 27561
591591 var languageHandlerUrl = wgServer + wgScript + '?' + $.param( { 'title': 'MediaWiki:LanguageHandler.js', 'action': 'raw', 'ctype': 'text/javascript' } );
592592 mw.loader.load( languageHandlerUrl );
593 -
594 - // remove first spinner
 593+
 594+ // remove first spinner
595595 $j( '#mwe-first-spinner' ).remove();
596596
597597 // feedback request
@@ -598,14 +598,14 @@
599599 var feedback = new mw.Feedback( _this.api,
600600 new mw.Title( mw.UploadWizard.config['feedbackPage'] ) );
601601 $j( '#contentSub' )
602 - .msg( 'mwe-upwiz-feedback-prompt',
 602+ .msg( 'mwe-upwiz-feedback-prompt',
603603 function() {
604604 feedback.launch();
605605 return false;
606606 }
607607 );
608608 }
609 -
 609+
610610 // construct the arrow steps from the UL in the HTML
611611 $j( '#mwe-upwiz-steps' )
612612 .addClass( 'ui-helper-clearfix ui-state-default ui-widget ui-helper-reset ui-helper-clearfix' )
@@ -617,7 +617,7 @@
618618 .button()
619619 .css( { 'margin-left': '1em' } );
620620
621 -
 621+
622622 $j( '.mwe-upwiz-button-begin' )
623623 .click( function() { _this.reset(); } );
624624
@@ -625,7 +625,7 @@
626626 .click( function() { window.location.href = '/'; } );
627627
628628 // handler for next button
629 - $j( '#mwe-upwiz-stepdiv-tutorial .mwe-upwiz-button-next')
 629+ $j( '#mwe-upwiz-stepdiv-tutorial .mwe-upwiz-button-next')
630630 .click( function() {
631631 // if the skip checkbox is checked, set the skip cookie
632632 if ( $j('#mwe-upwiz-skip').is(':checked') ) {
@@ -633,7 +633,7 @@
634634 }
635635 _this.moveToStep( 'file' );
636636 } );
637 -
 637+
638638 $j( '#mwe-upwiz-add-file' ).button();
639639
640640 $j( '#mwe-upwiz-upload-ctrl' )
@@ -657,12 +657,12 @@
658658 } );
659659
660660 $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-next' ).click( function() {
661 - _this.removeErrorUploads( function() {
 661+ _this.removeErrorUploads( function() {
662662 _this.prepareAndMoveToDeeds();
663663 } );
664 - } );
 664+ } );
665665 $j ( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-retry' ).click( function() {
666 - _this.hideFileEndButtons();
 666+ _this.hideFileEndButtons();
667667 _this.startUploads();
668668 } );
669669
@@ -676,7 +676,7 @@
677677 // if returns false, you can assume there are notifications in the interface.
678678 if ( _this.deedChooser.valid() ) {
679679
680 - var lastUploadIndex = _this.uploads.length - 1;
 680+ var lastUploadIndex = _this.uploads.length - 1;
681681
682682 $j.each( _this.uploads, function( i, upload ) {
683683
@@ -696,19 +696,19 @@
697697
698698
699699 // DETAILS div
700 - var finalizeDetails = function() {
 700+ var finalizeDetails = function() {
701701 if ( mw.isDefined( _this.allowCloseWindow ) ) {
702702 _this.allowCloseWindow();
703 - }
 703+ }
704704 _this.prefillThanksPage();
705705 _this.moveToStep( 'thanks' );
706706 };
707707
708708 var startDetails = function() {
709709 $j( '.mwe-upwiz-hint' ).each( function(i) { $j( this ).tipsy( 'hide' ); } ); // close tipsy help balloons
710 - if ( _this.detailsValid() ) {
711 - _this.hideDetailsEndButtons();
712 - _this.detailsSubmit( function() {
 710+ if ( _this.detailsValid() ) {
 711+ _this.hideDetailsEndButtons();
 712+ _this.detailsSubmit( function() {
713713 _this.showNext( 'details', 'complete', finalizeDetails );
714714 } );
715715 }
@@ -716,7 +716,7 @@
717717
718718 $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-some-failed' ).hide();
719719 $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-all-failed' ).hide();
720 -
 720+
721721 $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-start-next .mwe-upwiz-button-next' )
722722 .click( startDetails );
723723
@@ -724,13 +724,13 @@
725725 .click( function() {
726726 _this.removeErrorUploads( finalizeDetails );
727727 } );
728 -
 728+
729729 $j ( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-button-retry' )
730730 .click( startDetails );
731731
732732
733 - // WIZARD
734 -
 733+ // WIZARD
 734+
735735 // check to see if the the skip tutorial cookie is set
736736 if ( document.cookie.indexOf('skiptutorial=1') != -1 || UploadWizardConfig['skipTutorial'] ) {
737737 // "select" the second step - highlight, make it visible, hide all others
@@ -739,7 +739,7 @@
740740 // "select" the first step - highlight, make it visible, hide all others
741741 _this.moveToStep( 'tutorial' );
742742 }
743 -
 743+
744744 },
745745
746746
@@ -752,7 +752,7 @@
753753 new mw.UploadWizardDeedOwnWork( _this.uploads.length ),
754754 new mw.UploadWizardDeedThirdParty( _this.uploads.length )
755755 ];
756 -
 756+
757757 // if we have multiple uploads, also give them the option to set
758758 // licenses individually
759759 if ( _this.uploads.length > 1 ) {
@@ -764,13 +764,13 @@
765765 }
766766
767767 var uploadsClone = $j.map( _this.uploads, function( x ) { return x; } );
768 - _this.deedChooser = new mw.UploadWizardDeedChooser(
769 - '#mwe-upwiz-deeds',
 768+ _this.deedChooser = new mw.UploadWizardDeedChooser(
 769+ '#mwe-upwiz-deeds',
770770 deeds,
771771 uploadsClone
772772 );
773773
774 -
 774+
775775 $j( '<div></div>' )
776776 .insertBefore( _this.deedChooser.$selector.find( '.mwe-upwiz-deed-ownwork' ) )
777777 .msg( 'mwe-upwiz-deeds-macro-prompt', _this.uploads.length );
@@ -781,14 +781,14 @@
782782 .msg( 'mwe-upwiz-deeds-custom-prompt' );
783783 }
784784
785 - _this.moveToStep( 'deeds' );
 785+ _this.moveToStep( 'deeds' );
786786
787 - },
 787+ },
788788
789789 /**
790790 * Advance one "step" in the wizard interface.
791791 * It is assumed that the previous step to the current one was selected.
792 - * We do not hide the tabs because this messes up certain calculations we'd like to make about dimensions, while elements are not
 792+ * We do not hide the tabs because this messes up certain calculations we'd like to make about dimensions, while elements are not
793793 * on screen. So instead we make the tabs zero height and, in CSS, they are already overflow hidden
794794 * @param selectedStepName
795795 * @param callback to do after layout is ready?
@@ -800,10 +800,10 @@
801801 $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
802802
803803 $j.each( _this.stepNames, function(i, stepName) {
804 -
805 - // the step indicator
 804+
 805+ // the step indicator
806806 var step = $j( '#mwe-upwiz-step-' + stepName );
807 -
 807+
808808 // the step's contents
809809 var stepDiv = $j( '#mwe-upwiz-stepdiv-' + stepName );
810810
@@ -812,18 +812,18 @@
813813 } else {
814814 stepDiv.hide();
815815 }
816 -
 816+
817817 } );
818 -
 818+
819819 $j( '#mwe-upwiz-steps' ).arrowStepsHighlight( '#mwe-upwiz-step-' + selectedStepName );
820820
821821 _this.currentStepName = selectedStepName;
822 -
 822+
823823 if ( selectedStepName == 'file' && _this.uploads.length === 0 ) {
824 - // add one upload field to start (this is the big one that asks you to upload something)
 824+ // add one upload field to start (this is the big one that asks you to upload something)
825825 var upload = _this.newUpload();
826826 }
827 -
 827+
828828 $j.each( _this.uploads, function(i, upload) {
829829 upload.state = selectedStepName;
830830 } );
@@ -838,7 +838,7 @@
839839 * we create the upload interface, a handler to transport it to the server,
840840 * and UI for the upload itself and the "details" at the second step of the wizard.
841841 * we don't yet add it to the list of uploads; that only happens when it gets a real file.
842 - * @return the new upload
 842+ * @return the new upload
843843 */
844844 newUpload: function() {
845845 var _this = this;
@@ -851,19 +851,19 @@
852852
853853 // we explicitly move the file input to cover the upload button
854854 upload.ui.moveFileInputToCover( '#mwe-upwiz-add-file' );
855 -
 855+
856856 // we bind to the ui div since unbind doesn't work for non-DOM objects
857857
858858 $j( upload.ui.div ).bind( 'filenameAccepted', function(e) { _this.updateFileCounts(); e.stopPropagation(); } );
859859 $j( upload.ui.div ).bind( 'removeUploadEvent', function(e) { _this.removeUpload( upload ); e.stopPropagation(); } );
860 - $j( upload.ui.div ).bind( 'filled', function(e) {
861 - _this.newUpload();
 860+ $j( upload.ui.div ).bind( 'filled', function(e) {
 861+ _this.newUpload();
862862 _this.setUploadFilled(upload);
863 - e.stopPropagation();
 863+ e.stopPropagation();
864864 } );
865865 // XXX bind to some error state
866866
867 -
 867+
868868 return upload;
869869 },
870870
@@ -874,17 +874,17 @@
875875 */
876876 setUploadFilled: function( upload ) {
877877 var _this = this;
878 -
 878+
879879 _this.uploads.push( upload );
880 -
 880+
881881 /* useful for making ids unique and so on */
882882 _this.uploadsSeen++;
883883 upload.index = _this.uploadsSeen;
884884
885885 _this.updateFileCounts();
886 -
887 - upload.deedPreview = new mw.UploadWizardDeedPreview( upload );
888886
 887+ upload.deedPreview = new mw.UploadWizardDeedPreview( upload );
 888+
889889 // TODO v1.1 consider if we really have to set up details now
890890 upload.details = new mw.UploadWizardDetails( upload, $j( '#mwe-upwiz-macro-files' ) );
891891 },
@@ -893,9 +893,9 @@
894894 uploadsSeen: 0,
895895
896896 /**
897 - * Remove an upload from our array of uploads, and the HTML UI
 897+ * Remove an upload from our array of uploads, and the HTML UI
898898 * We can remove the HTML UI directly, as jquery will just get the parent.
899 - * We need to grep through the array of uploads, since we don't know the current index.
 899+ * We need to grep through the array of uploads, since we don't know the current index.
900900 * We need to update file counts for obvious reasons.
901901 *
902902 * @param upload
@@ -906,8 +906,8 @@
907907 var $div = $j( upload.ui.div );
908908 $div.unbind(); // everything
909909 // sexily fade away (TODO if we are looking at it)
910 - //$div.fadeOut('fast', function() {
911 - $div.remove();
 910+ //$div.fadeOut('fast', function() {
 911+ $div.remove();
912912 // and do what we in the wizard need to do after an upload is removed
913913 mw.UploadWizardUtil.removeItem( _this.uploads, upload );
914914 _this.updateFileCounts();
@@ -915,14 +915,14 @@
916916 },
917917
918918
919 - /**
 919+ /**
920920 * Hide the button choices at the end of the file step.
921921 */
922922 hideFileEndButtons: function() {
923923 $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-file-endchoice' ).hide();
924924 },
925925
926 - hideDetailsEndButtons: function() {
 926+ hideDetailsEndButtons: function() {
927927 $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-file-endchoice' ).hide();
928928 },
929929
@@ -944,7 +944,7 @@
945945 this.removeMatchingUploads( function( upload ) {
946946 return upload.state === 'error';
947947 } );
948 - endCallback();
 948+ endCallback();
949949 },
950950
951951
@@ -956,7 +956,7 @@
957957 removeMatchingUploads: function( criterion ) {
958958 var toRemove = [];
959959
960 - $j.each( this.uploads, function( i, upload ) {
 960+ $j.each( this.uploads, function( i, upload ) {
961961 if ( criterion( upload ) ) {
962962 toRemove.push( upload );
963963 }
@@ -973,13 +973,13 @@
974974 * Manage transitioning all of our uploads from one state to another -- like from "new" to "uploaded".
975975 *
976976 * @param beginState what state the upload should be in before starting.
977 - * @param progressState the state to set the upload to while it's doing whatever
 977+ * @param progressState the state to set the upload to while it's doing whatever
978978 * @param endState the state (or array of states) that signify we're done with this process
979 - * @param starter function, taking single argument (upload) which starts the process we're interested in
 979+ * @param starter function, taking single argument (upload) which starts the process we're interested in
980980 * @param endCallback function to call when all uploads are in the end state.
981981 */
982982 makeTransitioner: function( beginState, progressStates, endStates, starter, endCallback ) {
983 -
 983+
984984 var _this = this;
985985
986986 var transitioner = function() {
@@ -993,12 +993,12 @@
994994 } else if ( ( upload.state == beginState ) && ( uploadsToStart > 0 ) ) {
995995 starter( upload );
996996 uploadsToStart--;
997 - }
 997+ }
998998 } );
999999
10001000 // build in a little delay even for the end state, so user can see progress bar in a complete state.
10011001 var nextAction = ( endStateCount == _this.uploads.length ) ? endCallback : transitioner;
1002 -
 1002+
10031003 setTimeout( nextAction, _this.transitionerDelay );
10041004 };
10051005
@@ -1010,7 +1010,7 @@
10111011
10121012 /**
10131013 * Kick off the upload processes.
1014 - * Does some precalculations, changes the interface to be less mutable, moves the uploads to a queue,
 1014+ * Does some precalculations, changes the interface to be less mutable, moves the uploads to a queue,
10151015 * and kicks off a thread which will take from the queue.
10161016 * @param endCallback - to execute when uploads are completed
10171017 */
@@ -1023,7 +1023,7 @@
10241024 $j( '#mwe-upwiz-add-file' ).hide();
10251025
10261026 // reset any uploads in error state back to be shiny & new
1027 - $j.each( _this.uploads, function( i, upload ) {
 1027+ $j.each( _this.uploads, function( i, upload ) {
10281028 if ( upload.state === 'error' ) {
10291029 upload.state = 'new';
10301030 upload.ui.clearIndicator();
@@ -1031,50 +1031,50 @@
10321032 }
10331033 } );
10341034
1035 - this.allowCloseWindow = mw.confirmCloseWindow( {
 1035+ this.allowCloseWindow = mw.confirmCloseWindow( {
10361036 message: function() { return gM( 'mwe-upwiz-prevent-close', _this.uploads.length ); },
10371037 test: function() { return _this.uploads.length > 0; }
10381038 } );
10391039
10401040 $j( '#mwe-upwiz-progress' ).show();
1041 - var progressBar = new mw.GroupProgressBar( '#mwe-upwiz-progress',
1042 - gM( 'mwe-upwiz-uploading' ),
 1041+ var progressBar = new mw.GroupProgressBar( '#mwe-upwiz-progress',
 1042+ gM( 'mwe-upwiz-uploading' ),
10431043 _this.uploads,
10441044 [ 'stashed' ],
10451045 [ 'error' ],
1046 - 'transportProgress',
 1046+ 'transportProgress',
10471047 'transportWeight' );
10481048 progressBar.start();
1049 -
 1049+
10501050 // remove ability to change files
10511051 // ideally also hide the "button"... but then we require styleable file input CSS trickery
10521052 // although, we COULD do this just for files already in progress...
10531053
1054 - // it might be interesting to just make this creational -- attach it to the dom element representing
1055 - // the progress bar and elapsed time
 1054+ // it might be interesting to just make this creational -- attach it to the dom element representing
 1055+ // the progress bar and elapsed time
10561056
1057 - _this.makeTransitioner(
1058 - 'new',
 1057+ _this.makeTransitioner(
 1058+ 'new',
10591059 [ 'transporting', 'transported', 'metadata' ],
1060 - [ 'error', 'stashed' ],
 1060+ [ 'error', 'stashed' ],
10611061 function( upload ) {
10621062 upload.start();
10631063 },
10641064 function() {
10651065 $j().notify( gM( 'mwe-upwiz-files-complete' ) );
10661066 _this.showNext( 'file', 'stashed' );
1067 - }
 1067+ }
10681068 );
10691069 },
10701070
1071 - /**
 1071+ /**
10721072 * Figure out what to do and what options to show after the uploads have stopped.
10731073 * Uploading has stopped for one of the following reasons:
10741074 * 1) The user removed all uploads before they completed, in which case we are at upload.length === 0. We should start over and allow them to add new ones
10751075 * 2) All succeeded - show link to next step
1076 - * 3) Some failed, some succeeded - offer them the chance to retry the failed ones or go on to the next step
 1076+ * 3) Some failed, some succeeded - offer them the chance to retry the failed ones or go on to the next step
10771077 * 4) All failed -- have to retry, no other option
1078 - * In principle there could be other configurations, like having the uploads not all in error or stashed state, but
 1078+ * In principle there could be other configurations, like having the uploads not all in error or stashed state, but
10791079 * we trust that this hasn't happened.
10801080 *
10811081 * @param {String} step that we are on
@@ -1087,7 +1087,7 @@
10881088 if ( upload.state === 'error' ) {
10891089 errorCount++;
10901090 } else if ( upload.state === desiredState ) {
1091 - okCount++;
 1091+ okCount++;
10921092 } else {
10931093 mw.log( "mw.UploadWizardUpload::showFileNext> upload " + i + " not in appropriate state for filenext: " + upload.state );
10941094 }
@@ -1108,10 +1108,10 @@
11091109 } else {
11101110 $j( '#mwe-upwiz-stepdiv-' + step + ' .mwe-upwiz-buttons' ).show().find( selector ).show();
11111111 }
1112 - },
1113 -
 1112+ },
 1113+
11141114 /**
1115 - * Occurs whenever we need to update the interface based on how many files there are
 1115+ * Occurs whenever we need to update the interface based on how many files there are
11161116 * Thhere is an uncounted upload, waiting to be used, which has a fileInput which covers the
11171117 * "add an upload" button. This is absolutely positioned, so it needs to be moved if another upload was removed.
11181118 * The uncounted upload is also styled differently between the zero and n files cases
@@ -1143,7 +1143,7 @@
11441144 $j( '#mwe-upwiz-filelist .filled:even' ).removeClass( 'odd' );
11451145 } else {
11461146 // no uploads, so don't allow us to proceed
1147 - // $j( '#mwe-upwiz-upload-ctrl' ).attr( 'disabled', 'disabled' );
 1147+ // $j( '#mwe-upwiz-upload-ctrl' ).attr( 'disabled', 'disabled' );
11481148 $j( '#mwe-upwiz-upload-ctrl-container' ).hide();
11491149
11501150
@@ -1168,11 +1168,11 @@
11691169 $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-some-failed' ).hide();
11701170 $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-all-failed' ).hide();
11711171 $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-start-next' ).show();
1172 -
 1172+
11731173 // fix various other pages that may have state
11741174 $j( '#mwe-upwiz-thanks' ).html( '' );
11751175
1176 - if ( mw.isDefined( _this.deedChooser ) ) {
 1176+ if ( mw.isDefined( _this.deedChooser ) ) {
11771177 _this.deedChooser.remove();
11781178 }
11791179
@@ -1202,11 +1202,11 @@
12031203 /**
12041204 * are all the details valid?
12051205 * @return boolean
1206 - */
 1206+ */
12071207 detailsValid: function() {
12081208 var _this = this;
12091209 var valid = true;
1210 - $j.each( _this.uploads, function(i, upload) {
 1210+ $j.each( _this.uploads, function(i, upload) {
12111211 valid &= upload.details.valid();
12121212 } );
12131213 return valid;
@@ -1220,7 +1220,7 @@
12211221 detailsSubmit: function( endCallback ) {
12221222 var _this = this;
12231223
1224 - $j.each( _this.uploads, function( i, upload ) {
 1224+ $j.each( _this.uploads, function( i, upload ) {
12251225 $j( upload.details.submittingDiv )
12261226 .find( '.mwe-upwiz-visible-file-filename-text' )
12271227 .html( upload.title.getMain() );
@@ -1232,11 +1232,11 @@
12331233 .morphCrossfade( '.mwe-upwiz-submitting' );
12341234
12351235 // add the upload progress bar, with ETA
1236 - // add in the upload count
 1236+ // add in the upload count
12371237 _this.makeTransitioner(
1238 - 'details',
1239 - [ 'submitting-details' ],
1240 - [ 'error', 'complete' ],
 1238+ 'details',
 1239+ [ 'submitting-details' ],
 1240+ [ 'error', 'complete' ],
12411241 function( upload ) {
12421242 upload.details.submit();
12431243 },
@@ -1246,18 +1246,18 @@
12471247
12481248 prefillThanksPage: function() {
12491249 var _this = this;
1250 -
 1250+
12511251 $j( '#mwe-upwiz-thanks' )
12521252 .append( $j( '<h3 style="text-align: center;"></h3>' ).msg( 'mwe-upwiz-thanks-intro' ),
12531253 $j( '<p style="margin-bottom: 2em; text-align: center;">' )
12541254 .msg( 'mwe-upwiz-thanks-explain', _this.uploads.length ) );
1255 -
 1255+
12561256 $j.each( _this.uploads, function(i, upload) {
12571257 var id = 'thanksDiv' + i;
12581258 var $thanksDiv = $j( '<div></div>' ).attr( 'id', id ).addClass( "mwe-upwiz-thanks ui-helper-clearfix" );
12591259 _this.thanksDiv = $thanksDiv;
1260 -
12611260
 1261+
12621262 var $thumbnailDiv = $j( '<div></div>' ).addClass( 'mwe-upwiz-thumbnail' );
12631263 var $thumbnailCaption = $j( '<div></div>' )
12641264 .css( { 'text-align': 'center', 'font-size': 'small' } )
@@ -1275,16 +1275,16 @@
12761276
12771277 var thumbTitle = String(upload.title);
12781278 var thumbWikiText = "[[" + thumbTitle.replace(/_/g, ' ') + "|thumb|" + gM( 'mwe-upwiz-thanks-caption' ) + "]]";
1279 -
 1279+
12801280 $thanksDiv.append(
12811281 $j( '<div class="mwe-upwiz-data"></div>' )
1282 - .append(
1283 - $j('<p/>').append(
 1282+ .append(
 1283+ $j('<p/>').append(
12841284 gM( 'mwe-upwiz-thanks-wikitext' ),
12851285 $j( '<br />' ),
12861286 _this.makeReadOnlyInput( thumbWikiText )
12871287 ),
1288 - $j('<p/>').append(
 1288+ $j('<p/>').append(
12891289 gM( 'mwe-upwiz-thanks-url' ),
12901290 $j( '<br />' ),
12911291 _this.makeReadOnlyInput( upload.imageinfo.descriptionurl )
@@ -1293,9 +1293,9 @@
12941294 );
12951295
12961296 $j( '#mwe-upwiz-thanks' ).append( $thanksDiv );
1297 - } );
 1297+ } );
12981298 },
1299 -
 1299+
13001300 /**
13011301 * make a read only text input, which self-selects on gaining focus
13021302 * @param {String} text it will contain
@@ -1333,7 +1333,7 @@
13341334
13351335 };
13361336
1337 -/**
 1337+/**
13381338 * Makes a modal dialog to confirm deletion of one or more uploads. Will have "Remove" and "Cancel" buttons
13391339 * @param {Array} array of UploadWizardUpload objects
13401340 * @param {String} message for dialog title
@@ -1341,12 +1341,12 @@
13421342 */
13431343 mw.UploadWizardDeleteDialog = function( uploads, dialogTitle, dialogText ) {
13441344 var $filenameList = $j( '<ul></ul>' );
1345 - $j.each( uploads, function( i, upload ) {
 1345+ $j.each( uploads, function( i, upload ) {
13461346 $filenameList.append( $j( '<li></li>' ).append( upload.title.getMain() ) );
13471347 } );
13481348 var buttons = {};
1349 - buttons[ gM( 'mwe-upwiz-remove', uploads.length ) ] = function() {
1350 - $j.each( uploads, function( i, upload ) {
 1349+ buttons[ gM( 'mwe-upwiz-remove', uploads.length ) ] = function() {
 1350+ $j.each( uploads, function( i, upload ) {
13511351 upload.remove();
13521352 } );
13531353 $j( this ).dialog( 'close' );
@@ -1357,7 +1357,7 @@
13581358
13591359 return $j( '<div></div>' )
13601360 .append( $j( '<p></p>' ).append( dialogText ), $filenameList )
1361 - .dialog( {
 1361+ .dialog( {
13621362 width: 500,
13631363 zIndex: 200000,
13641364 autoOpen: false,
@@ -1414,7 +1414,7 @@
14151415 this.addClass( 'mwe-upwiz-required-field' );
14161416 return this.prepend( $j( '<span/>' ).append( '*' ).addClass( 'mwe-upwiz-required-marker' ) );
14171417 };
1418 -
 1418+
14191419 /**
14201420 * Adds a tipsy pop-up help button to the field. Can be called in two ways -- with simple string id, which identifies
14211421 * the string as 'mwe-upwiz-tooltip-' plus that id, and creates the hint with a similar id
@@ -1429,16 +1429,16 @@
14301430 attrs = { id: key };
14311431 contentSource = fn;
14321432 html = true;
1433 - } else {
 1433+ } else {
14341434 attrs = { 'title': gM( 'mwe-upwiz-tooltip-' + key ) };
14351435 contentSource = 'title';
1436 - }
1437 - return this.append(
 1436+ }
 1437+ return this.append(
14381438 $j( '<span/>' )
14391439 .addClass( 'mwe-upwiz-hint' )
14401440 .attr( attrs )
14411441 .click( function() { $j( this ).tipsy( 'toggle' ); return false; } )
1442 - .tipsy( { title: contentSource, html: html, opacity: 1.0, gravity: 'sw', trigger: 'manual'} )
 1442+ .tipsy( { title: contentSource, html: html, opacity: 1.0, gravity: 'sw', trigger: 'manual'} )
14431443 );
14441444 };
14451445
@@ -1450,8 +1450,8 @@
14511451
14521452 // this is a jquery-style object
14531453
1454 - // in MSIE, this makes it possible to know what scrollheight is
1455 - // Technically this means text could now dangle over the edge,
 1454+ // in MSIE, this makes it possible to know what scrollheight is
 1455+ // Technically this means text could now dangle over the edge,
14561456 // but it shouldn't because it will always grow to accomodate very quickly.
14571457
14581458 if ($j.msie) {
@@ -1466,7 +1466,7 @@
14671467 if (this.scrollHeight >= this.offsetHeight) {
14681468 this.rows++;
14691469 while (this.scrollHeight > this.offsetHeight) {
1470 - this.rows++;
 1470+ this.rows++;
14711471 }
14721472 }
14731473 return this;
@@ -1475,7 +1475,7 @@
14761476 this.addClass( 'mwe-grow-textarea' );
14771477
14781478 this.bind( 'resizeEvent', resizeIfNeeded );
1479 -
 1479+
14801480 this.keyup( resizeIfNeeded );
14811481 this.change( resizeIfNeeded );
14821482
@@ -1486,14 +1486,14 @@
14871487 // XXX this is highly specific to the "details" page now, not really jQuery function
14881488 jQuery.fn.mask = function( options ) {
14891489
1490 - // intercept clicks...
 1490+ // intercept clicks...
14911491 // Note: the size of the div must be obtainable. Hence, this cannot be a div without layout (e.g. display:none).
14921492 // some of this is borrowed from http://code.google.com/p/jquery-loadmask/ , but simplified
14931493 $j.each( this, function( i, el ) {
1494 -
 1494+
14951495 if ( ! $j( el ).data( 'mask' ) ) {
1496 -
14971496
 1497+
14981498 //fix for z-index bug with selects in IE6
14991499 if ( $j.browser.msie && $j.browser.version.substring(0,1) === '6' ){
15001500 $j( el ).find( "select" ).addClass( "masked-hidden" );
@@ -1506,7 +1506,7 @@
15071507 'height' : el.offsetHeight + 'px',
15081508 'z-index' : 90
15091509 } );
1510 -
 1510+
15111511 var $statusDiv = $j( '<div></div>' ).css( {
15121512 'width' : el.offsetWidth + 'px',
15131513 'height' : el.offsetHeight + 'px',
@@ -1518,14 +1518,14 @@
15191519 } );
15201520
15211521 var $indicatorDiv = $j( '<div class="mwe-upwiz-status"></div>' )
1522 - .css( {
 1522+ .css( {
15231523 'width' : 32,
1524 - 'height' : 32,
 1524+ 'height' : 32,
15251525 'z-index' : 91,
15261526 'margin' : '0 auto 0 auto'
15271527 } );
15281528 var $statusLineDiv = $j( '<div></div>' )
1529 - .css( {
 1529+ .css( {
15301530 'z-index' : 91
15311531 } );
15321532 var $statusIndicatorLineDiv = $j( '<div></div>' )
@@ -1533,13 +1533,13 @@
15341534 .append( $indicatorDiv, $statusLineDiv );
15351535 $statusDiv.append( $statusIndicatorLineDiv );
15361536
1537 - $j( el ).css( { 'position' : 'relative' } )
 1537+ $j( el ).css( { 'position' : 'relative' } )
15381538 .append( mask.fadeTo( 'fast', 0.6 ) )
15391539 .append( $statusDiv )
15401540 .data( 'indicator', $indicatorDiv )
15411541 .data( 'statusLine', $statusLineDiv );
1542 -
1543 - }
 1542+
 1543+ }
15441544 } );
15451545
15461546 return this;
@@ -1558,7 +1558,7 @@
15591559 }
15601560 } );
15611561
1562 -
 1562+
15631563 return this;
15641564 };
15651565
@@ -1566,7 +1566,7 @@
15671567 * jQuery plugin - collapse toggle
15681568 * Given an element, makes contained elements of class mw-collapsible-toggle clickable to show/reveal
15691569 * contained element(s) of class mw-collapsible-content.
1570 - *
 1570+ *
15711571 * Somewhat recapitulates mw.UploadWizardUtil.makeToggler,
15721572 * toggle() in vector.collapsibleNav.js, not to mention jquery.collapsible
15731573 * but none of those do what we want, or are inaccessible to us
@@ -1581,7 +1581,7 @@
15821582 e.stopPropagation();
15831583 if ( $toggle.hasClass( 'mwe-upwiz-toggler-open' ) ) {
15841584 $contents.slideUp( 250 );
1585 - $toggle.removeClass( 'mwe-upwiz-toggler-open' );
 1585+ $toggle.removeClass( 'mwe-upwiz-toggler-open' );
15861586 } else {
15871587 $contents.slideDown( 250 );
15881588 $toggle.addClass( 'mwe-upwiz-toggler-open' );

Status & tagging log