Apply coding conventions for JavaScript
authorFomafix <fomafix@googlemail.com>
Fri, 12 Dec 2014 07:12:43 +0000 (07:12 +0000)
committer[[mw:User:Fomafix]] <gerritpatchuploader@gmail.com>
Fri, 12 Dec 2014 07:12:43 +0000 (07:12 +0000)
Change-Id: I1ab432ec54e82b05b7c096baa5d4e56dce11aaa9

resources/src/jquery/jquery.arrowSteps.js
resources/src/jquery/jquery.expandableField.js
resources/src/jquery/jquery.hidpi.js
resources/src/jquery/jquery.qunit.completenessTest.js
resources/src/jquery/jquery.tabIndex.js
resources/src/jquery/jquery.tablesorter.js
resources/src/mediawiki.action/mediawiki.action.edit.preview.js
resources/src/mediawiki.legacy/wikibits.js
resources/src/mediawiki/mediawiki.Title.js
resources/src/mediawiki/mediawiki.js
resources/src/mediawiki/mediawiki.template.js

index f8641e1..629ce32 100644 (file)
@@ -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' );
index 732cc6e..48341bc 100644 (file)
                        // Store the context for next time
                        $( this ).data( 'expandableField-context', context );
                } );
-               return returnValue !== undefined ? returnValue : $(this);
+               return returnValue !== undefined ? returnValue : $( this );
        };
 
 }( jQuery ) );
index 4ecfeb8..8fca056 100644 (file)
@@ -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;
index 8d38401..556bf8c 100644 (file)
@@ -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();
                                        var elItem = document.createElement( 'li' );
                                        elItem.textContent = key;
                                        elList.appendChild( elItem );
-                               });
+                               } );
 
                                elFoot = document.createElement( 'p' );
                                elFoot.innerHTML = '<em>&mdash; CompletenessTest</em>';
 
                                util.each( style, function ( key, value ) {
                                        elOutputWrapper.style[key] = value;
-                               });
+                               } );
                                return elOutputWrapper;
                        }
 
                        if ( toolbar ) {
                                toolbar.insertBefore( testResults, toolbar.firstChild );
                        }
-               });
+               } );
 
                return this;
        }
                        var ct = this;
                        util.each( ct.injectionTracker, function ( key ) {
                                ct.hasTest( key );
-                       });
+                       } );
                },
 
                /**
index 46cc8f2..ed37aa1 100644 (file)
@@ -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 ) {
index f3f2655..0d3341b 100644 (file)
                // 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++ ) {
                                headerIndex: headerIndex,
                                order: 0,
                                count: 0
-                       });
+                       } );
 
                        if ( $cell.hasClass( config.unsortableClass ) ) {
                                $cell.data( 'sortDisabled', true );
                                                                                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;
                                                                                }
                                                                        }
index e4f4249..42ba5aa 100644 (file)
                                        newList = [];
                                        $.each( response.parse.templates, function ( i, template ) {
                                                li = $( '<li>' )
-                                                       .append( $('<a>')
+                                                       .append( $( '<a>' )
                                                                .attr( {
                                                                        'href': mw.util.getUrl( template['*'] ),
                                                                        'class': ( template.exists !== undefined ? '' : 'new' )
index a403996..dc21472 100644 (file)
@@ -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;
 };
 
index 7ced42f..1e80cd7 100644 (file)
 
                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;
                };
 
index c8f5506..8153fe3 100644 (file)
                                                        var check = checkCssHandles;
                                                        pending++;
                                                        return function () {
-                                                               if (check) {
+                                                               if ( check ) {
                                                                        pending--;
                                                                        check();
                                                                        check = undefined; // Revoke
index 79f43d1..61bbb0d 100644 (file)
@@ -63,7 +63,7 @@
                        var compiledTemplate,
                                compilerName = this.getCompilerName( templateName );
 
-                       if (!compiledTemplates[moduleName]) {
+                       if ( !compiledTemplates[moduleName] ) {
                                compiledTemplates[moduleName] = {};
                        }