From 0e82a6cfd0ed3822d2fff336669336abfa5e14e3 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Fri, 12 Aug 2011 21:48:10 +0000 Subject: [PATCH] Applying whitespace conventions in core JS files. * 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. --- resources/jquery/jquery.autoEllipsis.js | 8 +- resources/jquery/jquery.byteLimit.js | 4 +- resources/jquery/jquery.checkboxShiftClick.js | 6 +- resources/jquery/jquery.client.js | 34 +++---- resources/jquery/jquery.collapsibleTabs.js | 10 +-- resources/jquery/jquery.color.js | 8 +- resources/jquery/jquery.makeCollapsible.js | 48 +++++----- resources/jquery/jquery.messageBox.js | 2 +- resources/jquery/jquery.placeholder.js | 4 +- resources/jquery/jquery.tabIndex.js | 4 +- resources/jquery/jquery.tablesorter.js | 4 +- resources/jquery/jquery.textSelection.js | 22 ++--- .../mediawiki.page.mwsuggest.js | 2 +- .../mediawiki.special.preferences.js | 8 +- .../mediawiki.special.recentchanges.js | 6 +- .../mediawiki.special.search.css | 10 +-- .../mediawiki.special.upload.js | 36 ++++---- resources/mediawiki/mediawiki.htmlform.js | 2 +- resources/mediawiki/mediawiki.title.js | 2 +- .../jquery/jquery.byteLength.test.js | 2 +- .../resources/jquery/jquery.byteLimit.test.js | 20 ++--- .../resources/jquery/jquery.client.test.js | 4 +- .../jquery/jquery.mwExtension.test.js | 2 +- .../jquery/jquery.tablesorter.test.js | 90 +++++++++---------- .../jquery/jquery.textSelection.test.js | 10 +-- .../mediawiki.special.recentchanges.test.js | 10 +-- .../resources/mediawiki/mediawiki.test.js | 2 +- .../mediawiki/mediawiki.util.test.js | 4 +- 28 files changed, 175 insertions(+), 189 deletions(-) diff --git a/resources/jquery/jquery.autoEllipsis.js b/resources/jquery/jquery.autoEllipsis.js index 7d7268942f..9a5fcc9c00 100644 --- a/resources/jquery/jquery.autoEllipsis.js +++ b/resources/jquery/jquery.autoEllipsis.js @@ -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(); } - + } ); }; diff --git a/resources/jquery/jquery.byteLimit.js b/resources/jquery/jquery.byteLimit.js index 64ccb5cc13..10411924c9 100644 --- a/resources/jquery/jquery.byteLimit.js +++ b/resources/jquery/jquery.byteLimit.js @@ -61,11 +61,11 @@ // 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 ) { diff --git a/resources/jquery/jquery.checkboxShiftClick.js b/resources/jquery/jquery.checkboxShiftClick.js index 7fbc16b57a..0a1d7d7d13 100644 --- a/resources/jquery/jquery.checkboxShiftClick.js +++ b/resources/jquery/jquery.checkboxShiftClick.js @@ -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; diff --git a/resources/jquery/jquery.client.js b/resources/jquery/jquery.client.js index 8082fa7d20..ae74a32411 100644 --- a/resources/jquery/jquery.client.js +++ b/resources/jquery/jquery.client.js @@ -14,7 +14,7 @@ /* Public Methods */ $.client = { - + /** * Get an object containing information about the client. * @@ -37,18 +37,18 @@ } // 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, @@ -113,9 +113,9 @@ } // 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 ); } @@ -131,9 +131,9 @@ 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'; @@ -143,9 +143,9 @@ version = ua.match( /version\/([0-9\.]*)/i )[1] || 10; } var versionNumber = parseFloat( version, 10 ) || 0.0; - + /* Caching */ - + profileCache[nav.userAgent] = { 'name': name, 'layout': layout, @@ -158,7 +158,7 @@ } 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 diff --git a/resources/jquery/jquery.collapsibleTabs.js b/resources/jquery/jquery.collapsibleTabs.js index b239972760..1784f86ab5 100644 --- a/resources/jquery/jquery.collapsibleTabs.js +++ b/resources/jquery/jquery.collapsibleTabs.js @@ -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 ) @@ -70,15 +70,15 @@ $.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 diff --git a/resources/jquery/jquery.color.js b/resources/jquery/jquery.color.js index b0419428ec..8a619b5cc8 100644 --- a/resources/jquery/jquery.color.js +++ b/resources/jquery/jquery.color.js @@ -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; @@ -33,12 +33,12 @@ // 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 ); diff --git a/resources/jquery/jquery.makeCollapsible.js b/resources/jquery/jquery.makeCollapsible.js index d5b76382ee..7a1897ce54 100644 --- a/resources/jquery/jquery.makeCollapsible.js +++ b/resources/jquery/jquery.makeCollapsible.js @@ -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 { //
,

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 { //

,

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( '

  • ' ).parent() ); @@ -303,9 +303,9 @@ $.fn.makeCollapsible = function() { toggleLinkPremade( $toggle, e ); } ); } - + } else { //
    ,

    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( '

    ' ); } - + // If theres no toggle link, add it if ( !$toggle.length ) { $that.prepend( $toggleLink ); diff --git a/resources/jquery/jquery.messageBox.js b/resources/jquery/jquery.messageBox.js index c59e29c5e4..690fedd28d 100644 --- a/resources/jquery/jquery.messageBox.js +++ b/resources/jquery/jquery.messageBox.js @@ -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 ); diff --git a/resources/jquery/jquery.placeholder.js b/resources/jquery/jquery.placeholder.js index 1bb69f0046..8310cef95e 100644 --- a/resources/jquery/jquery.placeholder.js +++ b/resources/jquery/jquery.placeholder.js @@ -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. diff --git a/resources/jquery/jquery.tabIndex.js b/resources/jquery/jquery.tabIndex.js index 062ff7d3a2..75731d7cee 100644 --- a/resources/jquery/jquery.tabIndex.js +++ b/resources/jquery/jquery.tabIndex.js @@ -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() { diff --git a/resources/jquery/jquery.tablesorter.js b/resources/jquery/jquery.tablesorter.js index 59a28ace58..3470100a44 100644 --- a/resources/jquery/jquery.tablesorter.js +++ b/resources/jquery/jquery.tablesorter.js @@ -539,13 +539,13 @@ 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(''); 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 ); diff --git a/resources/jquery/jquery.textSelection.js b/resources/jquery/jquery.textSelection.js index 5b3c833c76..fbdeb38898 100644 --- a/resources/jquery/jquery.textSelection.js +++ b/resources/jquery/jquery.textSelection.js @@ -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 ) { diff --git a/resources/mediawiki.page/mediawiki.page.mwsuggest.js b/resources/mediawiki.page/mediawiki.page.mwsuggest.js index 81d50428c5..9fad9d458d 100644 --- a/resources/mediawiki.page/mediawiki.page.mwsuggest.js +++ b/resources/mediawiki.page/mediawiki.page.mwsuggest.js @@ -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 ); diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js index c04fbfa0ce..ac0bc65780 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -22,13 +22,13 @@ $legends.each( function( i, legend ) { $legend.parent().show(); } var ident = $legend.parent().attr( 'id' ); - + var $li = $( '
  • ', { 'class' : ( i === 0 ) ? 'selected' : null }); var $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 { diff --git a/resources/mediawiki.special/mediawiki.special.recentchanges.js b/resources/mediawiki.special/mediawiki.special.recentchanges.js index ed7ed37558..3d520f5e5f 100644 --- a/resources/mediawiki.special/mediawiki.special.recentchanges.js +++ b/resources/mediawiki.special/mediawiki.special.recentchanges.js @@ -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(); diff --git a/resources/mediawiki.special/mediawiki.special.search.css b/resources/mediawiki.special/mediawiki.special.search.css index 89d55b0b5b..914e47e341 100644 --- a/resources/mediawiki.special/mediawiki.special.search.css +++ b/resources/mediawiki.special/mediawiki.special.search.css @@ -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 diff --git a/resources/mediawiki.special/mediawiki.special.upload.js b/resources/mediawiki.special/mediawiki.special.upload.js index f9d354af45..5a7e20ec4f 100644 --- a/resources/mediawiki.special/mediawiki.special.upload.js +++ b/resources/mediawiki.special/mediawiki.special.upload.js @@ -51,12 +51,12 @@ jQuery( function( $ ) { '
  • ' ); 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 = $( '

    ' + + var error = $( '

    ' + mw.message( 'largefileserver', file.size, maxSize ).escaped() + '

    ' ); $( '#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 ); } diff --git a/resources/mediawiki/mediawiki.htmlform.js b/resources/mediawiki/mediawiki.htmlform.js index 24c8e43751..17a02cf461 100644 --- a/resources/mediawiki/mediawiki.htmlform.js +++ b/resources/mediawiki/mediawiki.htmlform.js @@ -1,7 +1,7 @@ /** * Utility functions for jazzing up HTMLForm elements */ -( function( $ ) { +( function( $ ) { /** * jQuery plugin to fade or snap to visible state. diff --git a/resources/mediawiki/mediawiki.title.js b/resources/mediawiki/mediawiki.title.js index 34f85abfa4..b69c0b015f 100644 --- a/resources/mediawiki/mediawiki.title.js +++ b/resources/mediawiki/mediawiki.title.js @@ -163,7 +163,7 @@ var Title = function( title, namespace ) { } return title; }; - + /* Static space */ diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js index 27913c6396..68a08b968d 100644 --- a/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.byteLength.test.js @@ -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', diff --git a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js index 704740d9f3..7e28c72310 100644 --- a/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.byteLimit.test.js @@ -82,9 +82,7 @@ var byteLimitTest({ description: 'Plain text 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: $( '' ) - .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: $( '' ) - .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: $( '' ) - .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: $( '' ) - .attr( { - 'type': 'text' - }) + .attr( 'type', 'text' ) .byteLimit( 6, function( val ) { _titleConfig(); diff --git a/tests/qunit/suites/resources/jquery/jquery.client.test.js b/tests/qunit/suites/resources/jquery/jquery.client.test.js index 116a1f0b11..fb0e0ec232 100644 --- a/tests/qunit/suites/resources/jquery/jquery.client.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.client.test.js @@ -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', diff --git a/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js b/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js index 09e981e4b3..b846b532b1 100644 --- a/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js +++ b/tests/qunit/suites/resources/jquery/jquery.mwExtension.test.js @@ -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( '