Applying whitespace conventions in core JS files.
authorKrinkle <krinkle@users.mediawiki.org>
Fri, 12 Aug 2011 21:48:10 +0000 (21:48 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Fri, 12 Aug 2011 21:48:10 +0000 (21:48 +0000)
* Mostly whitespace in callers: $('foo').bar(baz,quux) => $( 'foo' ).bar( baz, quux )
* Also several occurrences of mixes spaces and tabs in the indention in front of a line, converted to tabs.
* And double spaces -> single spaces at random.

28 files changed:
resources/jquery/jquery.autoEllipsis.js
resources/jquery/jquery.byteLimit.js
resources/jquery/jquery.checkboxShiftClick.js
resources/jquery/jquery.client.js
resources/jquery/jquery.collapsibleTabs.js
resources/jquery/jquery.color.js
resources/jquery/jquery.makeCollapsible.js
resources/jquery/jquery.messageBox.js
resources/jquery/jquery.placeholder.js
resources/jquery/jquery.tabIndex.js
resources/jquery/jquery.tablesorter.js
resources/jquery/jquery.textSelection.js
resources/mediawiki.page/mediawiki.page.mwsuggest.js
resources/mediawiki.special/mediawiki.special.preferences.js
resources/mediawiki.special/mediawiki.special.recentchanges.js
resources/mediawiki.special/mediawiki.special.search.css
resources/mediawiki.special/mediawiki.special.upload.js
resources/mediawiki/mediawiki.htmlform.js
resources/mediawiki/mediawiki.title.js
tests/qunit/suites/resources/jquery/jquery.byteLength.test.js
tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js
tests/qunit/suites/resources/jquery/jquery.client.test.js
tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js
tests/qunit/suites/resources/jquery/jquery.tablesorter.test.js
tests/qunit/suites/resources/jquery/jquery.textSelection.test.js
tests/qunit/suites/resources/mediawiki.special/mediawiki.special.recentchanges.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.test.js
tests/qunit/suites/resources/mediawiki/mediawiki.util.test.js

index 7d72689..9a5fcc9 100644 (file)
@@ -25,7 +25,7 @@ $.fn.autoEllipsis = function( options ) {
                                $el.text( $el.data( 'autoEllipsis.originalText' ) );
                        }
                }
-               
+
                // container element - used for measuring against
                var $container = $el;
                // trimmable text element - only the text within this element will be trimmed
@@ -43,7 +43,7 @@ $.fn.autoEllipsis = function( options ) {
                                .empty()
                                .append( $trimmableText );
                }
-               
+
                var text = $container.text();
                var trimmableText = $trimmableText.text();
                var w = $container.width();
@@ -81,7 +81,7 @@ $.fn.autoEllipsis = function( options ) {
                                return;
                        }
                }
-               
+
                if ( $trimmableText.width() + pw > w ) {
                        switch ( options.position ) {
                                case 'right':
@@ -136,7 +136,7 @@ $.fn.autoEllipsis = function( options ) {
                } else {
                        cache[text][w][options.position] = $container.html();
                }
-               
+
        } );
 };
 
index 64ccb5c..1041192 100644 (file)
                        // Based on key-event info from http://unixpapa.com/js/key.html
                        // jQuery should also normalize e.which to be consistent cross-browser,
                        // however the same check is still needed regardless of jQuery.
-       
+
                        // Note: At the moment, for some older opera versions (~< 10.5)
                        // some special keys won't be recognized (aka left arrow key).
                        // Backspace will be, so not big issue.
-       
+
                        if ( e.which === 0 || e.charCode === 0 || e.which === 8 ||
                                e.ctrlKey || e.altKey || e.metaKey )
                        {
index 7fbc16b..0a1d7d7 100644 (file)
@@ -16,9 +16,9 @@ $.fn.checkboxShiftClick = function( text ) {
                if ( prevCheckbox !== null && e.shiftKey ) {
                        // Check or uncheck this one and all in-between checkboxes
                        $box.slice(
-                         Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
-                         Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
-                       ).prop( {checked: e.target.checked ? true : false} );
+                               Math.min( $box.index( prevCheckbox ), $box.index( e.target ) ),
+                               Math.max( $box.index( prevCheckbox ), $box.index( e.target ) ) + 1
+                       ).prop( 'checked', e.target.checked ? true : false );
                }
                // Either way, update the prevCheckbox variable to the one clicked now
                prevCheckbox = e.target;
index 8082fa7..ae74a32 100644 (file)
@@ -14,7 +14,7 @@
        /* Public Methods */
 
        $.client = {
-       
+
                /**
                 * Get an object containing information about the client.
                 *
                        }
                        // Use the cached version if possible
                        if ( profileCache[nav.userAgent] === undefined ) {
-       
+
                                /* Configuration */
-       
+
                                // Name of browsers or layout engines we don't recognize
                                var uk = 'unknown';
                                // Generic version digit
                                var x = 'x';
                                // Strings found in user agent strings that need to be conformed
-                               var wildUserAgents = [ 'Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3'];
+                               var wildUserAgents = ['Opera', 'Navigator', 'Minefield', 'KHTML', 'Chrome', 'PLAYSTATION 3'];
                                // Translations for conforming user agent strings
                                var userAgentTranslations = [
-                                   // Tons of browsers lie about being something they are not
+                                       // Tons of browsers lie about being something they are not
                                        [/(Firefox|MSIE|KHTML,\slike\sGecko|Konqueror)/, ''],
                                        // Chrome lives in the shadow of Safari still
                                        ['Chrome Safari', 'Chrome'],
@@ -86,9 +86,9 @@
                                var platforms = ['win', 'mac', 'linux', 'sunos', 'solaris', 'iphone'];
                                // Translations for conforming operating system names
                                var platformTranslations = [['sunos', 'solaris']];
-       
+
                                /* Methods */
-       
+
                                // Performs multiple replacements on a string
                                var translate = function( source, translations ) {
                                        for ( var i = 0; i < translations.length; i++ ) {
@@ -96,9 +96,9 @@
                                        }
                                        return source;
                                };
-       
-                               /* Pre-processing  */
-       
+
+                               /* Pre-processing */
+
                                var     ua = nav.userAgent,
                                        match,
                                        name = uk,
                                }
                                // Everything will be in lowercase from now on
                                ua = ua.toLowerCase();
-       
+
                                /* Extraction */
-       
+
                                if ( match = new RegExp( '(' + names.join( '|' ) + ')' ).exec( ua ) ) {
                                        name = translate( match[1], nameTranslations );
                                }
                                if ( match = new RegExp( '(' + versionPrefixes.join( '|' ) + ')' + versionSuffix ).exec( ua ) ) {
                                        version = match[3];
                                }
-       
+
                                /* Edge Cases -- did I mention about how user agent string lie? */
-       
+
                                // Decode Safari's crazy 400+ version numbers
                                if ( name.match( /safari/ ) && version > 400 ) {
                                        version = '2.0';
                                        version = ua.match( /version\/([0-9\.]*)/i )[1] || 10;
                                }
                                var versionNumber = parseFloat( version, 10 ) || 0.0;
-       
+
                                /* Caching */
-       
+
                                profileCache[nav.userAgent] = {
                                        'name': name,
                                        'layout': layout,
                        }
                        return profileCache[nav.userAgent];
                },
-       
+
                /**
                 * Checks the current browser against a support map object to determine if the browser has been black-listed or
                 * not. If the browser was not configured specifically it is assumed to work. It is assumed that the body
index b239972..1784f86 100644 (file)
@@ -7,7 +7,7 @@
                if( !this.length ) return this;
                //merge options into the defaults
                var $settings = $.extend( {}, $.collapsibleTabs.defaults, options );
-       
+
                this.each( function() {
                        var $this = $( this );
                        // add the element to our array of collapsible managers
@@ -20,7 +20,7 @@
                                $.collapsibleTabs.addData( $( this ) );
                        } );
                } );
-               
+
                // if we haven't already bound our resize hanlder, bind it now
                if( !$.collapsibleTabs.boundEvent ) {
                        $( window )
                        $.collapsibleTabs.instances.each( function() {
                                var $this = $( this ), data = $.collapsibleTabs.getSettings( $this );
                                if( data.shifting ) return;
-       
+
                                // if the two navigations are colliding
                                if( $this.children( data.collapsible ).length > 0 && data.collapseCondition() ) {
-                                       
+
                                        $this.trigger( "beforeTabCollapse" );
                                        // move the element to the dropdown menu
                                        $.collapsibleTabs.moveToCollapsed( $this.children( data.collapsible + ':last' ) );
                                }
-       
+
                                // if there are still moveable items in the dropdown menu,
                                // and there is sufficient space to place them in the tab container
                                if( $( data.collapsedContainer + ' ' + data.collapsible ).length > 0
index b041942..8a619b5 100644 (file)
@@ -15,7 +15,7 @@
                                        fx.start = getColor( fx.elem, attr );
                                        fx.end = $.colorUtil.getRGB( fx.end );
                                }
-               
+
                                fx.elem.style[attr] = 'rgb(' + [
                                        Math.max(Math.min( parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0]), 255), 0),
                                        Math.max(Math.min( parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1]), 255), 0),
@@ -24,7 +24,7 @@
                        }
                }
        );
-       
+
        function getColor(elem, attr) {
                var color;
 
 
                        // Keep going until we find an element that has color, or we hit the body
                        if ( color != '' && color != 'transparent' || $.nodeName(elem, 'body') )
-                               break; 
+                               break;
 
                        attr = 'backgroundColor';
                } while ( elem = elem.parentNode );
 
                return $.colorUtil.getRGB(color);
        };
-       
+
 } )( jQuery );
index d5b7638..7a1897c 100644 (file)
@@ -44,7 +44,7 @@ $.fn.makeCollapsible = function() {
                                        // After this $defaultToggle is either null or a valid jQuery instance.
                                        return;
                                }
-                               
+
                                var $containers = null;
 
                                if ( action == 'collapse' ) {
@@ -55,17 +55,17 @@ $.fn.makeCollapsible = function() {
                                                // Slide doens't work with tables, but fade does as of jQuery 1.1.3
                                                // http://stackoverflow.com/questions/467336#920480
                                                $containers = $collapsible.find( '>tbody>tr' );
-                                               if ( $defaultToggle ) { 
+                                               if ( $defaultToggle ) {
                                                        // Exclude tablerow containing togglelink
                                                        $containers.not( $defaultToggle.closest( 'tr' ) ).stop(true, true).fadeOut();
                                                } else {
-                                                       if ( instantHide ) {    
+                                                       if ( instantHide ) {
                                                                $containers.hide();
                                                        } else {
                                                                $containers.stop( true, true ).fadeOut();
                                                        }
                                                }
-       
+
                                        } else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) {
                                                $containers = $collapsible.find( '> li' );
                                                if ( $defaultToggle ) {
@@ -78,10 +78,10 @@ $.fn.makeCollapsible = function() {
                                                                $containers.stop( true, true ).slideUp();
                                                        }
                                                }
-       
+
                                        } else { // <div>, <p> etc.
                                                var $collapsibleContent = $collapsible.find( '> .mw-collapsible-content' );
-                                               
+
                                                // If a collapsible-content is defined, collapse it
                                                if ( $collapsibleContent.length ) {
                                                        if ( instantHide ) {
@@ -102,7 +102,7 @@ $.fn.makeCollapsible = function() {
                                        }
 
                                } else {
-                               
+
                                        // Expand the element
                                        if ( $collapsible.is( 'table' ) ) {
                                                $containers = $collapsible.find( '>tbody>tr' );
@@ -112,7 +112,7 @@ $.fn.makeCollapsible = function() {
                                                } else {
                                                        $containers.stop(true, true).fadeIn();
                                                }
-       
+
                                        } else if ( $collapsible.is( 'ul' ) || $collapsible.is( 'ol' ) ) {
                                                $containers = $collapsible.find( '> li' );
                                                if ( $defaultToggle ) {
@@ -121,10 +121,10 @@ $.fn.makeCollapsible = function() {
                                                } else {
                                                        $containers.stop( true, true ).slideDown();
                                                }
-       
+
                                        } else { // <div>, <p> etc.
                                                var $collapsibleContent = $collapsible.find( '> .mw-collapsible-content' );
-                                               
+
                                                // If a collapsible-content is defined, collapse it
                                                if ( $collapsibleContent.length ) {
                                                        $collapsibleContent.slideDown();
@@ -147,7 +147,7 @@ $.fn.makeCollapsible = function() {
                                        $collapsible = $that.closest( '.mw-collapsible.mw-made-collapsible' ).toggleClass( 'mw-collapsed' );
                                e.preventDefault();
                                e.stopPropagation();
-                               
+
                                // It's expanded right now
                                if ( !$that.hasClass( 'mw-collapsible-toggle-collapsed' ) ) {
                                        // Change link to "Show"
@@ -182,7 +182,7 @@ $.fn.makeCollapsible = function() {
                                }
                                e.preventDefault();
                                e.stopPropagation();
-                               
+
                                // It's expanded right now
                                if ( !$that.hasClass( 'mw-collapsible-toggle-collapsed' ) ) {
                                        // Change toggle to collapsed
@@ -210,7 +210,7 @@ $.fn.makeCollapsible = function() {
                                var action = $collapsible.hasClass( 'mw-collapsed' ) ? 'expand' : 'collapse';
                                $collapsible.toggleClass( 'mw-collapsed' );
                                toggleElement( $collapsible, action, $that );
-                               
+
                        };
 
                // Use custom text or default ?
@@ -239,7 +239,7 @@ $.fn.makeCollapsible = function() {
                } else {
                        $that.addClass( 'mw-made-collapsible' );
                }
-               
+
                // Check if this element has a custom position for the toggle link
                // (ie. outside the container or deeper inside the tree)
                // Then: Locate the custom toggle link(s) and bind them
@@ -248,7 +248,7 @@ $.fn.makeCollapsible = function() {
                        var thatId = $that.attr( 'id' ),
                                $customTogglers = $( '.' + thatId.replace( 'mw-customcollapsible', 'mw-customtoggle' ) );
                        mw.log( _fn + 'Found custom collapsible: #' + thatId );
-                                               
+
                        // Double check that there is actually a customtoggle link
                        if ( $customTogglers.length ) {
                                $customTogglers.bind( 'click.mw-collapse', function( e ) {
@@ -257,7 +257,7 @@ $.fn.makeCollapsible = function() {
                        } else {
                                mw.log( _fn + '#' + thatId + ': Missing toggler!' );
                        }
-                       
+
                        // Initial state
                        if ( $that.hasClass( 'mw-collapsed' ) ) {
                                $that.removeClass( 'mw-collapsed' );
@@ -265,7 +265,7 @@ $.fn.makeCollapsible = function() {
                        }
 
                // If this is not a custom case, do the default:
-               // Wrap the contents add the toggle link 
+               // Wrap the contents add the toggle link
                } else {
 
                        // Elements are treated differently
@@ -273,7 +273,7 @@ $.fn.makeCollapsible = function() {
                                // The toggle-link will be in one the the cells (td or th) of the first row
                                var     $firstRowCells = $( 'tr:first th, tr:first td', that ),
                                        $toggle = $firstRowCells.find( '> .mw-collapsible-toggle' );
-       
+
                                // If theres no toggle link, add it to the last cell
                                if ( !$toggle.length ) {
                                        $firstRowCells.eq(-1).prepend( $toggleLink );
@@ -282,19 +282,19 @@ $.fn.makeCollapsible = function() {
                                                toggleLinkPremade( $toggle, e );
                                        } );
                                }
-                               
+
                        } else if ( $that.is( 'ul' ) || $that.is( 'ol' ) ) {
                                // The toggle-link will be in the first list-item
                                var     $firstItem = $( 'li:first', $that),
                                        $toggle = $firstItem.find( '> .mw-collapsible-toggle' );
-       
+
                                // If theres no toggle link, add it
                                if ( !$toggle.length ) {
                                        // Make sure the numeral order doesn't get messed up, force the first (soon to be second) item
                                        // to be "1". Except if the value-attribute is already used.
                                        // If no value was set WebKit returns "", Mozilla returns '-1', others return null or undefined.
                                        var firstval = $firstItem.attr( 'value' );
-                                       if ( firstval === undefined || !firstval || firstval == '-1' ) { 
+                                       if ( firstval === undefined || !firstval || firstval == '-1' ) {
                                                $firstItem.attr( 'value', '1' );
                                        }
                                        $that.prepend( $toggleLink.wrap( '<li class="mw-collapsible-toggle-li"></li>' ).parent() );
@@ -303,9 +303,9 @@ $.fn.makeCollapsible = function() {
                                                toggleLinkPremade( $toggle, e );
                                        } );
                                }
-       
+
                        } else { // <div>, <p> etc.
-       
+
                                // The toggle-link will be the first child of the element
                                var $toggle = $that.find( '> .mw-collapsible-toggle' );
 
@@ -313,7 +313,7 @@ $.fn.makeCollapsible = function() {
                                if ( !$that.find( '> .mw-collapsible-content' ).length ) {
                                        $that.wrapInner( '<div class="mw-collapsible-content"></div>' );
                                }
-       
+
                                // If theres no toggle link, add it
                                if ( !$toggle.length ) {
                                        $that.prepend( $toggleLink );
index c59e29c..690fedd 100644 (file)
@@ -58,7 +58,7 @@ $.messageBox = function( options ) {
                'group': 'default',
                'replace': false, // if true replaces any previous message in this group
                'target': 'js-messagebox'
-       }, options );     
+       }, options );
        var $target = $.messageBoxNew( { id: options.target } );
        var groupID = options.target + '-' + options.group;
        var $group = $( '#' + groupID );
index 1bb69f0..8310cef 100644 (file)
@@ -46,7 +46,7 @@ $.fn.placeholder = function() {
                                                // text somewhere in the middle of the placeholder string,
                                                // we want to set the contents of the search box to the
                                                // dropped text.
-                                               
+
                                                // IE wants getData( 'text' ) but Firefox wants getData( 'text/plain' )
                                                // Firefox fails gracefully with an empty string, IE barfs with an error
                                                try {
@@ -56,7 +56,7 @@ $.fn.placeholder = function() {
                                                        // Got an exception, so use the IE way
                                                        this.value = e.originalEvent.dataTransfer.getData( 'text' );
                                                }
-                                               
+
                                                // On Firefox, drop fires after the dropped text has been inserted,
                                                // but on IE it fires before. If we don't prevent the default action,
                                                // IE will insert the dropped text twice.
index 062ff7d..75731d7 100644 (file)
@@ -4,7 +4,7 @@
 ( function( $ ) {
 /**
  * Finds the lowerst tabindex in use within a selection
- * 
+ *
  * @return number Lowest tabindex on the page
  */
 $.fn.firstTabIndex = function() {
@@ -29,7 +29,7 @@ $.fn.firstTabIndex = function() {
 
 /**
  * Finds the highest tabindex in use within a selection
- * 
+ *
  * @return number Highest tabindex on the page
  */
 $.fn.lastTabIndex = function() {
index 59a28ac..3470100 100644 (file)
 
                                                if ( firstTime ) {
                                                        firstTime = false;
-                                                       
+
                                                        // Legacy fix of .sortbottoms
                                                        // Wrap them inside inside a tfoot (because that's what they actually want to be) &
                                                        // Move them up one level in the DOM
                                                        var sortbottoms = $table.find('tr.sortbottom').wrap('<tfoot>');
                                                        sortbottoms.parents('table').append(sortbottoms.parent());
-                                                       
+
                                                        explodeRowspans( $table );
                                                        // try to auto detect column type, and store in tables config
                                                        table.config.parsers = buildParserCache( table, $headers );
index 5b3c833..fbdeb38 100644 (file)
@@ -54,7 +54,7 @@ getSelection: function() {
 encapsulateSelection: function( options ) {
        return this.each( function() {
                var pre = options.pre, post = options.post;
-               
+
                /**
                 * Check if the selected text is the same as the insert text
                 */
@@ -77,10 +77,10 @@ encapsulateSelection: function( options ) {
                                }
                        }
                }
-               
+
                /**
                 * Do the splitlines stuff.
-                * 
+                *
                 * Wrap each line of the selected text with pre and post
                 */
                function doSplitLines( selText, pre, post ) {
@@ -94,7 +94,7 @@ encapsulateSelection: function( options ) {
                        }
                        return insertText;
                }
-               
+
                var isSample = false;
                if ( this.style.display == 'none' ) {
                        // Do nothing
@@ -106,8 +106,8 @@ encapsulateSelection: function( options ) {
                        var endPos = this.selectionEnd;
                        var scrollTop = this.scrollTop;
                        checkSelectedText();
-                       
-                       var insertText = pre + selText  + post;
+
+                       var insertText = pre + selText + post;
                        if ( options.splitlines ) {
                                insertText = doSplitLines( selText, pre, post );
                        }
@@ -146,9 +146,9 @@ encapsulateSelection: function( options ) {
                        var selText = $(this).textSelection( 'getSelection' );
                        var scrollTop = this.scrollTop;
                        var range = document.selection.createRange();
-                       
+
                        checkSelectedText();
-                       var insertText = pre + selText  + post;
+                       var insertText = pre + selText + post;
                        if ( options.splitlines ) {
                                insertText = doSplitLines( selText, pre, post );
                        }
@@ -169,7 +169,7 @@ encapsulateSelection: function( options ) {
                                        post += "\n";
                                }
                        }
-                       
+
                        range.text = insertText;
                        if ( isSample && options.selectPeri && range.moveStart ) {
                                range.moveStart( 'character', - post.length - selText.length );
@@ -298,7 +298,7 @@ setSelection: function( options ) {
                        if ( newLines ) length = length - newLines.length;
                        selection.moveStart( 'character', options.start );
                        selection.moveEnd( 'character', -length + options.end );
-                       
+
                        // This line can cause an error under certain circumstances (textarea empty, no selection)
                        // Silence that error
                        try {
@@ -447,7 +447,7 @@ scrollToCaretPosition: function( options ) {
        }
        var context = $(this).data( 'wikiEditor-context' );
        var hasIframe = typeof context !== 'undefined' && context && typeof context.$iframe !== 'undefined';
-       
+
        // IE selection restore voodoo
        var needSave = false;
        if ( hasIframe && context.savedSelection !== null ) {
index 81d5042..9fad9d4 100644 (file)
@@ -4,7 +4,7 @@ jQuery( document ).ready( function( $ ) {
                $suggestionList,
                url = mw.util.wikiScript( 'api' ),
                maxRowWindow;
-       
+
        //Append the container which will hold the menu to the body
        $( 'body' ).append( $container );
 
index c04fbfa..ac0bc65 100644 (file)
@@ -22,13 +22,13 @@ $legends.each( function( i, legend ) {
                $legend.parent().show();
        }
        var ident = $legend.parent().attr( 'id' );
-       
+
        var $li = $( '<li/>', {
                'class' : ( i === 0 ) ? 'selected' : null
        });
        var $a = $( '<a/>', {
                text : $legend.text(),
-               id   : ident.replace('prefsection', 'preftab'),
+               id : ident.replace('prefsection', 'preftab'),
                href : '#' + ident
        }).click( function( e ) {
                e.preventDefault();
@@ -37,7 +37,7 @@ $legends.each( function( i, legend ) {
                var scrollTop = $(window).scrollTop();
                window.location.hash = $(this).attr('href');
                $(window).scrollTop(scrollTop);
-               
+
                $preftoc.find( 'li' ).removeClass( 'selected' );
                $(this).parent().addClass( 'selected' );
                $( '#preferences > fieldset' ).hide();
@@ -145,7 +145,7 @@ var updateTimezoneSelection = function() {
                $tzTextbox.val( minutesToHours( minuteDiff ) );
                $tzSelect.val( 'other' );
                $tzTextbox.get( 0 ).disabled = false;
-       } else if ( type == 'other'  ) {
+       } else if ( type == 'other' ) {
                // Grab data from the textbox, parse it.
                minuteDiff = hoursToMinutes( $tzTextbox.val() );
        } else {
index ed7ed37..3d520f5 100644 (file)
@@ -9,12 +9,12 @@
        var $select = null;
 
        var rc = mw.special.recentchanges = {
-       
+
                /**
                 * Handler to disable/enable the namespace selector checkboxes when the
                 * special 'all' namespace is selected/unselected respectively.
                 */
-               updateCheckboxes: function() {
+               updateCheckboxes: function() {
                        // The option element for the 'all' namespace has an empty value
                        var isAllNS = ('' === $select.find('option:selected').val() );
 
@@ -26,7 +26,7 @@
 
                init: function() {
                        // Populate
-                       $select = $( '#namespace' );
+                       $select = $( '#namespace' );
 
                        // Bind to change event, and trigger once to set the initial state of the checkboxes.
                        $select.change( rc.updateCheckboxes ).change();
index 89d55b0..914e47e 100644 (file)
@@ -1,10 +1,10 @@
 /**
- * Fixes sister projects box moving down the extract 
+ * Fixes sister projects box moving down the extract
  * of the first result (bug #16886).
- * It only happens when the window is small and 
- * This changes slightly the layout for big screens 
- * where there was space for the extracts and the 
- * sister projects and thus it showed like in any 
+ * It only happens when the window is small and
+ * This changes slightly the layout for big screens
+ * where there was space for the extracts and the
+ * sister projects and thus it showed like in any
  * other browser.
  *
  * This will only affect IE 7 and lower
index f9d354a..5a7e20e 100644 (file)
@@ -51,12 +51,12 @@ jQuery( function( $ ) {
                                        '</div>' );
                thumb.find( '.filename' ).text( file.name ).end()
                        .find( '.fileinfo' ).text( prettySize( file.size ) ).end();
-               
+
                var     ctx = thumb.find( 'canvas' )[0].getContext( '2d' ),
                        spinner = new Image();
-               spinner.onload = function() { 
-                       ctx.drawImage( spinner, (previewSize - spinner.width) / 2, 
-                                       (previewSize - spinner.height) / 2 ); 
+               spinner.onload = function() {
+                       ctx.drawImage( spinner, (previewSize - spinner.width) / 2,
+                                       (previewSize - spinner.height) / 2 );
                };
                spinner.src = mw.config.get( 'wgScriptPath' ) + '/skins/common/images/spinner.gif';
                $( '#mw-htmlform-source' ).parent().prepend( thumb );
@@ -65,7 +65,7 @@ jQuery( function( $ ) {
                fetchPreview( file, function( dataURL ) {
                        var     img = new Image(),
                                rotation = 0;
-                       
+
                        if ( meta && meta.tiff && meta.tiff.Orientation ) {
                                rotation = (360 - function () {
                                        // See includes/media/Bitmap.php
@@ -81,7 +81,7 @@ jQuery( function( $ ) {
                                        }
                                }() ) % 360;
                        }
-                       
+
                        img.onload = function() {
                                var width, height, x, y, dx, dy;
                                // Fit the image within the previewSizexpreviewSize box
@@ -97,7 +97,7 @@ jQuery( function( $ ) {
                                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 
+                                       // changes as well. You can derive the values below by
                                        // drawing on paper an axis system, rotate it and see
                                        // where the positive axis direction is
                                        case 0:
@@ -105,7 +105,7 @@ jQuery( function( $ ) {
                                                y = dy;
                                                break;
                                        case 90:
-                                               
+
                                                x = dx;
                                                y = dy - previewSize;
                                                break;
@@ -118,11 +118,11 @@ jQuery( function( $ ) {
                                                y = dy;
                                                break;
                                }
-                               
+
                                ctx.clearRect( 0, 0, 180, 180 );
                                ctx.rotate( rotation / 180 * Math.PI );
                                ctx.drawImage( img, x, y, width, height );
-                               
+
                                // Image size
                                var info = mw.msg( 'widthheight', img.width, img.height ) +
                                        ', ' + prettySize( file.size );
@@ -191,7 +191,7 @@ jQuery( function( $ ) {
        function clearPreview() {
                $( '#mw-upload-thumbnail' ).remove();
        }
-       
+
        /**
         * Check if the file does not exceed the maximum size
         */
@@ -204,18 +204,18 @@ jQuery( function( $ ) {
                        return sizes['*'];
                }
                $( '.mw-upload-source-error' ).remove();
-               
-               var maxSize = getMaxUploadSize( 'file' ); 
+
+               var maxSize = getMaxUploadSize( 'file' );
                if ( file.size > maxSize ) {
-                       var error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' + 
+                       var error = $( '<p class="error mw-upload-source-error" id="wpSourceTypeFile-error">' +
                                        mw.message( 'largefileserver', file.size, maxSize ).escaped() + '</p>' );
                        $( '#wpUploadFile' ).after( error );
                        return false;
                }
                return true;
        }
-       
-       
+
+
        /**
         * Initialization
         */
@@ -226,11 +226,11 @@ jQuery( function( $ ) {
                        if ( this.files && this.files.length ) {
                                // Note: would need to be updated to handle multiple files.
                                var file = this.files[0];
-                               
+
                                if ( !checkMaxUploadSize( file ) ) {
                                        return;
                                }
-                               
+
                                if ( fileIsPreviewable( file ) ) {
                                        showPreview( file );
                                }
index 24c8e43..17a02cf 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * Utility functions for jazzing up HTMLForm elements
  */
-( function( $ ) { 
+( function( $ ) {
 
 /**
  * jQuery plugin to fade or snap to visible state.
index 34f85ab..b69c0b0 100644 (file)
@@ -163,7 +163,7 @@ var Title = function( title, namespace ) {
                }
                return title;
        };
-        
+
 
        /* Static space */
 
index 27913c6..68a08b9 100644 (file)
@@ -25,7 +25,7 @@ test( 'Simple text', function() {
 test( 'Special text', window.foo = function() {
        expect(5);
 
-       // http://en.wikipedia.org/wiki/UTF-8 
+       // http://en.wikipedia.org/wiki/UTF-8
        var     U_0024 = '\u0024',
                U_00A2 = '\u00A2',
                U_20AC = '\u20AC',
index 704740d..7e28c72 100644 (file)
@@ -82,9 +82,7 @@ var
 byteLimitTest({
        description: 'Plain text input',
        $input: $( '<input>' )
-               .attr( {
-                       'type': 'text'
-               }),
+               .attr( 'type', 'text' ),
        sample: simpleSample,
        hasLimit: false,
        expected: simpleSample
@@ -105,9 +103,7 @@ byteLimitTest({
 byteLimitTest({
        description: 'Limit using a custom value',
        $input: $( '<input>' )
-               .attr( {
-                       'type': 'text'
-               })
+               .attr( 'type', 'text' )
                .byteLimit( 10 ),
        sample: simpleSample,
        hasLimit: true,
@@ -130,9 +126,7 @@ byteLimitTest({
 byteLimitTest({
        description: 'Limit using a custom value (multibyte)',
        $input: $( '<input>' )
-               .attr( {
-                       'type': 'text'
-               })
+               .attr( 'type', 'text' )
                .byteLimit( 14 ),
        sample: mbSample,
        hasLimit: true,
@@ -143,9 +137,7 @@ byteLimitTest({
 byteLimitTest({
        description: 'Limit using a custom value (multibyte) overlapping a byte',
        $input: $( '<input>' )
-               .attr( {
-                       'type': 'text'
-               })
+               .attr( 'type', 'text' )
                .byteLimit( 12 ),
        sample: mbSample,
        hasLimit: true,
@@ -156,9 +148,7 @@ byteLimitTest({
 byteLimitTest({
        description: 'Pass the limit and a callback as input filter',
        $input: $( '<input>' )
-               .attr( {
-                       'type': 'text'
-               })
+               .attr( 'type', 'text' )
                .byteLimit( 6, function( val ) {
                        _titleConfig();
 
index 116a1f0..fb0e0ec 100644 (file)
@@ -70,7 +70,7 @@ test( 'profile userAgent support', function() {
                                "version": "4.0.1",
                                "versionBase": "4",
                                "versionNumber": 4
-                       } 
+                       }
                },
                // Firefox 5
                // Safari 3
@@ -86,7 +86,7 @@ test( 'profile userAgent support', function() {
                                "version": "4.0.5",
                                "versionBase": "4",
                                "versionNumber": 4
-                       } 
+                       }
                },
                'Mozilla/5.0 (Windows; U; Windows NT 6.0; cs-CZ) AppleWebKit/533.21.1 (KHTML, like Gecko) Version/4.0.5 Safari/531.22.7': {
                        title: 'Safari 4',
index 09e981e..b846b53 100644 (file)
@@ -4,7 +4,7 @@ test( 'String functions', function() {
 
        equal( $.trimLeft( '  foo bar  ' ), 'foo bar  ', 'trimLeft' );
        equal( $.trimRight( '  foo bar  ' ), '  foo bar', 'trimRight' );
-       equal( $.ucFirst( 'foo'), 'Foo', 'ucFirst' );
+       equal( $.ucFirst( 'foo' ), 'Foo', 'ucFirst' );
 
        equal( $.escapeRE( '<!-- ([{+mW+}]) $^|?>' ),
         '<!\\-\\- \\(\\[\\{\\+mW\\+\\}\\]\\) \\$\\^\\|\\?>', 'escapeRE - Escape specials' );
index 556cb10..e075b2d 100644 (file)
@@ -3,9 +3,9 @@
 module( 'jquery.tablesorter' );
 
 // setup hack
-mw.config.set('wgMonthNames', window.wgMonthNames = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
-mw.config.set('wgMonthNamesShort', window.wgMonthNamesShort = ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
-mw.config.set('wgDefaultDateFormat', window.wgDefaultDateFormat = 'dmy');
+mw.config.set( 'wgMonthNames', window.wgMonthNames = ['', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']);
+mw.config.set( 'wgMonthNamesShort', window.wgMonthNamesShort = ['', 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']);
+mw.config.set( 'wgDefaultDateFormat', window.wgDefaultDateFormat = 'dmy' );
 
 test( '-- Initial check', function() {
        expect(1);
@@ -21,23 +21,23 @@ test( '-- Initial check', function() {
  * @return jQuery
  */
 var tableCreate = function( header, data ) {
-       var $table = $('<table class="sortable"><thead></thead><tbody></tbody></table>'),
-               $thead = $table.find('thead'),
-               $tbody = $table.find('tbody');
-       var $tr = $('<tr>');
-       $.each(header, function(i, str) {
-               var $th = $('<th>');
-               $th.text(str).appendTo($tr);
+       var $table = $( '<table class="sortable"><thead></thead><tbody></tbody></table>' ),
+               $thead = $table.find( 'thead' ),
+               $tbody = $table.find( 'tbody' );
+       var $tr = $( '<tr>' );
+       $.each( header, function( i, str ) {
+               var $th = $( '<th>' );
+               $th.text( str ).appendTo( $tr );
        });
-       $tr.appendTo($thead);
+       $tr.appendTo( $thead );
 
        for (var i = 0; i < data.length; i++) {
-               $tr = $('<tr>');
-               $.each(data[i], function(j, str) {
-                       var $td = $('<td>');
-                       $td.text(str).appendTo($tr);
+               $tr = $( '<tr>' );
+               $.each( data[i], function( j, str ) {
+                       var $td = $( '<td>' );
+                       $td.text( str ).appendTo( $tr );
                });
-               $tr.appendTo($tbody);
+               $tr.appendTo( $tbody );
        }
        return $table;
 };
@@ -50,12 +50,12 @@ var tableCreate = function( header, data ) {
  */
 var tableExtract = function( $table ) {
        var data = [];
-       $table.find('tbody').find('tr').each(function(i, tr) {
+       $table.find( 'tbody' ).find( 'tr' ).each( function( i, tr ) {
                var row = [];
-               $(tr).find('td,th').each(function(i, td) {
-                       row.push($(td).text());
+               $( tr ).find( 'td,th' ).each( function( i, td ) {
+                       row.push( $( td ).text() );
                });
-               data.push(row);
+               data.push( row );
        });
        return data;
 };
@@ -75,7 +75,7 @@ var tableTest = function( msg, header, data, expected, callback ) {
                expect(1);
 
                var $table = tableCreate( header, data );
-               //$('body').append($table);
+               //$( 'body' ).append($table);
 
                // Give caller a chance to set up sorting and manipulate the table.
                callback( $table );
@@ -114,7 +114,7 @@ tableTest(
        ascendingName,
        function( $table ) {
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 tableTest(
@@ -124,7 +124,7 @@ tableTest(
        ascendingName,
        function( $table ) {
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 tableTest(
@@ -134,7 +134,7 @@ tableTest(
        reversed(ascendingName),
        function( $table ) {
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click().click();
+               $table.find( '.headerSort:eq(0)' ).click().click();
        }
 );
 tableTest(
@@ -144,7 +144,7 @@ tableTest(
        ascendingRadius,
        function( $table ) {
                $table.tablesorter();
-               $table.find('.headerSort:eq(1)').click();
+               $table.find( '.headerSort:eq(1)' ).click();
        }
 );
 tableTest(
@@ -154,7 +154,7 @@ tableTest(
        reversed(ascendingRadius),
        function( $table ) {
                $table.tablesorter();
-               $table.find('.headerSort:eq(1)').click().click();
+               $table.find( '.headerSort:eq(1)' ).click().click();
        }
 );
 
@@ -181,9 +181,9 @@ tableTest(
        ],
        function( $table ) {
                // @fixme reset it at end or change module to allow us to override it
-               mw.config.set('wgDefaultDateFormat', window.wgDefaultDateFormat = 'dmy');
+               mw.config.set( 'wgDefaultDateFormat', window.wgDefaultDateFormat = 'dmy' );
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 tableTest(
@@ -207,9 +207,9 @@ tableTest(
        ],
        function( $table ) {
                // @fixme reset it at end or change module to allow us to override it
-               mw.config.set('wgDefaultDateFormat', window.wgDefaultDateFormat = 'mdy');
+               mw.config.set( 'wgDefaultDateFormat', window.wgDefaultDateFormat = 'mdy' );
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 
@@ -242,7 +242,7 @@ tableTest(
        ipv4Sorted,
        function( $table ) {
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 tableTest(
@@ -252,7 +252,7 @@ tableTest(
        reversed(ipv4Sorted),
        function( $table ) {
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click().click();
+               $table.find( '.headerSort:eq(0)' ).click().click();
        }
 );
 
@@ -286,10 +286,10 @@ tableTest(
        umlautWords,
        umlautWordsSorted,
        function( $table ) {
-               mw.config.set('tableSorterCollation', {'ä':'ae', 'ö' : 'oe', 'ß': 'ss', 'ü':'ue'});
+               mw.config.set( 'tableSorterCollation', {'ä':'ae', 'ö' : 'oe', 'ß': 'ss', 'ü':'ue'});
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
-               mw.config.set('tableSorterCollation', {});
+               $table.find( '.headerSort:eq(0)' ).click();
+               mw.config.set( 'tableSorterCollation', {} );
        }
 );
 
@@ -303,10 +303,10 @@ tableTest(
        planetsRowspan,
        function( $table ) {
                //Quick&Dirty mod
-               $table.find('tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)').remove();
-               $table.find('tr:eq(2) td:eq(1)').prop('rowspan', '3');
+               $table.find( 'tr:eq(3) td:eq(1), tr:eq(4) td:eq(1)' ).remove();
+               $table.find( 'tr:eq(2) td:eq(1)' ).prop( 'rowspan', '3' );
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 tableTest(
@@ -316,10 +316,10 @@ tableTest(
        planetsRowspanII,
        function( $table ) {
                //Quick&Dirty mod
-               $table.find('tr:eq(3) td:eq(0), tr:eq(4) td:eq(0)').remove();
-               $table.find('tr:eq(2) td:eq(0)').prop('rowspan', '3');
+               $table.find( 'tr:eq(3) td:eq(0), tr:eq(4) td:eq(0)' ).remove();
+               $table.find( 'tr:eq(2) td:eq(0)' ).prop( 'rowspan', '3' );
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 
@@ -346,9 +346,9 @@ tableTest(
        complexMDYDates,
        complexMDYSorted,
        function( $table ) {
-               mw.config.set('wgDefaultDateFormat', window.wgDefaultDateFormat = 'mdy');
+               mw.config.set( 'wgDefaultDateFormat', window.wgDefaultDateFormat = 'mdy' );
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 
@@ -362,9 +362,9 @@ tableTest(
        planets,
        ascendingNameLegacy,
        function( $table ) {
-               $table.find('tr:last').addClass('sortbottom');
+               $table.find( 'tr:last' ).addClass( 'sortbottom' );
                $table.tablesorter();
-               $table.find('.headerSort:eq(0)').click();
+               $table.find( '.headerSort:eq(0)' ).click();
        }
 );
 
index cea91c8..132da27 100644 (file)
@@ -6,7 +6,7 @@ test( '-- Initial check', function() {
 } );
 
 /**
- * Test factory for $.fn.textSelection('encapsulateText')
+ * Test factory for $.fn.textSelection( 'encapsulateText' )
  *
  * @param options {object} associative array containing:
  *   description {string}
@@ -14,7 +14,7 @@ test( '-- Initial check', function() {
  *   output {string}
  *   start {int} starting char for selection
  *   end {int} ending char for selection
- *   params {object} add'l parameters for $().textSelection('encapsulateText')
+ *   params {object} add'l parameters for $().textSelection( 'encapsulateText' )
  */
 var encapsulateTest = function( options ) {
        var opt = $.extend({
@@ -41,11 +41,11 @@ var encapsulateTest = function( options ) {
                }
                expect(tests);
 
-               var $fixture = $('<div id="qunit-fixture"></div>');
-               var $textarea = $('<textarea>');
+               var $fixture = $( '<div id="qunit-fixture"></div>' );
+               var $textarea = $( '<textarea>' );
 
                $fixture.append($textarea);
-               $('body').append($fixture);
+               $( 'body' ).append($fixture);
 
                //$textarea.textSelection( 'setContents', opt.before.text); // this method is actually missing atm...
                $textarea.val( opt.before.text ); // won't work with the WikiEditor iframe?
index fee2223..e959d4b 100644 (file)
@@ -2,12 +2,8 @@ module( 'mediawiki.special.recentchanges' );
 
 test( '-- Initial check', function() {
        expect( 2 );
-       ok( mw.special.recentchanges.init,
-          'mw.special.recentchanges.init defined'
-         );
-       ok( mw.special.recentchanges.updateCheckboxes,
-          'mw.special.recentchanges.updateCheckboxes defined'
-         );
+       ok( mw.special.recentchanges.init, 'mw.special.recentchanges.init defined' );
+       ok( mw.special.recentchanges.updateCheckboxes, 'mw.special.recentchanges.updateCheckboxes defined' );
        // TODO: verify checkboxes == [ 'nsassociated', 'nsinvert' ]
 });
 
@@ -61,7 +57,7 @@ test( '"all" namespace disable checkboxes', function() {
        $options.eq(1).removeProp( 'selected' );
        $options.eq(0).prop( 'selected', true );
        $( '#namespace' ).change();
-       
+
        // ... and checkboxes should now be disabled
        strictEqual( $( '#nsinvert' ).prop( 'disabled' ), true );
        strictEqual( $( '#nsassociated' ).prop( 'disabled' ), true );
index 4a87782..c19066f 100644 (file)
@@ -159,7 +159,7 @@ test( 'mw.loader', function() {
        // Extract path
        var tests_path = rePath.exec( location.href );
 
-       mw.loader.implement( 'is.awesome', [QUnit.fixurl( tests_path + 'data/defineTestCallback.js')], {}, {} );
+       mw.loader.implement( 'is.awesome', [QUnit.fixurl( tests_path + 'data/defineTestCallback.js' )], {}, {} );
 
        mw.loader.using( 'is.awesome', function() {
 
index db78f7c..d88b273 100644 (file)
@@ -157,7 +157,7 @@ test( 'addPortletLink', function() {
        var     tbMW = mw.util.addPortletLink( 'p-tb', 'http://mediawiki.org/',
                        'MediaWiki.org', 't-mworg', 'Go to MediaWiki.org ', 'm', tbRL ),
                $tbMW = $( tbMW );
-               
+
 
        equal( $tbMW.attr( 'id' ), 't-mworg', 'Link has correct ID set' );
        equal( $tbMW.closest( '.portlet' ).attr( 'id' ), 'p-tb', 'Link was inserted within correct portlet' );
@@ -172,7 +172,7 @@ test( 'addPortletLink', function() {
 
        strictEqual( $tbMW.find( 'span').length, 0, 'No <span> element should be added for porlets without vectorTabs class.' );
        strictEqual( $( caFoo ).find( 'span').length, 1, 'A <span> element should be added for porlets with vectorTabs class.' );
-       
+
        // Clean up
        $( [tbRL, tbMW, tbRLDM, caFoo] )
                .add( $mwPanel )