From ad8f40e77ca85ad0b6facd0b7344d9eb1662cdbe Mon Sep 17 00:00:00 2001 From: Fomafix Date: Tue, 21 Jan 2014 20:49:07 +0000 Subject: [PATCH] Clean up whitespace in various javascript files Change-Id: I62fe370493b269618a0277ea06ed6ad22b97616a --- .../mediawiki.action.history.js | 16 ++++---- .../mediawiki.action.view.metadata.js | 4 +- .../mediawiki.api/mediawiki.api.category.js | 6 +-- .../mediawiki.page/mediawiki.page.gallery.js | 12 +++--- .../mediawiki.page.image.pagination.js | 6 +-- .../mediawiki.special.javaScriptTest.js | 2 +- .../mediawiki.special.preferences.js | 14 +++---- .../mediawiki.special.search.js | 32 +++++++-------- .../mediawiki.special.upload.js | 14 +++---- resources/mediawiki/mediawiki.Title.js | 4 +- resources/mediawiki/mediawiki.Uri.js | 4 +- resources/mediawiki/mediawiki.debug.js | 22 +++++----- resources/mediawiki/mediawiki.htmlform.js | 20 +++++----- resources/mediawiki/mediawiki.jqueryMsg.js | 40 +++++++++---------- resources/mediawiki/mediawiki.util.js | 12 +++--- 15 files changed, 104 insertions(+), 104 deletions(-) diff --git a/resources/mediawiki.action/mediawiki.action.history.js b/resources/mediawiki.action/mediawiki.action.history.js index 04f045a5d4..500a47a2be 100644 --- a/resources/mediawiki.action/mediawiki.action.history.js +++ b/resources/mediawiki.action/mediawiki.action.history.js @@ -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(); diff --git a/resources/mediawiki.action/mediawiki.action.view.metadata.js b/resources/mediawiki.action/mediawiki.action.view.metadata.js index 9b27e2492a..d23a937bac 100644 --- a/resources/mediawiki.action/mediawiki.action.view.metadata.js +++ b/resources/mediawiki.action/mediawiki.action.view.metadata.js @@ -26,7 +26,7 @@ $link = $( '', { 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 ); diff --git a/resources/mediawiki.api/mediawiki.api.category.js b/resources/mediawiki.api/mediawiki.api.category.js index 98a9c54b21..d61c1c63f6 100644 --- a/resources/mediawiki.api/mediawiki.api.category.js +++ b/resources/mediawiki.api/mediawiki.api.category.js @@ -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 } ); diff --git a/resources/mediawiki.page/mediawiki.page.gallery.js b/resources/mediawiki.page/mediawiki.page.gallery.js index 147a869d87..64efbb9ed1 100644 --- a/resources/mediawiki.page/mediawiki.page.gallery.js +++ b/resources/mediawiki.page/mediawiki.page.gallery.js @@ -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, @@ -200,7 +200,7 @@ $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 = { diff --git a/resources/mediawiki.page/mediawiki.page.image.pagination.js b/resources/mediawiki.page/mediawiki.page.image.pagination.js index 3c93de07ef..8a4d526993 100644 --- a/resources/mediawiki.page/mediawiki.page.image.pagination.js +++ b/resources/mediawiki.page/mediawiki.page.image.pagination.js @@ -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 ); } - }); + } ); } } } ); diff --git a/resources/mediawiki.special/mediawiki.special.javaScriptTest.js b/resources/mediawiki.special/mediawiki.special.javaScriptTest.js index a560ca95aa..2c7421bf15 100644 --- a/resources/mediawiki.special/mediawiki.special.javaScriptTest.js +++ b/resources/mediawiki.special/mediawiki.special.javaScriptTest.js @@ -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() } ); } ) ); diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js index 3302ec636b..19a8844e30 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -11,7 +11,7 @@ jQuery( function ( $ ) { }; $( '#prefsubmit' ).attr( 'id', 'prefcontrol' ); - $preftoc = $('') + $preftoc = $( '' ) .attr( 'role', 'tablist' ); $preferences = $( '#preferences' ) .addClass( 'jsprefs' ) @@ -34,7 +34,7 @@ jQuery( function ( $ ) { $( '
' ).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(); - }); + } ); } /** diff --git a/resources/mediawiki.special/mediawiki.special.search.js b/resources/mediawiki.special/mediawiki.special.search.js index 035252bf6b..b847f7d59e 100644 --- a/resources/mediawiki.special/mediawiki.special.search.js +++ b/resources/mediawiki.special/mediawiki.special.search.js @@ -11,22 +11,22 @@ } // Create check all/none button - $checkboxes = $('#powersearch input[id^=mw-search-ns]'); - $('#mw-search-togglebox').append( - $('
' ).prop({ + return $( '
' ).prop( { id: 'mw-debug-' + id, className: 'mw-debug-bit' - }) + } ) .appendTo( $bits ); } @@ -123,10 +123,10 @@ */ function paneLabel( id, text ) { return $( '' ) - .prop({ + .prop( { className: 'mw-debug-panelabel', href: '#mw-debug-pane-' + id - }) + } ) .text( text ); } @@ -142,10 +142,10 @@ if ( count ) { text = text + ' (' + count + ')'; } - return $( '
' ).prop({ + return $( '
' ).prop( { id: 'mw-debug-' + id, className: 'mw-debug-bit mw-debug-panelink' - }) + } ) .append( paneLabel( id, text ) ) .appendTo( $bits ); } @@ -205,10 +205,10 @@ } $( '
' ) - .prop({ + .prop( { className: 'mw-debug-pane', id: 'mw-debug-pane-' + id - }) + } ) .append( panes[id] ) .appendTo( $container ); } diff --git a/resources/mediawiki/mediawiki.htmlform.js b/resources/mediawiki/mediawiki.htmlform.js index de0685988e..7315677233 100644 --- a/resources/mediawiki/mediawiki.htmlform.js +++ b/resources/mediawiki/mediawiki.htmlform.js @@ -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 ); @@ -48,14 +48,14 @@ // 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 = $( '