Clean up whitespace in various javascript files
authorFomafix <fomafix@googlemail.com>
Tue, 21 Jan 2014 20:49:07 +0000 (20:49 +0000)
committerKrinkle <krinklemail@gmail.com>
Wed, 22 Jan 2014 00:35:07 +0000 (00:35 +0000)
Change-Id: I62fe370493b269618a0277ea06ed6ad22b97616a

15 files changed:
resources/mediawiki.action/mediawiki.action.history.js
resources/mediawiki.action/mediawiki.action.view.metadata.js
resources/mediawiki.api/mediawiki.api.category.js
resources/mediawiki.page/mediawiki.page.gallery.js
resources/mediawiki.page/mediawiki.page.image.pagination.js
resources/mediawiki.special/mediawiki.special.javaScriptTest.js
resources/mediawiki.special/mediawiki.special.preferences.js
resources/mediawiki.special/mediawiki.special.search.js
resources/mediawiki.special/mediawiki.special.upload.js
resources/mediawiki/mediawiki.Title.js
resources/mediawiki/mediawiki.Uri.js
resources/mediawiki/mediawiki.debug.js
resources/mediawiki/mediawiki.htmlform.js
resources/mediawiki/mediawiki.jqueryMsg.js
resources/mediawiki/mediawiki.util.js

index 04f045a..500a47a 100644 (file)
@@ -21,10 +21,10 @@ jQuery( function ( $ ) {
                $lis
                .removeClass( 'selected' )
                .each( function () {
-                       var     $li = $(this),
+                       var     $li = $( this ),
                                $inputs = $li.find( 'input[type="radio"]' ),
-                               $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq(0),
-                               $diffRadio = $inputs.filter( '[name="diff"]' ).eq(0);
+                               $oldidRadio = $inputs.filter( '[name="oldid"]' ).eq( 0 ),
+                               $diffRadio = $inputs.filter( '[name="diff"]' ).eq( 0 );
 
                        if ( !$oldidRadio.length || !$diffRadio.length ) {
                                return true;
@@ -60,7 +60,7 @@ jQuery( function ( $ ) {
                                        $oldidRadio.css( 'visibility', 'hidden' );
                                }
                        }
-               });
+               } );
 
                return true;
        }
@@ -77,7 +77,7 @@ jQuery( function ( $ ) {
        // Ideally we'd use e.target instead of $historySubmitter, but e.target points
        // to the form element for submit actions, so.
        $historyCompareForm.find( '.historysubmit' ).click( function () {
-               $historySubmitter = $(this);
+               $historySubmitter = $( this );
        } );
 
        // On submit we clone the form element, remove unneeded fields in the clone
@@ -92,7 +92,7 @@ jQuery( function ( $ ) {
                if ( $historySubmitter ) {
                        $copyForm = $historyCompareForm.clone();
                        $copyRadios = $copyForm.find( '#pagehistory > li' ).find( 'input[name="diff"], input[name="oldid"]' );
-                       $copyAction = $copyForm.find( '> [name="action"]');
+                       $copyAction = $copyForm.find( '> [name="action"]' );
 
                        // Remove action=historysubmit and ids[..]=..
                        if ( $historySubmitter.hasClass( 'mw-history-compareselectedversions-button' ) ) {
@@ -110,8 +110,8 @@ jQuery( function ( $ ) {
                        // Also remove potentially conflicting id attributes that we don't need anyway
                        $copyForm
                                .css( 'display', 'none' )
-                               .find('[id]')
-                                       .removeAttr('id')
+                               .find( '[id]' )
+                                       .removeAttr( 'id' )
                                .end()
                                .insertAfter( $historyCompareForm )
                                .submit();
index 9b27e24..d23a937 100644 (file)
@@ -26,7 +26,7 @@
                $link = $( '<a>', {
                        text: showText,
                        href: '#'
-               }).click(function () {
+               } ).click( function () {
                        if ( $table.hasClass( 'collapsed' ) ) {
                                $( this ).text( hideText );
                        } else {
@@ -34,7 +34,7 @@
                        }
                        $table.toggleClass( 'expanded collapsed' );
                        return false;
-               });
+               } );
 
                $col.append( $link );
                $row.append( $col );
index 98a9c54..d61c1c6 100644 (file)
@@ -34,7 +34,7 @@
                                                } );
                                        }
                                        d.resolve( exists );
-                               })
+                               } )
                                .fail( d.reject );
 
                        return d.promise( { abort: apiPromise.abort } );
@@ -61,7 +61,7 @@
                        apiPromise = this.get( {
                                        list: 'allpages',
                                        apprefix: prefix,
-                                       apnamespace: mw.config.get('wgNamespaceIds').category
+                                       apnamespace: mw.config.get( 'wgNamespaceIds' ).category
                                } )
                                .done( function ( data ) {
                                        var texts = [];
@@ -71,7 +71,7 @@
                                                } );
                                        }
                                        d.resolve( texts );
-                               })
+                               } )
                                .fail( d.reject );
 
                        return d.promise( { abort: apiPromise.abort } );
index 147a869..64efbb9 100644 (file)
@@ -29,7 +29,7 @@
                // Now on to justification.
                // We may still get ragged edges if someone resizes their window. Could bind to
                // that event, otoh do we really want to constantly be resizing galleries?
-               $( galleries ).each( function() {
+               $( galleries ).each( function () {
                        var lastTop,
                                $img,
                                imgWidth,
@@ -37,9 +37,9 @@
                                rows = [],
                                $gallery = $( this );
 
-                       $gallery.children( 'li' ).each( function() {
+                       $gallery.children( 'li' ).each( function () {
                                // Math.floor to be paranoid if things are off by 0.00000000001
-                               var top = Math.floor( $(this ).position().top ),
+                               var top = Math.floor( $( this ).position().top ),
                                        $this = $( this );
 
                                if ( top !== lastTop ) {
@@ -74,9 +74,9 @@
                                        captionWidth: $this.children().children( 'div.gallerytextwrapper' ).width(),
                                        height: imgHeight
                                };
-                       });
+                       } );
 
-                       (function () {
+                       ( function () {
                                var maxWidth,
                                        combinedAspect,
                                        combinedPadding,
                                                        $outerDiv.width( newWidth + padding );
                                                        $innerDiv.width( newWidth + padding );
                                                        $imageDiv.width( newWidth );
-                                                       $caption.width( curRow[j].captionWidth + (newWidth - curRow[j].imgWidth ) );
+                                                       $caption.width( curRow[j].captionWidth + ( newWidth - curRow[j].imgWidth ) );
                                                }
 
                                                hookInfo = {
index 3c93de0..8a4d526 100644 (file)
@@ -3,7 +3,7 @@
  * without a page reload. Currently, the only image formats that can be multi-page images are
  * PDF and DjVu files
  */
-( function (mw, $) {
+( function ( mw, $ ) {
 
        // Initialize ajax request variable
        var xhr;
@@ -71,7 +71,7 @@
                } );
        }
 
-       $( document ).ready( function() {
+       $( document ).ready( function () {
                // The presence of table.multipageimage signifies that this file is a multi-page image
                if ( mw.config.get( 'wgNamespaceNumber' ) === 6 && $( 'table.multipageimage' ).length !== 0 ) {
                        ajaxifyPageNavigation();
@@ -86,7 +86,7 @@
                                        if ( state ) {
                                                loadPage( state.url, true );
                                        }
-                               });
+                               } );
                        }
                }
        } );
index a560ca9..2c7421b 100644 (file)
@@ -25,7 +25,7 @@
                        // Bind onchange event handler and append to form
                        $html.append(
                                $( select ).change( function () {
-                                       window.location = QUnit.url( { useskin: $(this).val() } );
+                                       window.location = QUnit.url( { useskin: $( this ).val() } );
                                } )
                        );
 
index 3302ec6..19a8844 100644 (file)
@@ -11,7 +11,7 @@ jQuery( function ( $ ) {
        };
 
        $( '#prefsubmit' ).attr( 'id', 'prefcontrol' );
-       $preftoc = $('<ul id="preftoc"></ul>')
+       $preftoc = $( '<ul id="preftoc"></ul>' )
                .attr( 'role', 'tablist' );
        $preferences = $( '#preferences' )
                .addClass( 'jsprefs' )
@@ -34,7 +34,7 @@ jQuery( function ( $ ) {
        $( '<div>' ).addClass( 'mw-navigation-hint' )
                .text( mediaWiki.msg( 'prefs-tabs-navigation-hint' ) )
                .attr( 'tabIndex', 0 )
-               .on( 'focus blur', function( e ) {
+               .on( 'focus blur', function ( e ) {
                        if ( e.type === 'blur' || e.type === 'focusout' ) {
                                $( this ).css( 'height', '0' );
                        } else {
@@ -81,7 +81,7 @@ jQuery( function ( $ ) {
 
        // Populate the prefToc
        $legends.each( function ( i, legend ) {
-               var $legend = $(legend),
+               var $legend = $( legend ),
                        ident, $li, $a;
                if ( i === 0 ) {
                        $legend.parent().show();
@@ -106,7 +106,7 @@ jQuery( function ( $ ) {
        } );
 
        // Enable keyboard users to use left and right keys to switch tabs
-       $preftoc.on( 'keydown', function( event ) {
+       $preftoc.on( 'keydown', function ( event ) {
                var keyLeft = 37,
                        keyRight = 39,
                        $el;
@@ -139,14 +139,14 @@ jQuery( function ( $ ) {
        if ( 'onhashchange' in window &&
                ( document.documentMode === undefined || document.documentMode >= 8 )
        ) {
-               $(window).on( 'hashchange' , function () {
+               $( window ).on( 'hashchange' , function () {
                        var hash = window.location.hash;
                        if ( hash.match( /^#mw-prefsection-[\w\-]+/ ) ) {
                                switchPrefTab( hash.replace( '#mw-prefsection-', '' ) );
                        } else if ( hash === '' ) {
                                switchPrefTab( 'personal', 'noHash' );
                        }
-               });
+               } );
        // In older browsers we'll bind a click handler as fallback.
        // We must not have onhashchange *and* the click handlers, other wise
        // the click handler calls switchPrefTab() which sets the hash value,
@@ -155,7 +155,7 @@ jQuery( function ( $ ) {
                $preftoc.on( 'click', 'li a', function ( e ) {
                        switchPrefTab( $( this ).attr( 'href' ).replace( '#mw-prefsection-', '' ) );
                        e.preventDefault();
-               });
+               } );
        }
 
        /**
index 035252b..b847f7d 100644 (file)
                }
 
                // Create check all/none button
-               $checkboxes = $('#powersearch input[id^=mw-search-ns]');
-               $('#mw-search-togglebox').append(
-                       $('<label>')
-                               .text(mw.msg('powersearch-togglelabel'))
+               $checkboxes = $( '#powersearch input[id^=mw-search-ns]' );
+               $( '#mw-search-togglebox' ).append(
+                       $( '<label>' )
+                               .text( mw.msg( 'powersearch-togglelabel' ) )
                ).append(
-                       $('<input type="button" />')
+                       $( '<input type="button" />' )
                                .attr( 'id', 'mw-search-toggleall' )
-                               .prop( 'value', mw.msg('powersearch-toggleall' ) )
+                               .prop( 'value', mw.msg( 'powersearch-toggleall' ) )
                                .click( function () {
-                                       $checkboxes.prop('checked', true);
+                                       $checkboxes.prop( 'checked', true );
                                } )
                ).append(
-                       $('<input type="button" />')
+                       $( '<input type="button" />' )
                                .attr( 'id', 'mw-search-togglenone' )
-                               .prop( 'value', mw.msg('powersearch-togglenone' ) )
-                               .click( function() {
+                               .prop( 'value', mw.msg( 'powersearch-togglenone' ) )
+                               .click( function () {
                                        $checkboxes.prop( 'checked', false );
                                } )
                );
                // Change the header search links to what user entered
                $headerLinks = $( '.search-types a' );
                $( '#searchText, #powerSearchText' ).change( function () {
-                       var searchterm = $(this).val();
+                       var searchterm = $( this ).val();
                        $headerLinks.each( function () {
-                               var parts = $(this).attr('href').split( 'search=' ),
+                               var parts = $( this ).attr( 'href' ).split( 'search=' ),
                                        lastpart = '',
                                        prefix = 'search=';
-                               if ( parts.length > 1 && parts[1].indexOf('&') >= 0 ) {
-                                       lastpart = parts[1].substring( parts[1].indexOf('&') );
+                               if ( parts.length > 1 && parts[1].indexOf( '&' ) >= 0 ) {
+                                       lastpart = parts[1].substring( parts[1].indexOf( '&' ) );
                                } else {
                                        prefix = '&search=';
                                }
                                this.href = parts[0] + prefix + encodeURIComponent( searchterm ) + lastpart;
-                       });
-               }).trigger( 'change' );
+                       } );
+               } ).trigger( 'change' );
 
        } );
 
index 3f40c54..4ee3de3 100644 (file)
@@ -57,7 +57,7 @@
                        thumb.find( '.filename' ).text( file.name ).end()
                                .find( '.fileinfo' ).text( prettySize( file.size ) ).end();
 
-                       $canvas = $('<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>');
+                       $canvas = $( '<canvas width="' + previewSize + '" height="' + previewSize + '" ></canvas>' );
                        ctx = $canvas[0].getContext( '2d' );
                        $( '#mw-htmlform-source' ).parent().prepend( thumb );
 
@@ -93,8 +93,8 @@
                                                width = img.width / img.height * previewSize;
                                        }
                                        // Determine the offset required to center the image
-                                       dx = (180 - width) / 2;
-                                       dy = (180 - height) / 2;
+                                       dx = ( 180 - width ) / 2;
+                                       dy = ( 180 - height ) / 2;
                                        switch ( rotation ) {
                                                // If a rotation is applied, the direction of the axis
                                                // changes as well. You can derive the values below by
                                        ctx.clearRect( 0, 0, 180, 180 );
                                        ctx.rotate( rotation / 180 * Math.PI );
                                        ctx.drawImage( img, x, y, width, height );
-                                       thumb.find('.mw-small-spinner').replaceWith($canvas);
+                                       thumb.find( '.mw-small-spinner' ).replaceWith( $canvas );
 
                                        // Image size
                                        info = mw.msg( 'widthheight', logicalWidth, logicalHeight ) +
                        if ( callbackBinary && 'readAsBinaryString' in reader ) {
                                // To fetch JPEG metadata we need a binary string; start there.
                                // todo:
-                               reader.onload = function() {
+                               reader.onload = function () {
                                        callbackBinary( reader.result );
 
                                        // Now run back through the regular code path.
                                // readAsArrayBuffer replaces readAsBinaryString
                                // However, our JPEG metadata library wants a string.
                                // So, this is going to be an ugly conversion.
-                               reader.onload = function() {
+                               reader.onload = function () {
                                        var i,
                                                buffer = new Uint8Array( reader.result ),
                                                string = '';
                }
 
                for ( i = $rows.length; i; i-- ) {
-                       $row = $rows.eq(i - 1);
+                       $row = $rows.eq( i - 1 );
                        $row
                                .find( 'input[name="wpSourceType"]' )
                                .change( createHandler( $row ) );
index 51770fd..32c3f1e 100644 (file)
 
                /**
                 * Example to declare existing titles:
-                *     Title.exist.set(['User:John_Doe', ...]);
+                *     Title.exist.set( ['User:John_Doe', ...] );
                 * Eample to declare titles nonexistent:
-                *     Title.exist.set(['File:Foo_bar.jpg', ...], false);
+                *     Title.exist.set( ['File:Foo_bar.jpg', ...], false );
                 *
                 * @static
                 * @property exist.set
index a1eed48..a750106 100644 (file)
                 */
                Uri.encode = function ( s ) {
                        return encodeURIComponent( s )
-                               .replace( /!/g, '%21').replace( /'/g, '%27').replace( /\(/g, '%28')
-                               .replace( /\)/g, '%29').replace( /\*/g, '%2A')
+                               .replace( /!/g, '%21' ).replace( /'/g, '%27' ).replace( /\(/g, '%28' )
+                               .replace( /\)/g, '%29' ).replace( /\*/g, '%2A' )
                                .replace( /%20/g, '+' );
                };
 
index 986917a..04cfbb0 100644 (file)
@@ -54,7 +54,7 @@
                 */
                switchPane: function ( e ) {
                        var currentPaneId = debug.$container.data( 'currentPane' ),
-                               requestedPaneId = $(this).prop( 'id' ).substr( 9 ),
+                               requestedPaneId = $( this ).prop( 'id' ).substr( 9 ),
                                $currentPane = $( '#mw-debug-pane-' + currentPaneId ),
                                $requestedPane = $( '#mw-debug-pane-' + requestedPaneId ),
                                hovDone = false;
@@ -69,8 +69,8 @@
                        // Skip hash fragment handling. Prevents screen from jumping.
                        e.preventDefault();
 
-                       $( this ).addClass( 'current ');
-                       $( '.mw-debug-panelink' ).not( this ).removeClass( 'current ');
+                       $( this ).addClass( 'current ' );
+                       $( '.mw-debug-panelink' ).not( this ).removeClass( 'current ' );
 
                        // Hide the current pane
                        if ( requestedPaneId === currentPaneId ) {
                         * @return {jQuery}
                         */
                        function bitDiv( id ) {
-                               return $( '<div>' ).prop({
+                               return $( '<div>' ).prop( {
                                        id: 'mw-debug-' + id,
                                        className: 'mw-debug-bit'
-                               })
+                               } )
                                .appendTo( $bits );
                        }
 
                         */
                        function paneLabel( id, text ) {
                                return $( '<a>' )
-                                       .prop({
+                                       .prop( {
                                                className: 'mw-debug-panelabel',
                                                href: '#mw-debug-pane-' + id
-                                       })
+                                       } )
                                        .text( text );
                        }
 
                                if ( count ) {
                                        text = text + ' (' + count + ')';
                                }
-                               return $( '<div>' ).prop({
+                               return $( '<div>' ).prop( {
                                        id: 'mw-debug-' + id,
                                        className: 'mw-debug-bit mw-debug-panelink'
-                               })
+                               } )
                                .append( paneLabel( id, text ) )
                                .appendTo( $bits );
                        }
                                }
 
                                $( '<div>' )
-                                       .prop({
+                                       .prop( {
                                                className: 'mw-debug-pane',
                                                id: 'mw-debug-pane-' + id
-                                       })
+                                       } )
                                        .append( panes[id] )
                                        .appendTo( $container );
                        }
index de06859..7315677 100644 (file)
@@ -11,9 +11,9 @@
         */
        $.fn.goIn = function ( instantToggle ) {
                if ( instantToggle === true ) {
-                       return $(this).show();
+                       return $( this ).show();
                }
-               return $(this).stop( true, true ).fadeIn();
+               return $( this ).stop( true, true ).fadeIn();
        };
 
        /**
@@ -24,9 +24,9 @@
         */
        $.fn.goOut = function ( instantToggle ) {
                if ( instantToggle === true ) {
-                       return $(this).hide();
+                       return $( this ).hide();
                }
-               return $(this).stop( true, true ).fadeOut();
+               return $( this ).stop( true, true ).fadeOut();
        };
 
        /**
@@ -35,8 +35,8 @@
         * @param {Function} callback Takes one parameter, which is {true} when the
         *  event is called immediately, and {jQuery.Event} when triggered from an event.
         */
-       $.fn.liveAndTestAtStart = function ( callback ){
-               $(this)
+       $.fn.liveAndTestAtStart = function ( callback ) {
+               $( this )
                        .live( 'change', callback )
                        .each( function () {
                                callback.call( this, true );
                // Animate the SelectOrOther fields, to only show the text field when
                // 'other' is selected.
                $( '.mw-htmlform-select-or-other' ).liveAndTestAtStart( function ( instant ) {
-                       var $other = $( '#' + $(this).attr( 'id' ) + '-other' );
+                       var $other = $( '#' + $( this ).attr( 'id' ) + '-other' );
                        $other = $other.add( $other.siblings( 'br' ) );
-                       if ( $(this).val() === 'other' ) {
+                       if ( $( this ).val() === 'other' ) {
                                $other.goIn( instant );
                        } else {
                                $other.goOut( instant );
                        }
-               });
+               } );
 
        } );
 
@@ -72,7 +72,7 @@
                        'class': 'htmlform-chzn-select mw-input ' + oldClass
                } );
                $oldContainer.find( 'input' ).each( function () {
-                       var $oldInput = $(this),
+                       var $oldInput = $( this ),
                        checked = $oldInput.prop( 'checked' ),
                        $option = $( '<option>' );
                        $option.prop( 'value', $oldInput.prop( 'value' ) );
index 70b9be9..3322ad9 100644 (file)
 
                /**
                 * N.B. replacements are variadic arguments or an array in second parameter. In other words:
-                *    somefunction(a, b, c, d)
+                *    somefunction( a, b, c, d )
                 * is equivalent to
-                *    somefunction(a, [b, c, d])
+                *    somefunction( a, [b, c, d] )
                 *
                 * @param {string} key Message key.
                 * @param {Array|mixed} replacements Optional variable replacements (variadically or an array).
                var failableParserFn = getFailableParserFn( options );
                /**
                 * N.B. replacements are variadic arguments or an array in second parameter. In other words:
-                *    somefunction(a, b, c, d)
+                *    somefunction( a, b, c, d )
                 * is equivalent to
-                *    somefunction(a, [b, c, d])
+                *    somefunction( a, [b, c, d] )
                 *
                 * We append to 'this', which in a jQuery plugin context will be the selected elements.
                 * @param {string} key Message key.
                        // This may be because, to save code, memoization was removed
 
                        regularLiteral = makeRegexParser( /^[^{}\[\]$<\\]/ );
-                       regularLiteralWithoutBar = makeRegexParser(/^[^{}\[\]$\\|]/);
-                       regularLiteralWithoutSpace = makeRegexParser(/^[^{}\[\]$\s]/);
+                       regularLiteralWithoutBar = makeRegexParser( /^[^{}\[\]$\\|]/ );
+                       regularLiteralWithoutSpace = makeRegexParser( /^[^{}\[\]$\s]/ );
                        regularLiteralWithSquareBrackets = makeRegexParser( /^[^{}$\\]/ );
 
                        backslash = makeStringParser( '\\' );
                        // Used to define "literals" without spaces, in space-delimited situations
                        function literalWithoutSpace() {
                                var result = nOrMore( 1, escapedOrLiteralWithoutSpace )();
-                               return result === null ? null : result.join('');
+                               return result === null ? null : result.join( '' );
                        }
                        // Used to define "literals" within template parameters. The pipe character is the parameter delimeter, so by default
                        // it is not a literal in the parameter
                        function literalWithoutBar() {
                                var result = nOrMore( 1, escapedOrLiteralWithoutBar )();
-                               return result === null ? null : result.join('');
+                               return result === null ? null : result.join( '' );
                        }
 
                        // Used for wikilink page names.  Like literalWithoutBar, but
                        // without allowing escapes.
                        function unescapedLiteralWithoutBar() {
                                var result = nOrMore( 1, regularLiteralWithoutBar )();
-                               return result === null ? null : result.join('');
+                               return result === null ? null : result.join( '' );
                        }
 
                        function literal() {
                                var result = nOrMore( 1, escapedOrRegularLiteral )();
-                               return result === null ? null : result.join('');
+                               return result === null ? null : result.join( '' );
                        }
 
                        function curlyBraceTransformExpressionLiteral() {
                                var result = nOrMore( 1, regularLiteralWithSquareBrackets )();
-                               return result === null ? null : result.join('');
+                               return result === null ? null : result.join( '' );
                        }
 
                        asciiAlphabetLiteral = makeRegexParser( /[A-Za-z]+/ );
                                        whitespace,
                                        asciiAlphabetLiteral,
                                        htmlAttributeEquals,
-                                       choice( [
+                                       choice( [
                                                doubleQuotedHtmlAttributeValue,
                                                singleQuotedHtmlAttributeValue
                                        ] )
                                endTagName = parsedCloseTagResult[1];
                                wrappedAttributes = parsedOpenTagResult[2];
                                attributes = wrappedAttributes.slice( 1 );
-                               if ( isAllowedHtml( startTagName, endTagName, attributes) ) {
+                               if ( isAllowedHtml( startTagName, endTagName, attributes ) ) {
                                        result = [ 'HTMLELEMENT', startTagName, wrappedAttributes ].concat( parsedHtmlContents );
                                } else {
                                        // HTML is not allowed, so contents will remain how
                                ] );
                                return result === null ? null : [ result[0], result[2] ];
                        }
-                       colon = makeStringParser(':');
+                       colon = makeStringParser( ':' );
                        templateContents = choice( [
                                function () {
                                        var res = sequence( [
                                        return [ res[0] ].concat( res[1] );
                                }
                        ] );
-                       openTemplate = makeStringParser('{{');
-                       closeTemplate = makeStringParser('}}');
+                       openTemplate = makeStringParser( '{{' );
+                       closeTemplate = makeStringParser( '}}' );
                        nonWhitespaceExpression = choice( [
                                template,
                                wikilink,
                 * Transform parsed structure into external link
                 * If the href is a jQuery object, treat it as "enclosing" the link text.
                 *              ... function, treat it as the click handler
-                *              ... string, treat it as a URI
+                *              ... string, treat it as a URI
                 * TODO: throw an error if nodes.length > 2 ?
                 * @param {Array} of two elements, {jQuery|Function|String} and {String}
                 * @return {jQuery}
                extlinkparam: function ( nodes, replacements ) {
                        var replacement,
                                index = parseInt( nodes[0], 10 );
-                       if ( index < replacements.length) {
+                       if ( index < replacements.length ) {
                                replacement = replacements[index];
                        } else {
                                replacement = '$' + ( index + 1 );
                plural: function ( nodes ) {
                        var forms, count;
                        count = parseFloat( this.language.convertNumber( nodes[0], true ) );
-                       forms = nodes.slice(1);
+                       forms = nodes.slice( 1 );
                        return forms.length ? this.language.convertPlural( count, forms ) : '';
                },
 
                // Caching is somewhat problematic, because we do need different message functions for different maps, so
                // we'd have to cache the parser as a member of this.map, which sounds a bit ugly.
                // Do not use mw.jqueryMsg unless required
-               if ( this.format === 'plain' || !/\{\{|[\[<>]/.test(this.map.get( this.key ) ) ) {
+               if ( this.format === 'plain' || !/\{\{|[\[<>]/.test( this.map.get( this.key ) ) ) {
                        // Fall back to mw.msg's simple parser
                        return oldParser.apply( this );
                }
index 86f06b8..a178e2b 100644 (file)
                                                .text( mw.msg( 'hidetoc' ) )
                                                .click( function ( e ) {
                                                        e.preventDefault();
-                                                       util.toggleToc( $(this) );
+                                                       util.toggleToc( $( this ) );
                                                } );
                                        $tocTitle.append(
                                                $tocToggleLink
                 * This function returns the styleSheet object for convience (due to cross-browsers
                 * difference as to where it is located).
                 *
-                *     var sheet = mw.util.addCSS('.foobar { display: none; }');
-                *     $(foo).click(function () {
+                *     var sheet = mw.util.addCSS( '.foobar { display: none; }' );
+                *     $( foo ).click( function () {
                 *         // Toggle the sheet on and off
                 *         sheet.disabled = !sheet.disabled;
-                *     });
+                *     } );
                 *
                 * @param {string} text CSS to be appended
                 * @return {CSSStyleSheet} Use .ownerNode to get to the `<style>` element.
                        // the ABNF:
                        //      1 * ( atext / "." ) "@" ldh-str 1*( "." ldh-str )
                        // With:
-                       // - atext      : defined in RFC 5322 section 3.2.3
+                       // - atext   : defined in RFC 5322 section 3.2.3
                        // - ldh-str : defined in RFC 1034 section 3.5
                        //
                        // (see STD 68 / RFC 5234 http://tools.ietf.org/html/std68)
                                // RegExp is case insensitive
                                'i'
                        );
-                       return (null !== mailtxt.match( html5EmailRegexp ) );
+                       return ( null !== mailtxt.match( html5EmailRegexp ) );
                },
 
                /**