jenkins-bot has submitted this change and it was merged.
Change subject: Code quality: Remove jscs "requireMultipleVarDecl" over-ride
and make pass
......................................................................
Code quality: Remove jscs "requireMultipleVarDecl" over-ride and make pass
Change-Id: Ic435cbf1f3021211dfb3f425a5c1c3bf820837e8
---
M .jscsrc
M resources/jquery/jquery.morphCrossfade.js
M resources/jquery/jquery.mwCoolCats.js
M resources/jquery/jquery.pubsub.js
M resources/mw.UploadWizard.js
5 files changed, 45 insertions(+), 41 deletions(-)
Approvals:
Gilles: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.jscsrc b/.jscsrc
index 8420099..5fc904a 100644
--- a/.jscsrc
+++ b/.jscsrc
@@ -1,7 +1,6 @@
{
"preset": "wikimedia",
- "requireMultipleVarDecl": null,
"disallowDanglingUnderscores": null,
"requireCamelCaseOrUpperCaseIdentifiers": null
- }
+}
diff --git a/resources/jquery/jquery.morphCrossfade.js
b/resources/jquery/jquery.morphCrossfade.js
index 0c4dda2..2d673a3 100644
--- a/resources/jquery/jquery.morphCrossfade.js
+++ b/resources/jquery/jquery.morphCrossfade.js
@@ -84,9 +84,10 @@
$containers.css( { overflow:'hidden' } );
$.each( $containers, function ( i, container ) {
- var $container = $( container );
- var $oldPanel = $( $container.data( 'crossfadeDisplay'
) );
- var $newPanel = ( typeof newPanelSelector === 'string'
) ? $container.find( newPanelSelector ) : $( newPanelSelector );
+ var $container = $( container ),
+ $oldPanel = $( $container.data(
'crossfadeDisplay' ) ),
+ $newPanel = ( typeof newPanelSelector ===
'string' ) ?
+ $container.find( newPanelSelector ) :
$( newPanelSelector );
if ( $oldPanel.get(0) !== $newPanel.get(0) ) {
if ( $oldPanel ) {
diff --git a/resources/jquery/jquery.mwCoolCats.js
b/resources/jquery/jquery.mwCoolCats.js
index 25e1349..edfef88 100644
--- a/resources/jquery/jquery.mwCoolCats.js
+++ b/resources/jquery/jquery.mwCoolCats.js
@@ -12,15 +12,17 @@
*/
( function ( $ ) { $.fn.mwCoolCats = function ( options ) {
- var catNsId = mw.config.get( 'wgNamespaceIds' ).category;
+ var defaults, settings, cx, seenCat, $container, $template,
+ catNsId = mw.config.get( 'wgNamespaceIds' ).category;
/**
* Get content from our text field, and attempt to insert it as a
category.
* May require confirmation from user if they appear to be adding a new
category.
*/
function _processInput( _this, shouldcreate ) {
- var $input = $(_this);
- var $label = $input.closest('p');
+ var text, title, cat,
+ $input = $(_this),
+ $label = $input.closest('p');
$( '.mwe-upwiz-category-will-be-added', $label ).remove();
if ( $input.length === 0 ) {
$input = $( 'input', $container );
@@ -29,16 +31,16 @@
}
}
- var text = _stripText( $input.val() );
+ text = _stripText( $input.val() );
if ( text === '' ) {
$input.removeData( 'title' );
return;
}
- var title = new mw.Title( text, catNsId );
+ title = new mw.Title( text, catNsId );
$input.data( 'title', title );
- var cat = title.getMainText();
+ cat = title.getMainText();
$input.removeClass( 'will-be-added' );
if ( seenCat[cat] !== true && !_doesCatExist( text ) ) {
@@ -69,11 +71,14 @@
* @param {boolean} whether this category is visible to the user
*/
function _insertCat( title, isHidden ) {
+ var $li, $anchor;
+
if ( _containsCat( title ) ) {
return;
}
- var $li = $( '<li/>' ).addClass( 'cat' );
- var $anchor = $( '<a/>' ).addClass( 'cat' ).append(
title.getMainText() );
+
+ $li = $( '<li/>' ).addClass( 'cat' );
+ $anchor = $( '<a/>' ).addClass( 'cat' ).append(
title.getMainText() );
$li.append( $anchor );
$li.data( 'title', title );
if ( isHidden ) {
@@ -163,19 +168,20 @@
* into the text field
*/
function _fetchSuggestions() {
- var _input = this;
+ var prefix, ok, title,
+ _input = this;
// Get the name of the category (no "Category:"), stripping out
// bad characters as necessary.
- var prefix = _stripText( $( this ).val() ),
- title = mw.Title.newFromText( prefix, catNsId );
+ prefix = _stripText( $( this ).val() );
+ title = mw.Title.newFromText( prefix, catNsId );
if ( title && title.getNamespaceId() === catNsId ) {
prefix = title.getMainText();
} else {
prefix = title.getPrefixedText();
}
- var ok = function ( catList ) {
+ ok = function ( catList ) {
for ( var c in catList ) {
seenCat[catList[c]] = true;
}
@@ -185,25 +191,22 @@
$( _input ).data( 'request',
settings.api.getCategoriesByPrefix( prefix ).done( ok ) );
}
- var defaults = {
+ defaults = {
buttontext: 'Add',
hiddenCats: [],
missingCatsWikiText: null,
cats: []
};
- var settings = $.extend( {}, defaults, options );
+ settings = $.extend( {}, defaults, options );
if ( !settings.api ) {
throw new Error( 'jQuery.mwCoolCats needs an \'api\' argument'
);
}
- var seenCat = {};
- for ( var cx in settings.cats ) {
+ seenCat = {};
+ for ( cx in settings.cats ) {
seenCat[settings.cats[cx]] = true;
}
-
- var $container;
- var $template;
/**
* Initialize the text field(s) the widget was given to be category
pickers.
diff --git a/resources/jquery/jquery.pubsub.js
b/resources/jquery/jquery.pubsub.js
index b613881..63c3c39 100644
--- a/resources/jquery/jquery.pubsub.js
+++ b/resources/jquery/jquery.pubsub.js
@@ -8,15 +8,16 @@
*/
( function ( $ ) {
- /**
- * Store of events -> array of listener callbacks
- */
- var subs = {};
+ var
+ /**
+ * Store of events -> array of listener callbacks
+ */
+ subs = {},
- /**
- * Store of ready events, as object of event name -> argument array
- */
- var ready = {};
+ /**
+ * Store of ready events, as object of event name -> argument
array
+ */
+ ready = {};
/**
* Publish an event
@@ -85,9 +86,10 @@
* @return {Boolean} success
*/
$.unsubscribe = function ( nameFn ) {
- var name = nameFn[0];
- var fn = nameFn[1];
- var success = false;
+ var name = nameFn[0],
+ fn = nameFn[1],
+ success = false;
+
if ( subs[name].length ) {
$.each( subs[name], function ( i, fni ) {
if ( fni === fn ) {
diff --git a/resources/mw.UploadWizard.js b/resources/mw.UploadWizard.js
index 27840b1..14fd00e 100644
--- a/resources/mw.UploadWizard.js
+++ b/resources/mw.UploadWizard.js
@@ -1099,12 +1099,11 @@
prefRequest = {
action:'options',
change:'upwiz_skiptutorial=1'
- };
-
- var allowCloseWindow = mw.confirmCloseWindow( {
- message: function () { return mw.message(
'mwe-upwiz-prevent-close-wait' ).text(); },
- test: function () { return !isComplete; }
- } );
+ },
+ allowCloseWindow = mw.confirmCloseWindow( {
+ message: function () { return
mw.message( 'mwe-upwiz-prevent-close-wait' ).text(); },
+ test: function () { return !isComplete;
}
+ } );
api.post( tokenRequest,
function ( data ) {
--
To view, visit https://gerrit.wikimedia.org/r/159954
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic435cbf1f3021211dfb3f425a5c1c3bf820837e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Jforrester <[email protected]>
Gerrit-Reviewer: Gilles <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits