jenkins-bot has submitted this change and it was merged. Change subject: Pass JSHint ......................................................................
Pass JSHint Bug: T73106 Change-Id: I617559f47241b92a298a91892b12175c7ab5a5e3 --- M resources/ext.multiupload.js M resources/ext.multiupload.shared.js M resources/ext.multiupload.top.js M resources/ext.multiupload.unpack.js M resources/mw.FormDataTransport.js 5 files changed, 32 insertions(+), 23 deletions(-) Approvals: Legoktm: Looks good to me, but someone else must approve Bartosz Dziewoński: Looks good to me, approved jenkins-bot: Verified diff --git a/resources/ext.multiupload.js b/resources/ext.multiupload.js index d5b09a2..6f1b9da 100644 --- a/resources/ext.multiupload.js +++ b/resources/ext.multiupload.js @@ -1,3 +1,4 @@ +/* global mediaWiki */ ( function ( mw, $ ) { $( document ).ready( function() { diff --git a/resources/ext.multiupload.shared.js b/resources/ext.multiupload.shared.js index 7a877cb..c7a12f0 100644 --- a/resources/ext.multiupload.shared.js +++ b/resources/ext.multiupload.shared.js @@ -1,19 +1,20 @@ /* ext.multiupload.shared.js: * JS resources that are useful to outside extensions based on MultiUpload */ +/* global fillDestFilename, mediaWiki */ ( function ( mw, $ ) { -collapse = function( $fieldset ) { +var collapse = function( $fieldset ) { $fieldset.find( '.multiupload-collapsible' ).hide( 400 ); $fieldset.data( 'collapsed', true ); }; -expand = function( $fieldset ) { +var expand = function( $fieldset ) { $fieldset.find( '.multiupload-collapsible' ).show( 400 ); //slideDown( ); $fieldset.data( 'collapsed', false ); }; -toggle = function( $fieldset ) { +var toggle = function( $fieldset ) { var collapsed = $fieldset.data( 'collapsed' ); if ( collapsed ) { expand( $fieldset ); @@ -22,7 +23,7 @@ } }; -setupAnimation = function( $fieldset ) { +var setupAnimation = function( $fieldset ) { // mark all rows that will be hidden var marking = false; $fieldset.find( 'tbody' ).children().map( function() { @@ -37,7 +38,7 @@ // now set up the table to collapse upwards $fieldset.find( 'input.wpUploadFileUrl,input.wpUploadFile' ) .change( function ( event ) { - if ( event.target.type == 'file' ) { + if ( event.target.type === 'file' ) { mw.libs.ext.multiupload.checkForPackageFile( event.target ); } // else unpack from URL? // this test is because I trigger 'change' in document.ready() @@ -66,7 +67,7 @@ }; var fixRowNumbers = function () { - $rows = $( 'form > fieldset' ).not( '.ww-messages' ); + var $rows = $( 'form > fieldset' ).not( '.ww-messages' ); var lastRowIndex = 0; $rows.each( function ( index ) { mw.libs.ext.multiupload.renumberRow( $( this ), index + 1 ); @@ -167,7 +168,7 @@ var configvar = 'wgMultiUploadAutoFill' + i; if ( destFile ) { $fieldset.find( 'input.wpUploadFile,input.wpUploadFileURL' ) - .change( function( e ) { + .change( function() { fillDestFilename( this, upUrl, destFile, upperm, uppro, warningId, ackElt, configvar ); } ); @@ -206,16 +207,16 @@ isBlank: function( $fieldset ) { var inputs = $fieldset.find( 'input.wpUploadFileUrl,input.wpUploadFile' ); var nfilled = inputs - .filter( function( i ) { return this.value ? true: false; } ) + .filter( function() { return this.value ? true: false; } ) .length; var destFile = $fieldset.find( 'input.wpDestFile' ); - return ( inputs.length > 0 && nfilled === 0 && ! destFile.val() ); + return ( inputs.length > 0 && nfilled === 0 && !destFile.val() ); }, // function to add a blank row at bottom of form when appropriate maybeAddBlankRow: function ( form ) { - lastfs = mw.libs.ext.multiupload.findLastRow( form ); - if ( lastfs.length == 1 && mw.libs.ext.multiupload.isBlank( lastfs ) ) { + var lastfs = mw.libs.ext.multiupload.findLastRow( form ); + if ( lastfs.length === 1 && mw.libs.ext.multiupload.isBlank( lastfs ) ) { return; } mw.libs.ext.multiupload.addRow( {}, lastfs ); @@ -224,7 +225,6 @@ renumberRow: function( $fieldset, i ) { $fieldset.data( 'row-index', i ); $fieldset.find( '*' ).map( function() { - var $this = $( this ); var dnb = $( this ).attr( 'data-name-base' ); if ( dnb ) { var id = dnb + i; @@ -300,8 +300,9 @@ }, stuffRow: function ( $fieldset, opts ) { + /* jshint forin:false */ for ( var name in opts ) { - $input = $fieldset.find( ':input.' + name ); + var $input = $fieldset.find( ':input.' + name ); var id = name + $fieldset.data( 'row-index' ); if ( $input.length ) { if ( opts[name] !== null ) { @@ -336,7 +337,7 @@ // grab the template row and be able to copy it to bottom of the // form on demand captureTemplate: function() { - $template = $( 'form > fieldset:first-child' ).not( '.ww-messages' ); + var $template = $( 'form > fieldset:first-child' ).not( '.ww-messages' ); $template.detach(); mw.libs.ext.multiupload.templateUploadRow = $template; // move template row's hidden fields into its DOM tree @@ -350,7 +351,7 @@ } } ); // same for row 1, for convenience - row1 = $( 'form > fieldset:first-child' ).not( '.ww-messages' ); + var row1 = $( 'form > fieldset:first-child' ).not( '.ww-messages' ); $( 'input[type="hidden"][id*="1"]' ).appendTo( row1 ); // and, to get the close button and stuff right fixRowNumbers(); diff --git a/resources/ext.multiupload.top.js b/resources/ext.multiupload.top.js index 6aa8129..8bf9abe 100644 --- a/resources/ext.multiupload.top.js +++ b/resources/ext.multiupload.top.js @@ -1,3 +1,4 @@ +/* global $, mw */ ( function ( $, mw ) { if ( !mw.libs ) { @@ -6,8 +7,6 @@ if ( !mw.libs.ext ) { mw.libs.ext = {}; } - -var spinnerCounter = 0; // a small portion of JS code to be available during page load mw.libs.ext.multiupload = { diff --git a/resources/ext.multiupload.unpack.js b/resources/ext.multiupload.unpack.js index 276a71b..61e5cd8 100644 --- a/resources/ext.multiupload.unpack.js +++ b/resources/ext.multiupload.unpack.js @@ -1,3 +1,4 @@ +/* global $, mw */ ( function ( $, mw ) { function notify( message ) { @@ -10,7 +11,7 @@ } catch ( e ) { // otherwise, use dialog(). mw.loader.using( 'jquery.ui.dialog', function() { - var d_opts = { + var dialogOpts = { buttons: [ { text: mw.message( 'multiupload-notify-ok' ).plain(), click: function () { @@ -18,7 +19,7 @@ } } ] }; - $( '<div/>' ).append( message ).dialog( d_opts ); + $( '<div/>' ).append( message ).dialog( dialogOpts ); // TODO make it stretch to width of message } ); } @@ -31,7 +32,7 @@ errtxt = 'Error: ' + result.error.info; } else if ( result && result.exception ) { errtxt = 'Error: ' + result.exception; - } else if ( code == 'http' ) { + } else if ( code === 'http' ) { errtxt = mw.message( 'multiupload-http-error' ).parse(); } if ( errtxt ) { @@ -53,7 +54,7 @@ ok: function ( data ) { mw.libs.ext.multiupload.removeTinySpinner( spinnerName ); if ( 'multiupload-unpack' in data && 'contents' in data['multiupload-unpack'] ) { - reloadForm( input, data['multiupload-unpack']['contents'] ); + reloadForm( input, data['multiupload-unpack'].contents ); } else { // TODO: if invalid token, get a new one and redo notify( 'Error unpacking ' + input.files[0].name ); @@ -86,6 +87,7 @@ 'wpDestPageTouched': 0 }; mw.libs.ext.multiupload.removeRow( $row ); + /* jshint forin:false */ for ( var i in filedata ) { opts.wpSessionKey = filedata[i][0]; opts.wpDestFile = filedata[i][1]; @@ -127,10 +129,10 @@ unpackPackageFile: function ( input, spinnerName ) { var upload = { file: input.files[0], - ui: { setStatus : function ( s ) { } }, + ui: { setStatus : function () { } }, state: undefined }; - var progressCb = function ( progress ) {}; + var progressCb = function () {}; var doneCb = function ( response ) { if ( response && response.upload && response.upload.sessionkey ) { unpackOnServer( input, response.upload.sessionkey, spinnerName ); diff --git a/resources/mw.FormDataTransport.js b/resources/mw.FormDataTransport.js index 8cbecb7..0730974 100644 --- a/resources/mw.FormDataTransport.js +++ b/resources/mw.FormDataTransport.js @@ -1,3 +1,4 @@ +/* global console, mediaWiki */ ( function ( mw, $ ) { /** * FormDataTransport : copied from UploadWizard extension @@ -234,7 +235,11 @@ //Server not ready, wait for 3 more seconds } else { if ( response.upload.stage === undefined ) { + // JSHint doesn't want to understand that I want to + // enforce this *only* for this line :-( + //jshint quotmark: double console.log( "Unable to check file's status" ); + //jshint quotmark: single } else { //Statuses that can be returned: // *mwe-upwiz-queued @@ -251,6 +256,7 @@ } }, err: function(status, response) { + // jshint unused:false transport.transportedCb(response); } } ); -- To view, visit https://gerrit.wikimedia.org/r/232008 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I617559f47241b92a298a91892b12175c7ab5a5e3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/MultiUpload Gerrit-Branch: master Gerrit-Owner: Jack Phoenix <j...@countervandalism.net> Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits