From: Fomafix Date: Fri, 12 Dec 2014 07:12:43 +0000 (+0000) Subject: Apply coding conventions for JavaScript X-Git-Tag: 1.31.0-rc.0~12970^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/categories/modifier.php?a=commitdiff_plain;h=2dc7c0cf48054fb028d228c35a55f295d81ebd92;p=lhc%2Fweb%2Fwiklou.git Apply coding conventions for JavaScript Change-Id: I1ab432ec54e82b05b7c096baa5d4e56dce11aaa9 --- diff --git a/resources/src/jquery/jquery.arrowSteps.js b/resources/src/jquery/jquery.arrowSteps.js index f8641e1043..629ce32ca7 100644 --- a/resources/src/jquery/jquery.arrowSteps.js +++ b/resources/src/jquery/jquery.arrowSteps.js @@ -80,7 +80,7 @@ $.each( $steps, function ( i, step ) { var $step = $( step ); if ( $step.is( selector ) ) { - if ($previous) { + if ( $previous ) { $previous.addClass( 'tail' ); } $step.addClass( 'head' ); diff --git a/resources/src/jquery/jquery.expandableField.js b/resources/src/jquery/jquery.expandableField.js index 732cc6ecc2..48341bc541 100644 --- a/resources/src/jquery/jquery.expandableField.js +++ b/resources/src/jquery/jquery.expandableField.js @@ -134,7 +134,7 @@ // Store the context for next time $( this ).data( 'expandableField-context', context ); } ); - return returnValue !== undefined ? returnValue : $(this); + return returnValue !== undefined ? returnValue : $( this ); }; }( jQuery ) ); diff --git a/resources/src/jquery/jquery.hidpi.js b/resources/src/jquery/jquery.hidpi.js index 4ecfeb884e..8fca05677e 100644 --- a/resources/src/jquery/jquery.hidpi.js +++ b/resources/src/jquery/jquery.hidpi.js @@ -73,11 +73,11 @@ $.fn.hidpi = function () { match; if ( typeof srcset === 'string' && srcset !== '' ) { match = $.matchSrcSet( devicePixelRatio, srcset ); - if (match !== null ) { + if ( match !== null ) { $img.attr( 'src', match ); } } - }); + } ); } return $target; diff --git a/resources/src/jquery/jquery.qunit.completenessTest.js b/resources/src/jquery/jquery.qunit.completenessTest.js index 8d38401eb9..556bf8c72c 100644 --- a/resources/src/jquery/jquery.qunit.completenessTest.js +++ b/resources/src/jquery/jquery.qunit.completenessTest.js @@ -17,8 +17,8 @@ var util, hasOwn = Object.prototype.hasOwnProperty, - log = (window.console && window.console.log) - ? function () { return window.console.log.apply(window.console, arguments); } + log = ( window.console && window.console.log ) + ? function () { return window.console.log.apply( window.console, arguments ); } : function () {}; // Simplified version of a few jQuery methods, except that they don't @@ -91,7 +91,7 @@ // Restore warnings mw.log.warn = warn; warn = undefined; - }); + } ); QUnit.done( function () { that.populateMissingTests(); @@ -114,7 +114,7 @@ var elItem = document.createElement( 'li' ); elItem.textContent = key; elList.appendChild( elItem ); - }); + } ); elFoot = document.createElement( 'p' ); elFoot.innerHTML = '— CompletenessTest'; @@ -133,7 +133,7 @@ util.each( style, function ( key, value ) { elOutputWrapper.style[key] = value; - }); + } ); return elOutputWrapper; } @@ -171,7 +171,7 @@ if ( toolbar ) { toolbar.insertBefore( testResults, toolbar.firstChild ); } - }); + } ); return this; } @@ -248,7 +248,7 @@ var ct = this; util.each( ct.injectionTracker, function ( key ) { ct.hasTest( key ); - }); + } ); }, /** diff --git a/resources/src/jquery/jquery.tabIndex.js b/resources/src/jquery/jquery.tabIndex.js index 46cc8f2cb9..ed37aa1ea3 100644 --- a/resources/src/jquery/jquery.tabIndex.js +++ b/resources/src/jquery/jquery.tabIndex.js @@ -10,8 +10,8 @@ */ $.fn.firstTabIndex = function () { var minTabIndex = null; - $(this).find( '[tabindex]' ).each( function () { - var tabIndex = parseInt( $(this).prop( 'tabindex' ), 10 ); + $( this ).find( '[tabindex]' ).each( function () { + var tabIndex = parseInt( $( this ).prop( 'tabindex' ), 10 ); // In IE6/IE7 the above jQuery selector returns all elements, // becuase it has a default value for tabIndex in IE6/IE7 of 0 // (rather than null/undefined). Therefore check "> 0" as well. @@ -35,8 +35,8 @@ */ $.fn.lastTabIndex = function () { var maxTabIndex = null; - $(this).find( '[tabindex]' ).each( function () { - var tabIndex = parseInt( $(this).prop( 'tabindex' ), 10 ); + $( this ).find( '[tabindex]' ).each( function () { + var tabIndex = parseInt( $( this ).prop( 'tabindex' ), 10 ); if ( tabIndex > 0 && !isNaN( tabIndex ) ) { // Initial value if ( maxTabIndex === null ) { diff --git a/resources/src/jquery/jquery.tablesorter.js b/resources/src/jquery/jquery.tablesorter.js index f3f2655047..0d3341bd81 100644 --- a/resources/src/jquery/jquery.tablesorter.js +++ b/resources/src/jquery/jquery.tablesorter.js @@ -339,7 +339,7 @@ // as each header can span over multiple columns (using colspan=N), // we have to bidirectionally map headers to their columns and columns to their headers $tableHeaders.each( function ( headerIndex ) { - $cell = $(this); + $cell = $( this ); columns = []; for ( i = 0; i < this.colSpan; i++ ) { @@ -354,7 +354,7 @@ headerIndex: headerIndex, order: 0, count: 0 - }); + } ); if ( $cell.hasClass( config.unsortableClass ) ) { $cell.data( 'sortDisabled', true ); @@ -870,7 +870,7 @@ s = config.sortList[j]; o = config.headerList[s[0]]; if ( isValueInArray( s[0], newSortList ) ) { - $(o).data( 'count', s[1] + 1 ); + $( o ).data( 'count', s[1] + 1 ); s[1] = $( o ).data( 'count' ) % 2; } } diff --git a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js index e4f424976c..42ba5aac03 100644 --- a/resources/src/mediawiki.action/mediawiki.action.edit.preview.js +++ b/resources/src/mediawiki.action/mediawiki.action.edit.preview.js @@ -125,7 +125,7 @@ newList = []; $.each( response.parse.templates, function ( i, template ) { li = $( '
  • ' ) - .append( $('') + .append( $( '' ) .attr( { 'href': mw.util.getUrl( template['*'] ), 'class': ( template.exists !== undefined ? '' : 'new' ) diff --git a/resources/src/mediawiki.legacy/wikibits.js b/resources/src/mediawiki.legacy/wikibits.js index a403996699..dc21472a75 100644 --- a/resources/src/mediawiki.legacy/wikibits.js +++ b/resources/src/mediawiki.legacy/wikibits.js @@ -60,7 +60,7 @@ mw.log.deprecate( win, 'getInnerText', function () { return ''; }, msg ); // Run a function after the window onload event is fired mw.log.deprecate( win, 'addOnloadHook', function ( hookFunct ) { if ( onloadFuncts ) { - onloadFuncts.push(hookFunct); + onloadFuncts.push( hookFunct ); } else { // If func queue is gone the event has happened already, // run immediately instead of queueing. @@ -197,7 +197,7 @@ win.importStylesheetURI = function ( url, media ) { if ( media ) { l.media = media; } - document.getElementsByTagName('head')[0].appendChild( l ); + document.getElementsByTagName( 'head' )[0].appendChild( l ); return l; }; diff --git a/resources/src/mediawiki/mediawiki.Title.js b/resources/src/mediawiki/mediawiki.Title.js index 7ced42feba..1e80cd71c2 100644 --- a/resources/src/mediawiki/mediawiki.Title.js +++ b/resources/src/mediawiki/mediawiki.Title.js @@ -508,7 +508,7 @@ normalizeExtension = function ( extension ) { // Remove only trailing space (that is removed by MW anyway) - extension = extension.toLowerCase().replace(/\s*$/, ''); + extension = extension.toLowerCase().replace( /\s*$/, '' ); return extension; }; diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index c8f5506833..8153fe39bc 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -1199,7 +1199,7 @@ var check = checkCssHandles; pending++; return function () { - if (check) { + if ( check ) { pending--; check(); check = undefined; // Revoke diff --git a/resources/src/mediawiki/mediawiki.template.js b/resources/src/mediawiki/mediawiki.template.js index 79f43d1bd4..61bbb0d7bf 100644 --- a/resources/src/mediawiki/mediawiki.template.js +++ b/resources/src/mediawiki/mediawiki.template.js @@ -63,7 +63,7 @@ var compiledTemplate, compilerName = this.getCompilerName( templateName ); - if (!compiledTemplates[moduleName]) { + if ( !compiledTemplates[moduleName] ) { compiledTemplates[moduleName] = {}; }