Index: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js |
— | — | @@ -354,11 +354,7 @@ |
355 | 355 | var _this = this; |
356 | 356 | |
357 | 357 | // scroll to the top of the page (the current step might have been very long, vertically) |
358 | | - if ( selectedStepName !== 'file' ) { |
359 | | - // this is the wrong behavior when selecting files (hides interface), so skip it. |
360 | | - // also, it breaks scrolling when selecting multiple files at once. |
361 | | - $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' ); |
362 | | - } |
| 358 | + $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' ); |
363 | 359 | |
364 | 360 | $j.each( _this.stepNames, function(i, stepName) { |
365 | 361 | |
— | — | @@ -380,9 +376,8 @@ |
381 | 377 | |
382 | 378 | _this.currentStepName = selectedStepName; |
383 | 379 | |
384 | | - if ( selectedStepName == 'file' && _this.uploads.length === 0 ) { |
385 | | - // add one upload field to start (this is the big one that asks you to upload something) |
386 | | - var upload = _this.newUpload(); |
| 380 | + if ( selectedStepName === 'file' ) { |
| 381 | + _this.resetFileStepUploads(); |
387 | 382 | } |
388 | 383 | |
389 | 384 | $j.each( _this.uploads, function(i, upload) { |
— | — | @@ -395,6 +390,16 @@ |
396 | 391 | }, |
397 | 392 | |
398 | 393 | /** |
| 394 | + * If there are no uploads, make a new one |
| 395 | + */ |
| 396 | + resetFileStepUploads: function() { |
| 397 | + if ( this.uploads.length === 0 ) { |
| 398 | + // add one upload field to start (this is the big one that asks you to upload something) |
| 399 | + var upload = this.newUpload(); |
| 400 | + } |
| 401 | + }, |
| 402 | + |
| 403 | + /** |
399 | 404 | * add an Upload |
400 | 405 | * we create the upload interface, a handler to transport it to the server, |
401 | 406 | * and UI for the upload itself and the "details" at the second step of the wizard. |
— | — | @@ -732,8 +737,7 @@ |
733 | 738 | _this.allowCloseWindow(); |
734 | 739 | } |
735 | 740 | |
736 | | - // and move back to the file step |
737 | | - _this.moveToStep( 'file' ); |
| 741 | + _this.resetFileStepUploads(); |
738 | 742 | } |
739 | 743 | |
740 | 744 | // allow an "add another upload" button only if we aren't at max |