MarkTraceur has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/80954


Change subject: Last few files in resources/ jshint fixes
......................................................................

Last few files in resources/ jshint fixes

Change-Id: I0710fd5fb9ce8ad21b7d3a45834fa8955944e433
---
M resources/mw.UploadWizardUploadInterface.js
M resources/mw.UploadWizardUtil.js
M resources/mw.UtilitiesTime.js
M resources/mw.fileApi.js
4 files changed, 155 insertions(+), 149 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard 
refs/changes/54/80954/1

diff --git a/resources/mw.UploadWizardUploadInterface.js 
b/resources/mw.UploadWizardUploadInterface.js
index f494098..58bb1f2 100644
--- a/resources/mw.UploadWizardUploadInterface.js
+++ b/resources/mw.UploadWizardUploadInterface.js
@@ -7,32 +7,33 @@
 ( function( mw, $ ) {
 
 mw.UploadWizardUploadInterface = function( upload, filesDiv, providedFile ) {
-       var _this = this;
+       var $preview,
+               ui = this;
 
-       _this.upload = upload;
+       this.upload = upload;
 
-       _this.providedFile = providedFile;
+       this.providedFile = providedFile;
 
        // may need to collaborate with the particular upload type sometimes
        // for the interface, as well as the uploadwizard. OY.
-       _this.div = $('<div class="mwe-upwiz-file"></div>').get(0);
-       _this.isFilled = false;
+       this.div = $('<div class="mwe-upwiz-file"></div>').get(0);
+       this.isFilled = false;
 
-       _this.previewLoaded = false;
+       this.previewLoaded = false;
 
-       _this.$fileInputCtrl = $( '<input size="1" class="mwe-upwiz-file-input" 
name="file" type="file"/>' );
+       this.$fileInputCtrl = $( '<input size="1" class="mwe-upwiz-file-input" 
name="file" type="file"/>' );
        if (mw.UploadWizard.config.enableFormData && 
mw.fileApi.isFormDataAvailable() &&
                mw.UploadWizard.config.enableMultiFileSelect && 
mw.UploadWizard.config.enableMultipleFiles ) {
                // Multiple uploads requires the FormData transport
-               _this.$fileInputCtrl.attr( 'multiple', '1' );
+               this.$fileInputCtrl.attr( 'multiple', '1' );
        }
 
-       _this.initFileInputCtrl();
+       this.initFileInputCtrl();
 
-       _this.$indicator = $( '<div class="mwe-upwiz-file-indicator"></div>' );
+       this.$indicator = $( '<div class="mwe-upwiz-file-indicator"></div>' );
 
-       _this.visibleFilenameDiv = $('<div 
class="mwe-upwiz-visible-file"></div>')
-               .append( _this.$indicator )
+       this.visibleFilenameDiv = $('<div 
class="mwe-upwiz-visible-file"></div>')
+               .append( this.$indicator )
                .append(
                        '<div class="mwe-upwiz-visible-file-filename">' +
                                '<div class="mwe-upwiz-file-preview"/>' +
@@ -45,31 +46,31 @@
                                '</div>'
                );
 
-       _this.$removeCtrl = $.fn.removeCtrl(
+       this.$removeCtrl = $.fn.removeCtrl(
                'mwe-upwiz-remove',
                'mwe-upwiz-remove-upload',
                function() {
-                       _this.upload.remove();
-                       _this.cancelPositionTracking();
+                       ui.upload.remove();
+                       ui.cancelPositionTracking();
                }
-       ).addClass( "mwe-upwiz-file-status-line-item" );
+       ).addClass( 'mwe-upwiz-file-status-line-item' );
 
-       _this.visibleFilenameDiv.find( '.mwe-upwiz-file-status-line' )
-               .append( _this.$removeCtrl );
+       this.visibleFilenameDiv.find( '.mwe-upwiz-file-status-line' )
+               .append( this.$removeCtrl );
 
        // Add show thumbnail control
 
-       //_this.errorDiv = $('<div class="mwe-upwiz-upload-error 
mwe-upwiz-file-indicator" style="display: none;"></div>').get(0);
+       //this.errorDiv = $('<div class="mwe-upwiz-upload-error 
mwe-upwiz-file-indicator" style="display: none;"></div>').get(0);
 
-       _this.filenameCtrl = $('<input type="hidden" name="filename" 
value=""/>').get(0);
+       this.filenameCtrl = $('<input type="hidden" name="filename" 
value=""/>').get(0);
 
        // this file Ctrl container is placed over other interface elements, 
intercepts clicks and gives them to the file input control.
        // however, we want to pass hover events to interface elements that we 
are over, hence the bindings.
        // n.b. not using toggleClass because it often gets this event wrong -- 
relies on previous state to know what to do
-       _this.fileCtrlContainer = $('<div 
class="mwe-upwiz-file-ctrl-container">');
+       this.fileCtrlContainer = $('<div 
class="mwe-upwiz-file-ctrl-container">');
 /*
-                                       .bind( 'mouseenter', function(e) { 
_this.addFileCtrlHover(e); } )
-                                       .bind( 'mouseleave', function(e) { 
_this.removeFileCtrlHover(e); } );
+                                       .bind( 'mouseenter', function(e) { 
this.addFileCtrlHover(e); } )
+                                       .bind( 'mouseleave', function(e) { 
this.removeFileCtrlHover(e); } );
 */
 
 
@@ -79,11 +80,11 @@
        // which works as a file input. It will be set to opacity:0 and then we 
can do whatever we want with
        // interface "below".
        // XXX caution -- if the add file input changes size we won't match, 
unless we add some sort of event to catch this.
-       _this.form = $( '<form method="POST" encType="multipart/form-data" 
class="mwe-upwiz-form"></form>' )
-                       .attr( { action: _this.upload.api.defaults.url } )
-                       .append( _this.visibleFilenameDiv )
-                       .append( _this.fileCtrlContainer )
-                       .append( _this.filenameCtrl )
+       this.form = $( '<form method="POST" encType="multipart/form-data" 
class="mwe-upwiz-form"></form>' )
+                       .attr( { action: this.upload.api.defaults.url } )
+                       .append( this.visibleFilenameDiv )
+                       .append( this.fileCtrlContainer )
+                       .append( this.filenameCtrl )
                        .get( 0 );
 
        if ( $( '<input type="file">' ).attr( 'disabled' ) ) {
@@ -96,23 +97,23 @@
                return;
        }
 
-       if ( !_this.upload.fromURL ) {
-               $( _this.fileCtrlContainer ).append( _this.$fileInputCtrl );
+       if ( !this.upload.fromURL ) {
+               $( this.fileCtrlContainer ).append( this.$fileInputCtrl );
        }
-       $( _this.div ).append( _this.form );
+       $( this.div ).append( this.form );
 
        // XXX evil hardcoded
        // we don't really need filesdiv if we do it this way?
-       $( filesDiv ).append( _this.div );
+       $( filesDiv ).append( this.div );
 
-       // _this.progressBar = ( no progress bar for individual uploads yet )
+       // this.progressBar = ( no progress bar for individual uploads yet )
        // we bind to the ui div since unbind doesn't work for non-DOM objects
-       $( _this.div ).bind( 'transportProgressEvent', function(e) { 
_this.showTransportProgress(); } );
-       // $( _this.div ).bind( 'transportedEvent', function(e) { 
_this.showStashed(); } );
+       $( this.div ).bind( 'transportProgressEvent', function () { 
ui.showTransportProgress(); } );
+       // $( this.div ).bind( 'transportedEvent', function(e) { 
this.showStashed(); } );
 
        // XXX feature envy
-       var $preview = $( this.div ).find( '.mwe-upwiz-file-preview' );
-       _this.upload.setThumbnail(
+       $preview = $( this.div ).find( '.mwe-upwiz-file-preview' );
+       this.upload.setThumbnail(
                $preview,
                mw.UploadWizard.config.thumbnailWidth,
                mw.UploadWizard.config.thumbnailMaxHeight,
@@ -121,7 +122,7 @@
 
        if( providedFile ) {
                // if a file is already present, trigger the change event 
immediately.
-               _this.$fileInputCtrl.change();
+               this.$fileInputCtrl.change();
        }
 
 };
@@ -132,19 +133,18 @@
         * Things to do to this interface once we start uploading
         */
        start: function() {
-               var _this = this;
                // remove hovering
-               $( _this.div )
+               $( this.div )
                        .unbind( 'mouseenter mouseover mouseleave mouseout' );
 
                // remove delete control
-               $( _this.visibleFilenameDiv )
+               $( this.visibleFilenameDiv )
                        .find( '.mwe-upwiz-remove-ctrl' )
                        .unbind( 'mouseenter mouseover mouseleave mouseout' )
                        .remove();
 
                // remove thumb control
-               $( _this.visibleFilenameDiv )
+               $( this.visibleFilenameDiv )
                        .find( '.mwe-upwiz-show-thumb-ctrl' )
                        .unbind( 'mouseenter mouseover mouseleave mouseout' )
                        .remove();
@@ -164,10 +164,10 @@
         * Reset the graphic indicator
         */
        clearIndicator: function() {
-               var _this = this;
-               $.each( _this.$indicator.attr( 'class' ).split( /\s+/ ), 
function( i, className ) {
+               var ui = this;
+               $.each( this.$indicator.attr( 'class' ).split( /\s+/ ), 
function( i, className ) {
                        if ( className.match( /^mwe-upwiz-status/ ) ) {
-                               _this.$indicator.removeClass( className );
+                               ui.$indicator.removeClass( className );
                        }
                } );
        },
@@ -219,7 +219,7 @@
         * Put the visual state of an individual upload into "progress"
         * @param fraction      The fraction of progress. Float between 0 and 1
         */
-       showTransportProgress: function( fraction ) {
+       showTransportProgress: function () {
                // if fraction available, update individual progress bar / 
estimates, etc.
                this.showIndicator( 'progress' );
                this.setStatus( 'mwe-upwiz-uploading' );
@@ -271,16 +271,16 @@
 
 
        initFileInputCtrl: function() {
-               var _this = this;
-               _this.$fileInputCtrl.change( function() {
-                       _this.clearErrors();
+               var ui = this;
+               this.$fileInputCtrl.change( function() {
+                       ui.clearErrors();
 
-                       _this.upload.checkFile(
-                               _this.getFilename(),
-                               _this.getFiles(),
-                               function() { _this.fileChangedOk(); },
-                               function( code, info ) { 
_this.fileChangedError( code, info ); },
-                               function() { _this.$fileInputCtrl.get(0).value 
= ''; }
+                       ui.upload.checkFile(
+                               ui.getFilename(),
+                               ui.getFiles(),
+                               function() { ui.fileChangedOk(); },
+                               function( code, info ) { ui.fileChangedError( 
code, info ); },
+                               function() { ui.$fileInputCtrl.get(0).value = 
''; }
                        );
                } );
        },
@@ -327,12 +327,12 @@
         * n.b. in older browsers we only will know the filename
         */
        fileChangedOk: function() {
+               var ui = this,
+                       statusItems = [];
 
-               var _this = this;
-               _this.updateFilename();
+               this.updateFilename();
 
                // set the status string - e.g. "256 Kb, 100 x 200"
-               var statusItems = [];
                if ( this.upload.imageinfo && this.upload.imageinfo.width && 
this.upload.imageinfo.height ) {
                        statusItems.push( this.upload.imageinfo.width + 
'\u00d7' + this.upload.imageinfo.height );
                }
@@ -352,11 +352,11 @@
                        this.$showThumbCtrl = $.fn.showThumbCtrl(
                                        'mwe-upwiz-show-thumb',
                                        'mwe-upwiz-show-thumb-tip',
-                                       function() { _this.makePreview(); }
-                               ).addClass( "mwe-upwiz-file-status-line-item" );
+                                       function() { ui.makePreview(); }
+                               ).addClass( 'mwe-upwiz-file-status-line-item' );
 
                        this.visibleFilenameDiv.find( 
'.mwe-upwiz-file-status-line' )
-                               .append( '<br/>' ).append( _this.$showThumbCtrl 
);
+                               .append( '<br/>' ).append( this.$showThumbCtrl 
);
 
                }
        },
@@ -376,29 +376,30 @@
        // called once we have an image url
        loadImage: function( url ) {
                var image = document.createElement( 'img' ),
-                       _this = this;
+                       ui = this;
                image.onload = function () {
-                       $.publishReady( 'thumbnails.' + _this.upload.index, 
image );
-                       _this.previewLoaded = true;
+                       $.publishReady( 'thumbnails.' + ui.upload.index, image 
);
+                       ui.previewLoaded = true;
                };
                image.src = url;
-               _this.upload.thumbnails['*'] = image;
+               this.upload.thumbnails['*'] = image;
        },
 
        makePreview: function() {
-               var _this = this;
+               var first, video, url, dataUrlReader,
+                       ui = this;
 
                // don't run this repeatedly.
-               if( _this.previewLoaded ) {
+               if( this.previewLoaded ) {
                        return;
                }
 
                // do preview if we can
-               if ( _this.isPreviewable() ) {
+               if ( this.isPreviewable() ) {
                        // open video and get frame via canvas
-                       if ( _this.isVideo() ) {
-                               var first = true;
-                               var video = document.createElement( 'video' );
+                       if ( this.isVideo() ) {
+                               first = true;
+                               video = document.createElement( 'video' );
 
                                video.addEventListener('loadedmetadata', 
function () {
                                        //seek 2 seconds into video or to half 
if shorter
@@ -415,37 +416,39 @@
                                                // Chrome sometimes shows black 
frames if grabbing right away.
                                                // wait 500ms before grabbing 
frame
                                                setTimeout(function() {
-                                                       var canvas = 
document.createElement( 'canvas' );
+                                                       var context,
+                                                               canvas = 
document.createElement( 'canvas' );
                                                        canvas.width = 100;
                                                        canvas.height = 
Math.round( canvas.width * video.videoHeight / video.videoWidth );
-                                                       var context = 
canvas.getContext( '2d' );
+                                                       context = 
canvas.getContext( '2d' );
                                                        context.drawImage( 
video, 0, 0, canvas.width, canvas.height );
                                                        this.loadImage( 
canvas.toDataURL() );
-                                                       
_this.URL().revokeObjectURL( video.url );
+                                                       
ui.URL().revokeObjectURL( video.url );
                                                }, 500);
                                        }
                                });
-                               var url = _this.URL().createObjectURL( 
_this.upload.file );
+                               url = this.URL().createObjectURL( 
this.upload.file );
                                video.src = url;
                        } else {
-                               var dataUrlReader = new FileReader();
+                               dataUrlReader = new FileReader();
                                dataUrlReader.onload = function() {
                                        // this step (inserting 
image-as-dataurl into image object) is slow for large images, which
                                        // is why this is optional and has a 
control attached to it to load the preview.
-                                       _this.loadImage( dataUrlReader.result );
+                                       ui.loadImage( dataUrlReader.result );
                                };
-                               dataUrlReader.readAsDataURL( _this.upload.file 
);
+                               dataUrlReader.readAsDataURL( this.upload.file );
                        }
                }
        },
 
        fileChangedError: function( code, info ) {
-               var filename = this.getFilename();
+               var filename = this.getFilename(),
 
-               // ok we now have a fileInputCtrl with a "bad" file in it
-               // you cannot blank a file input ctrl in all browsers, so we
-               // replace existing file input with empty clone
-               var $newFileInput = this.$fileInputCtrl.clone();
+                       // ok we now have a fileInputCtrl with a "bad" file in 
it
+                       // you cannot blank a file input ctrl in all browsers, 
so we
+                       // replace existing file input with empty clone
+                       $newFileInput = this.$fileInputCtrl.clone();
+
                this.$fileInputCtrl.replaceWith( $newFileInput );
                this.$fileInputCtrl = $newFileInput;
                this.initFileInputCtrl();
@@ -487,7 +490,7 @@
                this.showFilenameError( $errorMessage );
        },
 
-       showMissingExtensionError: function( filename ) {
+       showMissingExtensionError: function () {
                this.showExtensionError( $( '<p>' ).msg( 
'mwe-upwiz-upload-error-bad-filename-no-extension' ) );
        },
 
@@ -501,7 +504,7 @@
                                $errorMessage,
                                $( '<p>' ).msg( 
'mwe-upwiz-allowed-filename-extensions' ),
                                $( '<blockquote>' ).append( $( '<tt>' ).append(
-                                       
mw.UploadWizard.config.fileExtensions.join( " " )
+                                       
mw.UploadWizard.config.fileExtensions.join( ' ' )
                                ) )
                        )
                );
@@ -534,11 +537,13 @@
         *     on the selected element or whether to listen to window-resize 
events ('resize')
         */
        moveFileInputToCover: function( selector, positionTracking ) {
-               var iv, to, onResize, $win, _this = this;
-               var update = function() {
+               var iv, to, onResize, $win,
+                       ui = this;
+
+               function update() {
                        var $covered = $( selector );
 
-                       _this.fileCtrlContainer
+                       ui.fileCtrlContainer
                                .css( $covered.position() )
                                .css( 'marginTop', $covered.css( 'marginTop' ) )
                                .css( 'marginRight', $covered.css( 
'marginRight' ) )
@@ -547,16 +552,16 @@
                                .width( $covered.outerWidth() )
                                .height( $covered.outerHeight() );
 
-                       _this.fileCtrlContainer.css( { 'z-index': 1 } );
+                       ui.fileCtrlContainer.css( { 'z-index': 1 } );
 
                        // shift the file input over with negative margins,
                        // internal to the overflow-containing div, so the div 
shows all button
                        // and none of the textfield-like input
-                       _this.$fileInputCtrl.css( {
-                               'margin-left': '-' + ~~( 
_this.$fileInputCtrl.width() - $covered.outerWidth() - 10 ) + 'px',
-                               'margin-top' : '-' + ~~( 
_this.$fileInputCtrl.height() - $covered.outerHeight() - 10 ) + 'px'
+                       ui.$fileInputCtrl.css( {
+                               'margin-left': '-' + Number( 
ui.$fileInputCtrl.width() - $covered.outerWidth() - 10 ) + 'px',
+                               'margin-top' : '-' + Number( 
ui.$fileInputCtrl.height() - $covered.outerHeight() - 10 ) + 'px'
                        } );
-               };
+               }
 
 
                this.cancelPositionTracking();
@@ -564,7 +569,7 @@
                        iv = window.setInterval( update, 500 );
                        this.stopTracking = function () {
                                window.clearInterval( iv );
-                       }
+                       };
                } else if ( positionTracking === 'resize' ) {
                        $win = $( window );
                        onResize = function () {
@@ -577,7 +582,7 @@
                        $win.resize( onResize );
                        this.stopTracking = function () {
                                $win.off( 'resize', onResize );
-                       }
+                       };
                }
                update();
        },
@@ -603,32 +608,33 @@
         *      TODO silently fix to have unique filename? unnecessary at this 
point...
         */
        updateFilename: function() {
-               var _this = this;
-               var path = this.getFilename();
+               var $div,
+                       ui = this,
+                       path = this.getFilename();
                // get basename of file; some browsers do this 
C:\fakepath\something
                path = path.replace(/\w:.*\\(.*)$/,'$1');
 
                // visible filename
-               $( _this.form ).find( '.mwe-upwiz-visible-file-filename-text' 
).text( path );
+               $( this.form ).find( '.mwe-upwiz-visible-file-filename-text' 
).text( path );
 
                // Set the filename we tell to the API to be the current 
timestamp + the filename
                // This is because we don't actually care what the filename is 
at this point, we just want it to be unique for this session and have the
                // proper file extension.
                // Also, it avoids a problem -- the API only returns one error 
at a time and it thinks that the same-filename error is more important than 
same-content.
                // But for UploadWizard, at this stage, it's the reverse. We 
want to stop same-content dead, but for now we ignore same-filename
-               $( _this.filenameCtrl ).val( ( new Date() 
).getTime().toString() + path );
+               $( this.filenameCtrl ).val( ( new Date() ).getTime().toString() 
+ path );
 
                // deal with styling the file inputs and making it react to 
mouse
-               if ( ! _this.isFilled ) {
-                       var $div = $( _this.div );
-                       _this.isFilled = true;
+               if ( ! this.isFilled ) {
+                       $div = $( this.div );
+                       this.isFilled = true;
                        $div.addClass( 'filled' );
 
                        // cover the div with the file input.
                        // we use the visible-file div because it has the same 
offsetParent as the file input
                        // the second argument offsets the fileinput to the 
right so there's room for the close icon to get mouse events
                        // TODO Why do we care for this element at all and do 
not just hide it, once we have a valid file in it?
-                       _this.moveFileInputToCover(
+                       this.moveFileInputToCover(
                                $div.find( 
'.mwe-upwiz-visible-file-filename-text' )
                        );
 
@@ -646,7 +652,7 @@
                                $div.addClass( 'hover' );
                                $( '#mwe-upwiz-filelist' )
                                        .children()
-                                       .filter( function() { return this !== 
_this.div; } )
+                                       .filter( function() { return this !== 
ui.div; } )
                                        .removeClass('hover');
                        } );
                        $div.bind( 'mouseleave mouseout', function() {
@@ -654,12 +660,12 @@
                        } );
 
                        // Create new upload slot for additional upload(s)
-                       _this.upload.wizard.newUpload();
+                       this.upload.wizard.newUpload();
                        // Set the upload to be 'filled', which finally adds it 
to UploadWizard's list of uploads.
-                       _this.upload.wizard.setUploadFilled( _this.upload );
+                       this.upload.wizard.setUploadFilled( this.upload );
 
                } else {
-                       $( _this.div ).trigger( 'filenameAccepted' );
+                       $( this.div ).trigger( 'filenameAccepted' );
                }
        },
 
@@ -668,22 +674,21 @@
         * XXX this should be changed to something Theme compatible
         */
        clearErrors: function() {
-               var _this = this;
-               $( _this.div ).removeClass( 'mwe-upwiz-upload-error ');
-               $( _this.errorDiv ).hide().empty();
+               $( this.div ).removeClass( 'mwe-upwiz-upload-error ');
+               $( this.errorDiv ).hide().empty();
        },
 
        /**
         * Show an error with the upload
         */
        error: function() {
-               var _this = this;
-               var args = Array.prototype.slice.call( arguments ); // copies 
arguments into a real array
-               var msg = 'mwe-upwiz-upload-error-' + args[0];
-               $( _this.errorDiv ).append( $( '<p 
class="mwe-upwiz-upload-error">' + mw.msg( msg, args.slice( 1 ) ) + '</p>') );
+               // copies arguments into a real array
+               var args = Array.prototype.slice.call( arguments ),
+                       msg = 'mwe-upwiz-upload-error-' + args[0];
+               $( this.errorDiv ).append( $( '<p 
class="mwe-upwiz-upload-error">' + mw.msg( msg, args.slice( 1 ) ) + '</p>') );
                // apply a error style to entire did
-               $( _this.div ).addClass( 'mwe-upwiz-upload-error' );
-               $( _this.errorDiv ).show();
+               $( this.div ).addClass( 'mwe-upwiz-upload-error' );
+               $( this.errorDiv ).show();
        }
 
 };
diff --git a/resources/mw.UploadWizardUtil.js b/resources/mw.UploadWizardUtil.js
index 3a941bb..edc594d 100644
--- a/resources/mw.UploadWizardUtil.js
+++ b/resources/mw.UploadWizardUtil.js
@@ -13,31 +13,32 @@
         *        (with mwe-upwiz- prefix for UploadWizard messages)
         */
        makeToggler: function ( toggleDiv, moreDiv, msg ) {
-               var actualMsg;
+               function toggle() {
+                       var isOpen = $toggleLink.hasClass( 
'mwe-upwiz-toggler-open' );
+                       if ( isOpen ) {
+                               // hide the extra options
+                               moreDiv.slideUp( 250 );
+                               /* when closed, show control to open */
+                               $toggleLink.removeClass( 
'mwe-upwiz-toggler-open' );
+                       } else {
+                               // show the extra options
+                               moreDiv.slideDown( 250 );
+                               /* when open, show control to close */
+                               $toggleLink.addClass( 'mwe-upwiz-toggler-open' 
);
+                       }
+               }
+
+               var $toggleLink, actualMsg;
+
                if ( typeof msg === 'object' ) {
                        actualMsg = mw.msg.apply( this, msg );
                } else {
                        actualMsg = mw.msg( msg );
                }
-               var $toggleLink = $( '<a>' )
+               $toggleLink = $( '<a>' )
                        .addClass( 'mwe-upwiz-toggler mwe-upwiz-more-options' )
                        .append( actualMsg );
                $( toggleDiv ).append( $toggleLink );
-
-               var toggle = function() {
-                       var isOpen = $toggleLink.hasClass( 
"mwe-upwiz-toggler-open" );
-                       if ( isOpen ) {
-                               // hide the extra options
-                               moreDiv.slideUp( 250 );
-                               /* when closed, show control to open */
-                               $toggleLink.removeClass( 
"mwe-upwiz-toggler-open" );
-                       } else {
-                               // show the extra options
-                               moreDiv.slideDown( 250 );
-                               /* when open, show control to close */
-                               $toggleLink.addClass( "mwe-upwiz-toggler-open" 
);
-                       }
-               };
 
                moreDiv.hide();
 
diff --git a/resources/mw.UtilitiesTime.js b/resources/mw.UtilitiesTime.js
index ccfb029..fdcbf36 100644
--- a/resources/mw.UtilitiesTime.js
+++ b/resources/mw.UtilitiesTime.js
@@ -13,16 +13,17 @@
         *            show_ms If milliseconds should be displayed.
         * @return {Float} String npt format
         */
-       mw.seconds2npt = function( sec, show_ms ) {
+       mw.seconds2npt = function( sec, showMs ) {
                if ( isNaN( sec ) ) {
                        sec = 0;
                }
 
-               var tm = mw.seconds2Measurements( sec );
+               var tm = mw.seconds2Measurements( sec ),
+                       hoursStr = '';
 
                // Round the number of seconds to the required number of 
significant
                // digits
-               if ( show_ms ) {
+               if ( showMs ) {
                        tm.seconds = Math.round( tm.seconds * 1000 ) / 1000;
                } else {
                        tm.seconds = Math.round( tm.seconds );
@@ -30,14 +31,13 @@
                if ( tm.seconds < 10 ) {
                        tm.seconds = '0' +      tm.seconds;
                }
-               var hoursStr = '';
                if ( tm.hours > 0 ) {
                        if ( tm.minutes < 10 ) {
                                tm.minutes = '0' + tm.minutes;
                        }
-                       hoursStr = tm.hours + ":";
+                       hoursStr = tm.hours + ':';
                }
-               return hoursStr + tm.minutes + ":" + tm.seconds;
+               return hoursStr + tm.minutes + ':' + tm.seconds;
        };
 
        /**
@@ -62,23 +62,23 @@
         *            npt_str NPT time string
         * @return {Float} Number of seconds
         */
-       mw.npt2seconds = function ( npt_str ) {
-               if ( !npt_str ) {
+       mw.npt2seconds = function ( nptStr ) {
+               if ( !nptStr ) {
                        return undefined;
                }
                // Strip {npt:}01:02:20 or 32{s} from time if present
-               npt_str = npt_str.replace( /npt:|s/g, '' );
+               nptStr = nptStr.replace( /npt:|s/g, '' );
 
-               var hour = 0;
-               var min = 0;
-               var sec = 0;
+               var hour = 0,
+                       min = 0,
+                       sec = 0,
+                       times = nptStr.split( ':' );
 
-               var times = npt_str.split( ':' );
-               if ( times.length == 3 ) {
+               if ( times.length === 3 ) {
                        sec = times[2];
                        min = times[1];
                        hour = times[0];
-               } else if ( times.length == 2 ) {
+               } else if ( times.length === 2 ) {
                        sec = times[1];
                        min = times[0];
                } else {
diff --git a/resources/mw.fileApi.js b/resources/mw.fileApi.js
index f46990f..85da320 100644
--- a/resources/mw.fileApi.js
+++ b/resources/mw.fileApi.js
@@ -35,7 +35,7 @@
                 */
                isPreviewableVideo: function ( file ) {
                        var video = document.createElement( 'video' );
-                       return video.canPlayType && video.canPlayType( 
file.type ).replace( 'no', '' ) != '';
+                       return video.canPlayType && video.canPlayType( 
file.type ).replace( 'no', '' ) !== '';
                },
 
                isFormDataAvailable: function() {

-- 
To view, visit https://gerrit.wikimedia.org/r/80954
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0710fd5fb9ce8ad21b7d3a45834fa8955944e433
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: MarkTraceur <[email protected]>

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

Reply via email to