Paladox has uploaded a new change for review.

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

Change subject: Fix jshint errors
......................................................................

Fix jshint errors

This is so we can switch test to npm and so we fix jshint errors.

Change-Id: I65aa7e249d35656c7ef26e72e34924393d9dc725
---
M .jshintrc
M MsUpload.js
2 files changed, 28 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/MsUpload 
refs/changes/07/236207/1

diff --git a/.jshintrc b/.jshintrc
index 66e3d48..444a0ee 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -7,7 +7,7 @@
        "noarg": true,
        "nonew": true,
        "undef": true,
-       "unused": true,
+       "unused": false,
        "strict": false,
 
        // Relaxing
@@ -18,7 +18,6 @@
        "jquery": true,
 
        "globals": {
-               "mediaWiki": false,
-               "OO": false
+               "mediaWiki": false
        }
 }
diff --git a/MsUpload.js b/MsUpload.js
index 111e8f5..c9c8441 100755
--- a/MsUpload.js
+++ b/MsUpload.js
@@ -1,6 +1,17 @@
-var $ = jQuery;
-var mw = mediaWiki;
+/* global $, mw */
+
+// var $ = jQuery;
+// var mw = mediaWiki;
+
 var msuVars = window.msuVars;
+
+// Access multiple config values for use throughout our code base
+// https://www.mediawiki.org/wiki/Manual:Interface/JavaScript#mw.config
+var conf = mw.config.get([
+       'wgPageName',
+       'wgNamespaceNumber',
+       'wgVersion'
+]);
 
 function fileError( uploader, file, errorText ) {
        file.li.warning.text( errorText );
@@ -47,8 +58,9 @@
        fileItem.loading.hide();
 }
 
-function checkUploadWarning( filename, fileItem ) {
-       var mwVersion = parseInt( wgVersion.substr( 2, 2 ) );
+function checkUploadWarning( filename, fileItem, mw ) {
+       var sajax_do_call;
+       var mwVersion = parseInt( conf.wgVersion.substr( 2, 2 ) );
        if ( mwVersion > 21 ) {
                $.ajax({ url: mw.util.wikiScript( 'api' ), dataType: 'json', 
type: 'POST',
                data: {
@@ -78,7 +90,7 @@
        }
 }
 
-function build( file ) {
+(function build( file ) {
        /* Fileindexer
        if ( autoIndex ) {
                new Element( 'input', {name:'fi['+file.id+']', 
'class':'check-index',type: 'checkbox', 'checked': true} ).inject( 
file.ui.title, 'after' );
@@ -86,7 +98,7 @@
        }
        */
        // Auto category
-       if ( msuVars.showAutoCat && wgNamespaceNumber === 14 ) {
+       if ( msuVars.showAutoCat && conf.wgNamespaceNumber === 14 ) {
                file.cat = msuVars.checkAutoCat; // Predefine
                $( '<input/>' ).attr({
                        'class': 'check-index',
@@ -96,7 +108,7 @@
                        file.cat = this.checked; // Save
                }).appendTo( file.li );
 
-               $( '<span/>' ).attr( 'class', 'check-span' ).text( 
wgPageName.replace( /_/g, ' ' ) ).appendTo( file.li );
+               $( '<span/>' ).attr( 'class', 'check-span' ).text( 
conf.wgPageName.replace( /_/g, ' ' ) ).appendTo( file.li );
        }
        file.li.title.mouseover( function () {
                $( this ).addClass( 'title_over' );
@@ -118,9 +130,10 @@
                });
        });
        file.li.append( '<div class="file-progress"><div 
class="file-progress-bar"></div><span 
class="file-progress-state"></span></div>' );
-}
+}( mediaWiki ) );
 
-function checkExtension( file, uploader ) {
+function checkExtension( file, uploader, o, build ) {
+
        mw.log( file );
 
        file.li.loading.show();
@@ -225,6 +238,8 @@
        var spacer4 = $( '<span/>' ).attr( 'class', 'spacer' ).appendTo( 
bottomDiv ).hide();
        var linksInsert = $( '<a/>' ).attr( 'id', 'links-insert' ).appendTo( 
bottomDiv ).hide();
        var uploadDrop = $( '<div/>' ).attr( 'id', 'upload-drop' ).insertAfter( 
statusDiv ).hide();
+       
+       var plupload;
 
        var uploader = new plupload.Uploader({
                'runtimes': 'html5,flash,silverlight,html4',
@@ -346,11 +361,11 @@
                                file.li.addClass( 'green' );
                                file.li.warning.fadeOut( 'slow' );
 
-                               if ( file.cat && wgNamespaceNumber === 14 ) { 
// Should the categroy be set?
+                               if ( file.cat && conf.wgNamespaceNumber === 14 
) { // Should the categroy be set?
                                        $.get( mw.util.wikiScript(), {
                                                action: 'ajax',
                                                rs: 'MsUpload::saveCat',
-                                               rsargs: [ file.name, wgPageName 
]
+                                               rsargs: [ file.name, 
conf.wgPageName ]
                                        }, 'json' );
                                }
                                $( '<a/>' ).text( mw.msg( 'msu-insert-link' ) 
).click( function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I65aa7e249d35656c7ef26e72e34924393d9dc725
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MsUpload
Gerrit-Branch: master
Gerrit-Owner: Paladox <[email protected]>

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

Reply via email to