http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100177

Revision: 100177
Author:   neilk
Date:     2011-10-18 22:29:02 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
more correct fix for the multi-file scrolling -- the problem was that it called 
the moveToStep function just for a side effect, now captured in 
resetFileStepUploads. Followup r100155

Modified Paths:
--------------
    trunk/extensions/UploadWizard/resources/mw.UploadWizard.js

Modified: trunk/extensions/UploadWizard/resources/mw.UploadWizard.js
===================================================================
--- trunk/extensions/UploadWizard/resources/mw.UploadWizard.js  2011-10-18 
22:28:10 UTC (rev 100176)
+++ trunk/extensions/UploadWizard/resources/mw.UploadWizard.js  2011-10-18 
22:29:02 UTC (rev 100177)
@@ -354,11 +354,7 @@
                var _this = this;
 
                // scroll to the top of the page (the current step might have 
been very long, vertically)
-               if ( selectedStepName !== 'file' ) {
-                       // this is the wrong behavior when selecting files 
(hides interface), so skip it.
-                       // also, it breaks scrolling when selecting multiple 
files at once.
-                       $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
-               }
+               $j( 'html, body' ).animate( { scrollTop: 0 }, 'slow' );
 
                $j.each( _this.stepNames, function(i, stepName) {
 
@@ -380,9 +376,8 @@
 
                _this.currentStepName = selectedStepName;
 
-               if ( selectedStepName == 'file' && _this.uploads.length === 0 ) 
{
-                       // add one upload field to start (this is the big one 
that asks you to upload something)
-                       var upload = _this.newUpload();
+               if ( selectedStepName === 'file' ) {
+                       _this.resetFileStepUploads();
                }
 
                $j.each( _this.uploads, function(i, upload) {
@@ -395,6 +390,16 @@
        },
 
        /**
+        * If there are no uploads, make a new one
+        */
+       resetFileStepUploads: function() {      
+               if ( this.uploads.length === 0 ) {
+                       // add one upload field to start (this is the big one 
that asks you to upload something)
+                       var upload = this.newUpload();
+               }
+       },
+
+       /**
         * add an Upload
         *   we create the upload interface, a handler to transport it to the 
server,
         *   and UI for the upload itself and the "details" at the second step 
of the wizard.
@@ -732,8 +737,7 @@
                                _this.allowCloseWindow();
                        }
 
-                       // and move back to the file step
-                       _this.moveToStep( 'file' );
+                       _this.resetFileStepUploads();
                }
 
                // allow an "add another upload" button only if we aren't at max


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to