Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -17,12 +17,12 @@ |
18 | 18 | this.extension = undefined; |
19 | 19 | |
20 | 20 | 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 |
23 | 23 | this.transportWeight = 1; // default |
24 | 24 | this.detailsWeight = 1; // default |
25 | 25 | |
26 | | - // details |
| 26 | + // details |
27 | 27 | this.ui = new mw.UploadWizardUploadInterface( this, filesDiv ); |
28 | 28 | |
29 | 29 | // handler -- usually ApiUploadHandler |
— | — | @@ -45,11 +45,11 @@ |
46 | 46 | var _this = this; |
47 | 47 | _this.setTransportProgress(0.0); |
48 | 48 | //_this.ui.start(); |
49 | | - _this.handler.start(); |
| 49 | + _this.handler.start(); |
50 | 50 | }, |
51 | 51 | |
52 | 52 | /** |
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 |
54 | 54 | */ |
55 | 55 | remove: function() { |
56 | 56 | this.state = 'aborted'; |
— | — | @@ -57,13 +57,13 @@ |
58 | 58 | this.deedThumbnailDiv.remove(); |
59 | 59 | } |
60 | 60 | if ( this.details && this.details.div ) { |
61 | | - this.details.div.remove(); |
| 61 | + this.details.div.remove(); |
62 | 62 | } |
63 | 63 | if ( this.thanksDiv ) { |
64 | 64 | this.thanksDiv.remove(); |
65 | 65 | } |
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 |
68 | 68 | // trigger through the div. Triggering through objects doesn't always work. |
69 | 69 | // TODO v.1.1 fix, don't need to use the div any more -- this now works in jquery 1.4.2 |
70 | 70 | $j( this.ui.div ).trigger( 'removeUploadEvent' ); |
— | — | @@ -92,16 +92,16 @@ |
93 | 93 | }, |
94 | 94 | |
95 | 95 | /** |
96 | | - * Stop the upload -- we have failed for some reason |
| 96 | + * Stop the upload -- we have failed for some reason |
97 | 97 | */ |
98 | | - setError: function( code, info ) { |
| 98 | + setError: function( code, info ) { |
99 | 99 | this.state = 'error'; |
100 | 100 | this.transportProgress = 0; |
101 | 101 | this.ui.showError( code, info ); |
102 | 102 | }, |
103 | 103 | |
104 | 104 | /** |
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 |
106 | 106 | * @param result the API result in parsed JSON form |
107 | 107 | */ |
108 | 108 | setTransported: function( result ) { |
— | — | @@ -125,11 +125,11 @@ |
126 | 126 | info = _this.filenameToUrl( existsFileName ).toString(); |
127 | 127 | } catch ( e ) { |
128 | 128 | code = 'unknown'; |
129 | | - info = 'Warned about existing filename, but filename is unparseable: "' + existsFileName + "'"; |
| 129 | + info = 'Warned about existing filename, but filename is unparseable: "' + existsFileName + "'"; |
130 | 130 | } |
131 | 131 | _this.addWarning( code, info ); |
132 | 132 | _this.extractUploadInfo( result.upload ); |
133 | | - var success = function( imageinfo ) { |
| 133 | + var success = function( imageinfo ) { |
134 | 134 | if ( imageinfo === null ) { |
135 | 135 | _this.setError( 'noimageinfo' ); |
136 | 136 | } else { |
— | — | @@ -151,13 +151,13 @@ |
152 | 152 | $j.each( result.upload.warnings, function( k, v ) { |
153 | 153 | warningInfo.push( k + ': ' + v ); |
154 | 154 | } ); |
155 | | - info = warningInfo.join( ', ' ); |
156 | | - _this.setError( code, [ info ] ); |
| 155 | + info = warningInfo.join( ', ' ); |
| 156 | + _this.setError( code, [ info ] ); |
157 | 157 | } |
158 | 158 | } else if ( result.upload && result.upload.result === 'Success' ) { |
159 | 159 | if ( result.upload.imageinfo ) { |
160 | 160 | _this.setSuccess( result ); |
161 | | - } else { |
| 161 | + } else { |
162 | 162 | _this.setError( 'noimageinfo', info ); |
163 | 163 | } |
164 | 164 | } else { |
— | — | @@ -184,13 +184,13 @@ |
185 | 185 | duplicateErrorInfo: function( code, resultDuplicate ) { |
186 | 186 | var _this = this; |
187 | 187 | var duplicates; |
188 | | - if ( typeof resultDuplicate === 'object' ) { |
| 188 | + if ( typeof resultDuplicate === 'object' ) { |
189 | 189 | duplicates = resultDuplicate; |
190 | 190 | } else if ( typeof resultDuplicate === 'string' ) { |
191 | 191 | duplicates = [ resultDuplicate ]; |
192 | 192 | } |
193 | 193 | var $ul = $j( '<ul></ul>' ); |
194 | | - $j.each( duplicates, function( i, filename ) { |
| 194 | + $j.each( duplicates, function( i, filename ) { |
195 | 195 | var $a = $j( '<a/>' ).append( filename ); |
196 | 196 | try { |
197 | 197 | var href = _this.filenameToUrl( filename ); |
— | — | @@ -224,24 +224,24 @@ |
225 | 225 | var _this = this; // was a triumph |
226 | 226 | _this.state = 'transported'; |
227 | 227 | _this.transportProgress = 1; |
228 | | - |
| 228 | + |
229 | 229 | // I'm making a note here |
230 | 230 | _this.ui.setStatus( 'mwe-upwiz-getting-metadata' ); |
231 | 231 | if ( result.upload ) { |
232 | 232 | _this.extractUploadInfo( result.upload ); |
233 | | - _this.getThumbnail( |
| 233 | + _this.getThumbnail( |
234 | 234 | function( image ) { |
235 | 235 | // n.b. if server returns a URL, which is a 404, we do NOT get broken image |
236 | 236 | _this.ui.setPreview( image ); // make the thumbnail the preview image |
237 | 237 | }, |
238 | | - mw.UploadWizard.config[ 'thumbnailWidth' ], |
239 | | - mw.UploadWizard.config[ 'thumbnailMaxHeight' ] |
| 238 | + mw.UploadWizard.config[ 'thumbnailWidth' ], |
| 239 | + mw.UploadWizard.config[ 'thumbnailMaxHeight' ] |
240 | 240 | ); |
241 | 241 | // create the large thumbnail that the other thumbnails link to |
242 | | - _this.getThumbnail( |
| 242 | + _this.getThumbnail( |
243 | 243 | function( image ) {}, |
244 | | - mw.UploadWizard.config[ 'largeThumbnailWidth' ], |
245 | | - mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ] |
| 244 | + mw.UploadWizard.config[ 'largeThumbnailWidth' ], |
| 245 | + mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ] |
246 | 246 | ); |
247 | 247 | _this.deedPreview.setup(); |
248 | 248 | _this.details.populate(); |
— | — | @@ -250,9 +250,9 @@ |
251 | 251 | } else { |
252 | 252 | _this.setError( 'noimageinfo' ); |
253 | 253 | } |
254 | | - |
| 254 | + |
255 | 255 | }, |
256 | | - |
| 256 | + |
257 | 257 | /** |
258 | 258 | * Called when the file is entered into the file input |
259 | 259 | * Get as much data as possible -- maybe exif, even thumbnail maybe |
— | — | @@ -262,22 +262,22 @@ |
263 | 263 | this.transportWeight = getFileSize(); |
264 | 264 | } |
265 | 265 | // XXX sanitize filename |
266 | | - try { |
| 266 | + try { |
267 | 267 | this.title = new mw.Title( mw.UploadWizardUtil.getBasename( filename ).replace( /:/g, '_' ), 'file' ); |
268 | 268 | } catch ( e ) { |
269 | 269 | this.setError( 'mwe-upwiz-unparseable-filename', filename ); |
270 | 270 | } |
271 | 271 | }, |
272 | 272 | |
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 |
275 | 275 | * |
276 | 276 | * @param result The JSON object from a successful API upload result. |
277 | 277 | */ |
278 | 278 | extractUploadInfo: function( resultUpload ) { |
279 | 279 | if ( resultUpload.sessionkey ) { |
280 | 280 | this.sessionKey = resultUpload.sessionkey; |
281 | | - } |
| 281 | + } |
282 | 282 | if ( resultUpload.imageinfo ) { |
283 | 283 | this.extractImageInfo( resultUpload.imageinfo ); |
284 | 284 | } else if ( resultUpload.stashimageinfo ) { |
— | — | @@ -288,7 +288,7 @@ |
289 | 289 | }, |
290 | 290 | |
291 | 291 | /** |
292 | | - * Extract image info into our upload object |
| 292 | + * Extract image info into our upload object |
293 | 293 | * Image info is obtained from various different API methods |
294 | 294 | * @param imageinfo JSON object obtained from API result. |
295 | 295 | */ |
— | — | @@ -309,18 +309,18 @@ |
310 | 310 | _this.imageinfo[key] = imageinfo[key]; |
311 | 311 | } |
312 | 312 | } |
313 | | - |
| 313 | + |
314 | 314 | if ( _this.title.getExtension() === null ) { |
315 | 315 | 1; |
316 | 316 | // 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 |
317 | 317 | // never know... theoretically there is no restriction on extensions if we are uploading to the stash, but the check is performed anyway. |
318 | | - /* |
| 318 | + /* |
319 | 319 | var extension = mw.UploadWizardUtil.getExtension( _this.imageinfo.url ); |
320 | 320 | if ( !extension ) { |
321 | 321 | if ( _this.imageinfo.mimetype ) { |
322 | 322 | 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 | + } |
325 | 325 | } |
326 | 326 | } |
327 | 327 | */ |
— | — | @@ -340,7 +340,7 @@ |
341 | 341 | |
342 | 342 | if (!mw.isDefined( props ) ) { |
343 | 343 | props = []; |
344 | | - } |
| 344 | + } |
345 | 345 | |
346 | 346 | var params = { |
347 | 347 | 'prop': 'stashimageinfo', |
— | — | @@ -353,7 +353,7 @@ |
354 | 354 | props.push( 'url' ); |
355 | 355 | } |
356 | 356 | if ( mw.isDefined( width ) ) { |
357 | | - params['siiurlwidth'] = width; |
| 357 | + params['siiurlwidth'] = width; |
358 | 358 | } |
359 | 359 | if ( mw.isDefined( height ) ) { |
360 | 360 | params['siiurlheight'] = height; |
— | — | @@ -368,7 +368,7 @@ |
369 | 369 | } |
370 | 370 | callback( data.query.stashimageinfo ); |
371 | 371 | }; |
372 | | - |
| 372 | + |
373 | 373 | var err = function( code, result ) { |
374 | 374 | mw.log( 'mw.UploadWizardUpload::getStashImageInfo> error: ' + code, 'debug' ); |
375 | 375 | callback( null ); |
— | — | @@ -378,7 +378,7 @@ |
379 | 379 | }, |
380 | 380 | |
381 | 381 | /** |
382 | | - * Fetch a thumbnail for a stashed upload of the desired width. |
| 382 | + * Fetch a thumbnail for a stashed upload of the desired width. |
383 | 383 | * It is assumed you don't call this until it's been transported. |
384 | 384 | * |
385 | 385 | * @param callback - callback to execute once thumbnail has been obtained -- must accept Image object for success, null for error |
— | — | @@ -394,7 +394,7 @@ |
395 | 395 | if ( mw.isDefined( _this.thumbnails[key] ) ) { |
396 | 396 | callback( _this.thumbnails[key] ); |
397 | 397 | } else { |
398 | | - var apiCallback = function( thumbnails ) { |
| 398 | + var apiCallback = function( thumbnails ) { |
399 | 399 | if ( thumbnails === null ) { |
400 | 400 | callback( null ); |
401 | 401 | } else { |
— | — | @@ -425,11 +425,11 @@ |
426 | 426 | * |
427 | 427 | * @param selector |
428 | 428 | * @param width |
429 | | - * @param height (optional) |
| 429 | + * @param height (optional) |
430 | 430 | */ |
431 | 431 | setThumbnail: function( selector, width, height ) { |
432 | 432 | var _this = this; |
433 | | - if ( typeof width === 'undefined' || width === null || width <= 0 ) { |
| 433 | + if ( typeof width === 'undefined' || width === null || width <= 0 ) { |
434 | 434 | width = mw.UploadWizard.config[ 'thumbnailWidth' ]; |
435 | 435 | } |
436 | 436 | width = parseInt( width, 10 ); |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | // set up lightbox behavior for thumbnail |
455 | 455 | .click( function() { |
456 | 456 | // get large preview image |
457 | | - _this.getThumbnail( |
| 457 | + _this.getThumbnail( |
458 | 458 | // open large preview in modal dialog box |
459 | 459 | function( image ) { |
460 | 460 | var dialogWidth = ( image.width > 200 ) ? image.width : 200; |
— | — | @@ -467,27 +467,27 @@ |
468 | 468 | 'resizable': false |
469 | 469 | } ); |
470 | 470 | }, |
471 | | - mw.UploadWizard.config[ 'largeThumbnailWidth' ], |
472 | | - mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ] |
| 471 | + mw.UploadWizard.config[ 'largeThumbnailWidth' ], |
| 472 | + mw.UploadWizard.config[ 'largeThumbnailMaxHeight' ] |
473 | 473 | ); |
474 | 474 | return false; |
475 | 475 | } ); // close thumbnail click function |
476 | 476 | } // close if |
477 | | - |
| 477 | + |
478 | 478 | $j( selector ).html( |
479 | 479 | // insert the thumbnail into the anchor |
480 | 480 | $thumbnailLink.append( |
481 | 481 | $j( '<img/>' ) |
482 | 482 | .attr( { |
483 | | - 'width': image.width, |
| 483 | + 'width': image.width, |
484 | 484 | 'height': image.height, |
485 | 485 | 'src': image.src |
486 | | - } ) |
| 486 | + } ) |
487 | 487 | ) // close append |
488 | 488 | ); // close html |
489 | 489 | } // close image !== null else condition |
490 | 490 | }; |
491 | | - |
| 491 | + |
492 | 492 | _this.getThumbnail( callback, width, height ); |
493 | 493 | }, |
494 | 494 | |
— | — | @@ -500,10 +500,10 @@ |
501 | 501 | var fileUrl = new mw.Uri( document.URL ); |
502 | 502 | fileUrl.path = wgScript; |
503 | 503 | var fileTitle = new mw.Title( filename, 'file' ); |
504 | | - fileUrl.query = { title: fileTitle, action: 'view' }; |
| 504 | + fileUrl.query = { title: fileTitle, action: 'view' }; |
505 | 505 | return fileUrl; |
506 | 506 | } |
507 | | - |
| 507 | + |
508 | 508 | }; |
509 | 509 | |
510 | 510 | |
— | — | @@ -521,7 +521,7 @@ |
522 | 522 | // elsewhere |
523 | 523 | mw.UploadWizard.config = config; |
524 | 524 | |
525 | | - // XXX need a robust way of defining default config |
| 525 | + // XXX need a robust way of defining default config |
526 | 526 | this.maxUploads = mw.UploadWizard.config[ 'maxUploads' ] || 10; |
527 | 527 | this.maxSimultaneousConnections = mw.UploadWizard.config[ 'maxSimultaneousConnections' ] || 2; |
528 | 528 | |
— | — | @@ -577,20 +577,20 @@ |
578 | 578 | this.removeMatchingUploads( function() { return true; } ); |
579 | 579 | }, |
580 | 580 | |
581 | | - |
| 581 | + |
582 | 582 | /** |
583 | 583 | * create the basic interface to make an upload in this div |
584 | 584 | * @param div The div in the DOM to put all of this into. |
585 | 585 | */ |
586 | 586 | createInterface: function( selector ) { |
587 | 587 | var _this = this; |
588 | | - |
| 588 | + |
589 | 589 | // load list of languages so we'll have it ready when description interfaces are created |
590 | 590 | // XXX replace this code once any of the following bugs are fixed: 25845, 27535, 27561 |
591 | 591 | var languageHandlerUrl = wgServer + wgScript + '?' + $.param( { 'title': 'MediaWiki:LanguageHandler.js', 'action': 'raw', 'ctype': 'text/javascript' } ); |
592 | 592 | mw.loader.load( languageHandlerUrl ); |
593 | | - |
594 | | - // remove first spinner |
| 593 | + |
| 594 | + // remove first spinner |
595 | 595 | $j( '#mwe-first-spinner' ).remove(); |
596 | 596 | |
597 | 597 | // feedback request |
— | — | @@ -598,14 +598,14 @@ |
599 | 599 | var feedback = new mw.Feedback( _this.api, |
600 | 600 | new mw.Title( mw.UploadWizard.config['feedbackPage'] ) ); |
601 | 601 | $j( '#contentSub' ) |
602 | | - .msg( 'mwe-upwiz-feedback-prompt', |
| 602 | + .msg( 'mwe-upwiz-feedback-prompt', |
603 | 603 | function() { |
604 | 604 | feedback.launch(); |
605 | 605 | return false; |
606 | 606 | } |
607 | 607 | ); |
608 | 608 | } |
609 | | - |
| 609 | + |
610 | 610 | // construct the arrow steps from the UL in the HTML |
611 | 611 | $j( '#mwe-upwiz-steps' ) |
612 | 612 | .addClass( 'ui-helper-clearfix ui-state-default ui-widget ui-helper-reset ui-helper-clearfix' ) |
— | — | @@ -617,7 +617,7 @@ |
618 | 618 | .button() |
619 | 619 | .css( { 'margin-left': '1em' } ); |
620 | 620 | |
621 | | - |
| 621 | + |
622 | 622 | $j( '.mwe-upwiz-button-begin' ) |
623 | 623 | .click( function() { _this.reset(); } ); |
624 | 624 | |
— | — | @@ -625,7 +625,7 @@ |
626 | 626 | .click( function() { window.location.href = '/'; } ); |
627 | 627 | |
628 | 628 | // handler for next button |
629 | | - $j( '#mwe-upwiz-stepdiv-tutorial .mwe-upwiz-button-next') |
| 629 | + $j( '#mwe-upwiz-stepdiv-tutorial .mwe-upwiz-button-next') |
630 | 630 | .click( function() { |
631 | 631 | // if the skip checkbox is checked, set the skip cookie |
632 | 632 | if ( $j('#mwe-upwiz-skip').is(':checked') ) { |
— | — | @@ -633,7 +633,7 @@ |
634 | 634 | } |
635 | 635 | _this.moveToStep( 'file' ); |
636 | 636 | } ); |
637 | | - |
| 637 | + |
638 | 638 | $j( '#mwe-upwiz-add-file' ).button(); |
639 | 639 | |
640 | 640 | $j( '#mwe-upwiz-upload-ctrl' ) |
— | — | @@ -657,12 +657,12 @@ |
658 | 658 | } ); |
659 | 659 | |
660 | 660 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-next' ).click( function() { |
661 | | - _this.removeErrorUploads( function() { |
| 661 | + _this.removeErrorUploads( function() { |
662 | 662 | _this.prepareAndMoveToDeeds(); |
663 | 663 | } ); |
664 | | - } ); |
| 664 | + } ); |
665 | 665 | $j ( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-button-retry' ).click( function() { |
666 | | - _this.hideFileEndButtons(); |
| 666 | + _this.hideFileEndButtons(); |
667 | 667 | _this.startUploads(); |
668 | 668 | } ); |
669 | 669 | |
— | — | @@ -676,7 +676,7 @@ |
677 | 677 | // if returns false, you can assume there are notifications in the interface. |
678 | 678 | if ( _this.deedChooser.valid() ) { |
679 | 679 | |
680 | | - var lastUploadIndex = _this.uploads.length - 1; |
| 680 | + var lastUploadIndex = _this.uploads.length - 1; |
681 | 681 | |
682 | 682 | $j.each( _this.uploads, function( i, upload ) { |
683 | 683 | |
— | — | @@ -696,19 +696,19 @@ |
697 | 697 | |
698 | 698 | |
699 | 699 | // DETAILS div |
700 | | - var finalizeDetails = function() { |
| 700 | + var finalizeDetails = function() { |
701 | 701 | if ( mw.isDefined( _this.allowCloseWindow ) ) { |
702 | 702 | _this.allowCloseWindow(); |
703 | | - } |
| 703 | + } |
704 | 704 | _this.prefillThanksPage(); |
705 | 705 | _this.moveToStep( 'thanks' ); |
706 | 706 | }; |
707 | 707 | |
708 | 708 | var startDetails = function() { |
709 | 709 | $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() { |
713 | 713 | _this.showNext( 'details', 'complete', finalizeDetails ); |
714 | 714 | } ); |
715 | 715 | } |
— | — | @@ -716,7 +716,7 @@ |
717 | 717 | |
718 | 718 | $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-some-failed' ).hide(); |
719 | 719 | $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-all-failed' ).hide(); |
720 | | - |
| 720 | + |
721 | 721 | $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-start-next .mwe-upwiz-button-next' ) |
722 | 722 | .click( startDetails ); |
723 | 723 | |
— | — | @@ -724,13 +724,13 @@ |
725 | 725 | .click( function() { |
726 | 726 | _this.removeErrorUploads( finalizeDetails ); |
727 | 727 | } ); |
728 | | - |
| 728 | + |
729 | 729 | $j ( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-button-retry' ) |
730 | 730 | .click( startDetails ); |
731 | 731 | |
732 | 732 | |
733 | | - // WIZARD |
734 | | - |
| 733 | + // WIZARD |
| 734 | + |
735 | 735 | // check to see if the the skip tutorial cookie is set |
736 | 736 | if ( document.cookie.indexOf('skiptutorial=1') != -1 || UploadWizardConfig['skipTutorial'] ) { |
737 | 737 | // "select" the second step - highlight, make it visible, hide all others |
— | — | @@ -739,7 +739,7 @@ |
740 | 740 | // "select" the first step - highlight, make it visible, hide all others |
741 | 741 | _this.moveToStep( 'tutorial' ); |
742 | 742 | } |
743 | | - |
| 743 | + |
744 | 744 | }, |
745 | 745 | |
746 | 746 | |
— | — | @@ -752,7 +752,7 @@ |
753 | 753 | new mw.UploadWizardDeedOwnWork( _this.uploads.length ), |
754 | 754 | new mw.UploadWizardDeedThirdParty( _this.uploads.length ) |
755 | 755 | ]; |
756 | | - |
| 756 | + |
757 | 757 | // if we have multiple uploads, also give them the option to set |
758 | 758 | // licenses individually |
759 | 759 | if ( _this.uploads.length > 1 ) { |
— | — | @@ -764,13 +764,13 @@ |
765 | 765 | } |
766 | 766 | |
767 | 767 | 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', |
770 | 770 | deeds, |
771 | 771 | uploadsClone |
772 | 772 | ); |
773 | 773 | |
774 | | - |
| 774 | + |
775 | 775 | $j( '<div></div>' ) |
776 | 776 | .insertBefore( _this.deedChooser.$selector.find( '.mwe-upwiz-deed-ownwork' ) ) |
777 | 777 | .msg( 'mwe-upwiz-deeds-macro-prompt', _this.uploads.length ); |
— | — | @@ -781,14 +781,14 @@ |
782 | 782 | .msg( 'mwe-upwiz-deeds-custom-prompt' ); |
783 | 783 | } |
784 | 784 | |
785 | | - _this.moveToStep( 'deeds' ); |
| 785 | + _this.moveToStep( 'deeds' ); |
786 | 786 | |
787 | | - }, |
| 787 | + }, |
788 | 788 | |
789 | 789 | /** |
790 | 790 | * Advance one "step" in the wizard interface. |
791 | 791 | * 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 |
793 | 793 | * on screen. So instead we make the tabs zero height and, in CSS, they are already overflow hidden |
794 | 794 | * @param selectedStepName |
795 | 795 | * @param callback to do after layout is ready? |
— | — | @@ -800,10 +800,10 @@ |
801 | 801 | $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' ); |
802 | 802 | |
803 | 803 | $j.each( _this.stepNames, function(i, stepName) { |
804 | | - |
805 | | - // the step indicator |
| 804 | + |
| 805 | + // the step indicator |
806 | 806 | var step = $j( '#mwe-upwiz-step-' + stepName ); |
807 | | - |
| 807 | + |
808 | 808 | // the step's contents |
809 | 809 | var stepDiv = $j( '#mwe-upwiz-stepdiv-' + stepName ); |
810 | 810 | |
— | — | @@ -812,18 +812,18 @@ |
813 | 813 | } else { |
814 | 814 | stepDiv.hide(); |
815 | 815 | } |
816 | | - |
| 816 | + |
817 | 817 | } ); |
818 | | - |
| 818 | + |
819 | 819 | $j( '#mwe-upwiz-steps' ).arrowStepsHighlight( '#mwe-upwiz-step-' + selectedStepName ); |
820 | 820 | |
821 | 821 | _this.currentStepName = selectedStepName; |
822 | | - |
| 822 | + |
823 | 823 | 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) |
825 | 825 | var upload = _this.newUpload(); |
826 | 826 | } |
827 | | - |
| 827 | + |
828 | 828 | $j.each( _this.uploads, function(i, upload) { |
829 | 829 | upload.state = selectedStepName; |
830 | 830 | } ); |
— | — | @@ -838,7 +838,7 @@ |
839 | 839 | * we create the upload interface, a handler to transport it to the server, |
840 | 840 | * and UI for the upload itself and the "details" at the second step of the wizard. |
841 | 841 | * 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 |
843 | 843 | */ |
844 | 844 | newUpload: function() { |
845 | 845 | var _this = this; |
— | — | @@ -851,19 +851,19 @@ |
852 | 852 | |
853 | 853 | // we explicitly move the file input to cover the upload button |
854 | 854 | upload.ui.moveFileInputToCover( '#mwe-upwiz-add-file' ); |
855 | | - |
| 855 | + |
856 | 856 | // we bind to the ui div since unbind doesn't work for non-DOM objects |
857 | 857 | |
858 | 858 | $j( upload.ui.div ).bind( 'filenameAccepted', function(e) { _this.updateFileCounts(); e.stopPropagation(); } ); |
859 | 859 | $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(); |
862 | 862 | _this.setUploadFilled(upload); |
863 | | - e.stopPropagation(); |
| 863 | + e.stopPropagation(); |
864 | 864 | } ); |
865 | 865 | // XXX bind to some error state |
866 | 866 | |
867 | | - |
| 867 | + |
868 | 868 | return upload; |
869 | 869 | }, |
870 | 870 | |
— | — | @@ -874,17 +874,17 @@ |
875 | 875 | */ |
876 | 876 | setUploadFilled: function( upload ) { |
877 | 877 | var _this = this; |
878 | | - |
| 878 | + |
879 | 879 | _this.uploads.push( upload ); |
880 | | - |
| 880 | + |
881 | 881 | /* useful for making ids unique and so on */ |
882 | 882 | _this.uploadsSeen++; |
883 | 883 | upload.index = _this.uploadsSeen; |
884 | 884 | |
885 | 885 | _this.updateFileCounts(); |
886 | | - |
887 | | - upload.deedPreview = new mw.UploadWizardDeedPreview( upload ); |
888 | 886 | |
| 887 | + upload.deedPreview = new mw.UploadWizardDeedPreview( upload ); |
| 888 | + |
889 | 889 | // TODO v1.1 consider if we really have to set up details now |
890 | 890 | upload.details = new mw.UploadWizardDetails( upload, $j( '#mwe-upwiz-macro-files' ) ); |
891 | 891 | }, |
— | — | @@ -893,9 +893,9 @@ |
894 | 894 | uploadsSeen: 0, |
895 | 895 | |
896 | 896 | /** |
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 |
898 | 898 | * 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. |
900 | 900 | * We need to update file counts for obvious reasons. |
901 | 901 | * |
902 | 902 | * @param upload |
— | — | @@ -906,8 +906,8 @@ |
907 | 907 | var $div = $j( upload.ui.div ); |
908 | 908 | $div.unbind(); // everything |
909 | 909 | // 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(); |
912 | 912 | // and do what we in the wizard need to do after an upload is removed |
913 | 913 | mw.UploadWizardUtil.removeItem( _this.uploads, upload ); |
914 | 914 | _this.updateFileCounts(); |
— | — | @@ -915,14 +915,14 @@ |
916 | 916 | }, |
917 | 917 | |
918 | 918 | |
919 | | - /** |
| 919 | + /** |
920 | 920 | * Hide the button choices at the end of the file step. |
921 | 921 | */ |
922 | 922 | hideFileEndButtons: function() { |
923 | 923 | $j( '#mwe-upwiz-stepdiv-file .mwe-upwiz-buttons .mwe-upwiz-file-endchoice' ).hide(); |
924 | 924 | }, |
925 | 925 | |
926 | | - hideDetailsEndButtons: function() { |
| 926 | + hideDetailsEndButtons: function() { |
927 | 927 | $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-buttons .mwe-upwiz-file-endchoice' ).hide(); |
928 | 928 | }, |
929 | 929 | |
— | — | @@ -944,7 +944,7 @@ |
945 | 945 | this.removeMatchingUploads( function( upload ) { |
946 | 946 | return upload.state === 'error'; |
947 | 947 | } ); |
948 | | - endCallback(); |
| 948 | + endCallback(); |
949 | 949 | }, |
950 | 950 | |
951 | 951 | |
— | — | @@ -956,7 +956,7 @@ |
957 | 957 | removeMatchingUploads: function( criterion ) { |
958 | 958 | var toRemove = []; |
959 | 959 | |
960 | | - $j.each( this.uploads, function( i, upload ) { |
| 960 | + $j.each( this.uploads, function( i, upload ) { |
961 | 961 | if ( criterion( upload ) ) { |
962 | 962 | toRemove.push( upload ); |
963 | 963 | } |
— | — | @@ -973,13 +973,13 @@ |
974 | 974 | * Manage transitioning all of our uploads from one state to another -- like from "new" to "uploaded". |
975 | 975 | * |
976 | 976 | * @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 |
978 | 978 | * @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 |
980 | 980 | * @param endCallback function to call when all uploads are in the end state. |
981 | 981 | */ |
982 | 982 | makeTransitioner: function( beginState, progressStates, endStates, starter, endCallback ) { |
983 | | - |
| 983 | + |
984 | 984 | var _this = this; |
985 | 985 | |
986 | 986 | var transitioner = function() { |
— | — | @@ -993,12 +993,12 @@ |
994 | 994 | } else if ( ( upload.state == beginState ) && ( uploadsToStart > 0 ) ) { |
995 | 995 | starter( upload ); |
996 | 996 | uploadsToStart--; |
997 | | - } |
| 997 | + } |
998 | 998 | } ); |
999 | 999 | |
1000 | 1000 | // build in a little delay even for the end state, so user can see progress bar in a complete state. |
1001 | 1001 | var nextAction = ( endStateCount == _this.uploads.length ) ? endCallback : transitioner; |
1002 | | - |
| 1002 | + |
1003 | 1003 | setTimeout( nextAction, _this.transitionerDelay ); |
1004 | 1004 | }; |
1005 | 1005 | |
— | — | @@ -1010,7 +1010,7 @@ |
1011 | 1011 | |
1012 | 1012 | /** |
1013 | 1013 | * 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, |
1015 | 1015 | * and kicks off a thread which will take from the queue. |
1016 | 1016 | * @param endCallback - to execute when uploads are completed |
1017 | 1017 | */ |
— | — | @@ -1023,7 +1023,7 @@ |
1024 | 1024 | $j( '#mwe-upwiz-add-file' ).hide(); |
1025 | 1025 | |
1026 | 1026 | // 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 ) { |
1028 | 1028 | if ( upload.state === 'error' ) { |
1029 | 1029 | upload.state = 'new'; |
1030 | 1030 | upload.ui.clearIndicator(); |
— | — | @@ -1031,50 +1031,50 @@ |
1032 | 1032 | } |
1033 | 1033 | } ); |
1034 | 1034 | |
1035 | | - this.allowCloseWindow = mw.confirmCloseWindow( { |
| 1035 | + this.allowCloseWindow = mw.confirmCloseWindow( { |
1036 | 1036 | message: function() { return gM( 'mwe-upwiz-prevent-close', _this.uploads.length ); }, |
1037 | 1037 | test: function() { return _this.uploads.length > 0; } |
1038 | 1038 | } ); |
1039 | 1039 | |
1040 | 1040 | $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' ), |
1043 | 1043 | _this.uploads, |
1044 | 1044 | [ 'stashed' ], |
1045 | 1045 | [ 'error' ], |
1046 | | - 'transportProgress', |
| 1046 | + 'transportProgress', |
1047 | 1047 | 'transportWeight' ); |
1048 | 1048 | progressBar.start(); |
1049 | | - |
| 1049 | + |
1050 | 1050 | // remove ability to change files |
1051 | 1051 | // ideally also hide the "button"... but then we require styleable file input CSS trickery |
1052 | 1052 | // although, we COULD do this just for files already in progress... |
1053 | 1053 | |
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 |
1056 | 1056 | |
1057 | | - _this.makeTransitioner( |
1058 | | - 'new', |
| 1057 | + _this.makeTransitioner( |
| 1058 | + 'new', |
1059 | 1059 | [ 'transporting', 'transported', 'metadata' ], |
1060 | | - [ 'error', 'stashed' ], |
| 1060 | + [ 'error', 'stashed' ], |
1061 | 1061 | function( upload ) { |
1062 | 1062 | upload.start(); |
1063 | 1063 | }, |
1064 | 1064 | function() { |
1065 | 1065 | $j().notify( gM( 'mwe-upwiz-files-complete' ) ); |
1066 | 1066 | _this.showNext( 'file', 'stashed' ); |
1067 | | - } |
| 1067 | + } |
1068 | 1068 | ); |
1069 | 1069 | }, |
1070 | 1070 | |
1071 | | - /** |
| 1071 | + /** |
1072 | 1072 | * Figure out what to do and what options to show after the uploads have stopped. |
1073 | 1073 | * Uploading has stopped for one of the following reasons: |
1074 | 1074 | * 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 |
1075 | 1075 | * 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 |
1077 | 1077 | * 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 |
1079 | 1079 | * we trust that this hasn't happened. |
1080 | 1080 | * |
1081 | 1081 | * @param {String} step that we are on |
— | — | @@ -1087,7 +1087,7 @@ |
1088 | 1088 | if ( upload.state === 'error' ) { |
1089 | 1089 | errorCount++; |
1090 | 1090 | } else if ( upload.state === desiredState ) { |
1091 | | - okCount++; |
| 1091 | + okCount++; |
1092 | 1092 | } else { |
1093 | 1093 | mw.log( "mw.UploadWizardUpload::showFileNext> upload " + i + " not in appropriate state for filenext: " + upload.state ); |
1094 | 1094 | } |
— | — | @@ -1108,10 +1108,10 @@ |
1109 | 1109 | } else { |
1110 | 1110 | $j( '#mwe-upwiz-stepdiv-' + step + ' .mwe-upwiz-buttons' ).show().find( selector ).show(); |
1111 | 1111 | } |
1112 | | - }, |
1113 | | - |
| 1112 | + }, |
| 1113 | + |
1114 | 1114 | /** |
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 |
1116 | 1116 | * Thhere is an uncounted upload, waiting to be used, which has a fileInput which covers the |
1117 | 1117 | * "add an upload" button. This is absolutely positioned, so it needs to be moved if another upload was removed. |
1118 | 1118 | * The uncounted upload is also styled differently between the zero and n files cases |
— | — | @@ -1143,7 +1143,7 @@ |
1144 | 1144 | $j( '#mwe-upwiz-filelist .filled:even' ).removeClass( 'odd' ); |
1145 | 1145 | } else { |
1146 | 1146 | // 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' ); |
1148 | 1148 | $j( '#mwe-upwiz-upload-ctrl-container' ).hide(); |
1149 | 1149 | |
1150 | 1150 | |
— | — | @@ -1168,11 +1168,11 @@ |
1169 | 1169 | $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-some-failed' ).hide(); |
1170 | 1170 | $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-file-next-all-failed' ).hide(); |
1171 | 1171 | $j( '#mwe-upwiz-stepdiv-details .mwe-upwiz-start-next' ).show(); |
1172 | | - |
| 1172 | + |
1173 | 1173 | // fix various other pages that may have state |
1174 | 1174 | $j( '#mwe-upwiz-thanks' ).html( '' ); |
1175 | 1175 | |
1176 | | - if ( mw.isDefined( _this.deedChooser ) ) { |
| 1176 | + if ( mw.isDefined( _this.deedChooser ) ) { |
1177 | 1177 | _this.deedChooser.remove(); |
1178 | 1178 | } |
1179 | 1179 | |
— | — | @@ -1202,11 +1202,11 @@ |
1203 | 1203 | /** |
1204 | 1204 | * are all the details valid? |
1205 | 1205 | * @return boolean |
1206 | | - */ |
| 1206 | + */ |
1207 | 1207 | detailsValid: function() { |
1208 | 1208 | var _this = this; |
1209 | 1209 | var valid = true; |
1210 | | - $j.each( _this.uploads, function(i, upload) { |
| 1210 | + $j.each( _this.uploads, function(i, upload) { |
1211 | 1211 | valid &= upload.details.valid(); |
1212 | 1212 | } ); |
1213 | 1213 | return valid; |
— | — | @@ -1220,7 +1220,7 @@ |
1221 | 1221 | detailsSubmit: function( endCallback ) { |
1222 | 1222 | var _this = this; |
1223 | 1223 | |
1224 | | - $j.each( _this.uploads, function( i, upload ) { |
| 1224 | + $j.each( _this.uploads, function( i, upload ) { |
1225 | 1225 | $j( upload.details.submittingDiv ) |
1226 | 1226 | .find( '.mwe-upwiz-visible-file-filename-text' ) |
1227 | 1227 | .html( upload.title.getMain() ); |
— | — | @@ -1232,11 +1232,11 @@ |
1233 | 1233 | .morphCrossfade( '.mwe-upwiz-submitting' ); |
1234 | 1234 | |
1235 | 1235 | // add the upload progress bar, with ETA |
1236 | | - // add in the upload count |
| 1236 | + // add in the upload count |
1237 | 1237 | _this.makeTransitioner( |
1238 | | - 'details', |
1239 | | - [ 'submitting-details' ], |
1240 | | - [ 'error', 'complete' ], |
| 1238 | + 'details', |
| 1239 | + [ 'submitting-details' ], |
| 1240 | + [ 'error', 'complete' ], |
1241 | 1241 | function( upload ) { |
1242 | 1242 | upload.details.submit(); |
1243 | 1243 | }, |
— | — | @@ -1246,18 +1246,18 @@ |
1247 | 1247 | |
1248 | 1248 | prefillThanksPage: function() { |
1249 | 1249 | var _this = this; |
1250 | | - |
| 1250 | + |
1251 | 1251 | $j( '#mwe-upwiz-thanks' ) |
1252 | 1252 | .append( $j( '<h3 style="text-align: center;"></h3>' ).msg( 'mwe-upwiz-thanks-intro' ), |
1253 | 1253 | $j( '<p style="margin-bottom: 2em; text-align: center;">' ) |
1254 | 1254 | .msg( 'mwe-upwiz-thanks-explain', _this.uploads.length ) ); |
1255 | | - |
| 1255 | + |
1256 | 1256 | $j.each( _this.uploads, function(i, upload) { |
1257 | 1257 | var id = 'thanksDiv' + i; |
1258 | 1258 | var $thanksDiv = $j( '<div></div>' ).attr( 'id', id ).addClass( "mwe-upwiz-thanks ui-helper-clearfix" ); |
1259 | 1259 | _this.thanksDiv = $thanksDiv; |
1260 | | - |
1261 | 1260 | |
| 1261 | + |
1262 | 1262 | var $thumbnailDiv = $j( '<div></div>' ).addClass( 'mwe-upwiz-thumbnail' ); |
1263 | 1263 | var $thumbnailCaption = $j( '<div></div>' ) |
1264 | 1264 | .css( { 'text-align': 'center', 'font-size': 'small' } ) |
— | — | @@ -1275,16 +1275,16 @@ |
1276 | 1276 | |
1277 | 1277 | var thumbTitle = String(upload.title); |
1278 | 1278 | var thumbWikiText = "[[" + thumbTitle.replace(/_/g, ' ') + "|thumb|" + gM( 'mwe-upwiz-thanks-caption' ) + "]]"; |
1279 | | - |
| 1279 | + |
1280 | 1280 | $thanksDiv.append( |
1281 | 1281 | $j( '<div class="mwe-upwiz-data"></div>' ) |
1282 | | - .append( |
1283 | | - $j('<p/>').append( |
| 1282 | + .append( |
| 1283 | + $j('<p/>').append( |
1284 | 1284 | gM( 'mwe-upwiz-thanks-wikitext' ), |
1285 | 1285 | $j( '<br />' ), |
1286 | 1286 | _this.makeReadOnlyInput( thumbWikiText ) |
1287 | 1287 | ), |
1288 | | - $j('<p/>').append( |
| 1288 | + $j('<p/>').append( |
1289 | 1289 | gM( 'mwe-upwiz-thanks-url' ), |
1290 | 1290 | $j( '<br />' ), |
1291 | 1291 | _this.makeReadOnlyInput( upload.imageinfo.descriptionurl ) |
— | — | @@ -1293,9 +1293,9 @@ |
1294 | 1294 | ); |
1295 | 1295 | |
1296 | 1296 | $j( '#mwe-upwiz-thanks' ).append( $thanksDiv ); |
1297 | | - } ); |
| 1297 | + } ); |
1298 | 1298 | }, |
1299 | | - |
| 1299 | + |
1300 | 1300 | /** |
1301 | 1301 | * make a read only text input, which self-selects on gaining focus |
1302 | 1302 | * @param {String} text it will contain |
— | — | @@ -1333,7 +1333,7 @@ |
1334 | 1334 | |
1335 | 1335 | }; |
1336 | 1336 | |
1337 | | -/** |
| 1337 | +/** |
1338 | 1338 | * Makes a modal dialog to confirm deletion of one or more uploads. Will have "Remove" and "Cancel" buttons |
1339 | 1339 | * @param {Array} array of UploadWizardUpload objects |
1340 | 1340 | * @param {String} message for dialog title |
— | — | @@ -1341,12 +1341,12 @@ |
1342 | 1342 | */ |
1343 | 1343 | mw.UploadWizardDeleteDialog = function( uploads, dialogTitle, dialogText ) { |
1344 | 1344 | var $filenameList = $j( '<ul></ul>' ); |
1345 | | - $j.each( uploads, function( i, upload ) { |
| 1345 | + $j.each( uploads, function( i, upload ) { |
1346 | 1346 | $filenameList.append( $j( '<li></li>' ).append( upload.title.getMain() ) ); |
1347 | 1347 | } ); |
1348 | 1348 | 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 ) { |
1351 | 1351 | upload.remove(); |
1352 | 1352 | } ); |
1353 | 1353 | $j( this ).dialog( 'close' ); |
— | — | @@ -1357,7 +1357,7 @@ |
1358 | 1358 | |
1359 | 1359 | return $j( '<div></div>' ) |
1360 | 1360 | .append( $j( '<p></p>' ).append( dialogText ), $filenameList ) |
1361 | | - .dialog( { |
| 1361 | + .dialog( { |
1362 | 1362 | width: 500, |
1363 | 1363 | zIndex: 200000, |
1364 | 1364 | autoOpen: false, |
— | — | @@ -1414,7 +1414,7 @@ |
1415 | 1415 | this.addClass( 'mwe-upwiz-required-field' ); |
1416 | 1416 | return this.prepend( $j( '<span/>' ).append( '*' ).addClass( 'mwe-upwiz-required-marker' ) ); |
1417 | 1417 | }; |
1418 | | - |
| 1418 | + |
1419 | 1419 | /** |
1420 | 1420 | * Adds a tipsy pop-up help button to the field. Can be called in two ways -- with simple string id, which identifies |
1421 | 1421 | * the string as 'mwe-upwiz-tooltip-' plus that id, and creates the hint with a similar id |
— | — | @@ -1429,16 +1429,16 @@ |
1430 | 1430 | attrs = { id: key }; |
1431 | 1431 | contentSource = fn; |
1432 | 1432 | html = true; |
1433 | | - } else { |
| 1433 | + } else { |
1434 | 1434 | attrs = { 'title': gM( 'mwe-upwiz-tooltip-' + key ) }; |
1435 | 1435 | contentSource = 'title'; |
1436 | | - } |
1437 | | - return this.append( |
| 1436 | + } |
| 1437 | + return this.append( |
1438 | 1438 | $j( '<span/>' ) |
1439 | 1439 | .addClass( 'mwe-upwiz-hint' ) |
1440 | 1440 | .attr( attrs ) |
1441 | 1441 | .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'} ) |
1443 | 1443 | ); |
1444 | 1444 | }; |
1445 | 1445 | |
— | — | @@ -1450,8 +1450,8 @@ |
1451 | 1451 | |
1452 | 1452 | // this is a jquery-style object |
1453 | 1453 | |
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, |
1456 | 1456 | // but it shouldn't because it will always grow to accomodate very quickly. |
1457 | 1457 | |
1458 | 1458 | if ($j.msie) { |
— | — | @@ -1466,7 +1466,7 @@ |
1467 | 1467 | if (this.scrollHeight >= this.offsetHeight) { |
1468 | 1468 | this.rows++; |
1469 | 1469 | while (this.scrollHeight > this.offsetHeight) { |
1470 | | - this.rows++; |
| 1470 | + this.rows++; |
1471 | 1471 | } |
1472 | 1472 | } |
1473 | 1473 | return this; |
— | — | @@ -1475,7 +1475,7 @@ |
1476 | 1476 | this.addClass( 'mwe-grow-textarea' ); |
1477 | 1477 | |
1478 | 1478 | this.bind( 'resizeEvent', resizeIfNeeded ); |
1479 | | - |
| 1479 | + |
1480 | 1480 | this.keyup( resizeIfNeeded ); |
1481 | 1481 | this.change( resizeIfNeeded ); |
1482 | 1482 | |
— | — | @@ -1486,14 +1486,14 @@ |
1487 | 1487 | // XXX this is highly specific to the "details" page now, not really jQuery function |
1488 | 1488 | jQuery.fn.mask = function( options ) { |
1489 | 1489 | |
1490 | | - // intercept clicks... |
| 1490 | + // intercept clicks... |
1491 | 1491 | // Note: the size of the div must be obtainable. Hence, this cannot be a div without layout (e.g. display:none). |
1492 | 1492 | // some of this is borrowed from http://code.google.com/p/jquery-loadmask/ , but simplified |
1493 | 1493 | $j.each( this, function( i, el ) { |
1494 | | - |
| 1494 | + |
1495 | 1495 | if ( ! $j( el ).data( 'mask' ) ) { |
1496 | | - |
1497 | 1496 | |
| 1497 | + |
1498 | 1498 | //fix for z-index bug with selects in IE6 |
1499 | 1499 | if ( $j.browser.msie && $j.browser.version.substring(0,1) === '6' ){ |
1500 | 1500 | $j( el ).find( "select" ).addClass( "masked-hidden" ); |
— | — | @@ -1506,7 +1506,7 @@ |
1507 | 1507 | 'height' : el.offsetHeight + 'px', |
1508 | 1508 | 'z-index' : 90 |
1509 | 1509 | } ); |
1510 | | - |
| 1510 | + |
1511 | 1511 | var $statusDiv = $j( '<div></div>' ).css( { |
1512 | 1512 | 'width' : el.offsetWidth + 'px', |
1513 | 1513 | 'height' : el.offsetHeight + 'px', |
— | — | @@ -1518,14 +1518,14 @@ |
1519 | 1519 | } ); |
1520 | 1520 | |
1521 | 1521 | var $indicatorDiv = $j( '<div class="mwe-upwiz-status"></div>' ) |
1522 | | - .css( { |
| 1522 | + .css( { |
1523 | 1523 | 'width' : 32, |
1524 | | - 'height' : 32, |
| 1524 | + 'height' : 32, |
1525 | 1525 | 'z-index' : 91, |
1526 | 1526 | 'margin' : '0 auto 0 auto' |
1527 | 1527 | } ); |
1528 | 1528 | var $statusLineDiv = $j( '<div></div>' ) |
1529 | | - .css( { |
| 1529 | + .css( { |
1530 | 1530 | 'z-index' : 91 |
1531 | 1531 | } ); |
1532 | 1532 | var $statusIndicatorLineDiv = $j( '<div></div>' ) |
— | — | @@ -1533,13 +1533,13 @@ |
1534 | 1534 | .append( $indicatorDiv, $statusLineDiv ); |
1535 | 1535 | $statusDiv.append( $statusIndicatorLineDiv ); |
1536 | 1536 | |
1537 | | - $j( el ).css( { 'position' : 'relative' } ) |
| 1537 | + $j( el ).css( { 'position' : 'relative' } ) |
1538 | 1538 | .append( mask.fadeTo( 'fast', 0.6 ) ) |
1539 | 1539 | .append( $statusDiv ) |
1540 | 1540 | .data( 'indicator', $indicatorDiv ) |
1541 | 1541 | .data( 'statusLine', $statusLineDiv ); |
1542 | | - |
1543 | | - } |
| 1542 | + |
| 1543 | + } |
1544 | 1544 | } ); |
1545 | 1545 | |
1546 | 1546 | return this; |
— | — | @@ -1558,7 +1558,7 @@ |
1559 | 1559 | } |
1560 | 1560 | } ); |
1561 | 1561 | |
1562 | | - |
| 1562 | + |
1563 | 1563 | return this; |
1564 | 1564 | }; |
1565 | 1565 | |
— | — | @@ -1566,7 +1566,7 @@ |
1567 | 1567 | * jQuery plugin - collapse toggle |
1568 | 1568 | * Given an element, makes contained elements of class mw-collapsible-toggle clickable to show/reveal |
1569 | 1569 | * contained element(s) of class mw-collapsible-content. |
1570 | | - * |
| 1570 | + * |
1571 | 1571 | * Somewhat recapitulates mw.UploadWizardUtil.makeToggler, |
1572 | 1572 | * toggle() in vector.collapsibleNav.js, not to mention jquery.collapsible |
1573 | 1573 | * but none of those do what we want, or are inaccessible to us |
— | — | @@ -1581,7 +1581,7 @@ |
1582 | 1582 | e.stopPropagation(); |
1583 | 1583 | if ( $toggle.hasClass( 'mwe-upwiz-toggler-open' ) ) { |
1584 | 1584 | $contents.slideUp( 250 ); |
1585 | | - $toggle.removeClass( 'mwe-upwiz-toggler-open' ); |
| 1585 | + $toggle.removeClass( 'mwe-upwiz-toggler-open' ); |
1586 | 1586 | } else { |
1587 | 1587 | $contents.slideDown( 250 ); |
1588 | 1588 | $toggle.addClass( 'mwe-upwiz-toggler-open' ); |