From d3dea9c55e867c27f29b96d05c35d5771578dc55 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Fri, 10 Dec 2010 00:13:34 +0000 Subject: [PATCH] whitespace clean up mw.util --- resources/mediawiki.util/mediawiki.util.js | 45 +++++++++++----------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/resources/mediawiki.util/mediawiki.util.js b/resources/mediawiki.util/mediawiki.util.js index a646eeb3b4..1d3893755a 100644 --- a/resources/mediawiki.util/mediawiki.util.js +++ b/resources/mediawiki.util/mediawiki.util.js @@ -33,8 +33,7 @@ // Non-Windows Safari with webkit_version > 526 } else if ( profile.platform !== 'win' && profile.name == 'safari' - && profile.layoutVersion > 526 ) - { + && profile.layoutVersion > 526 ) { mw.util.tooltipAccessKeyPrefix = 'ctrl-alt-'; // Safari/Konqueror on any platform, or any browser on Mac @@ -51,22 +50,22 @@ } // Enable CheckboxShiftClick - $('input[type=checkbox]:not(.noshiftselect)').checkboxShiftClick(); + $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick(); // Emulate placeholder if not supported by browser if ( !( 'placeholder' in document.createElement( 'input' ) ) ) { - $('input[placeholder]').placeholder(); + $( 'input[placeholder]' ).placeholder(); } // Fill $content var - if ( $('#bodyContent').length ) { - mw.util.$content = $('#bodyContent'); - } else if ( $('#article').length ) { - mw.util.$content = $('#article'); + if ( $( '#bodyContent' ).length ) { + mw.util.$content = $( '#bodyContent' ); + } else if ( $( '#article' ).length ) { + mw.util.$content = $( '#article' ); } else { - mw.util.$content = $('#content'); + mw.util.$content = $( '#content' ); } - }); + } ); return true; } @@ -81,7 +80,7 @@ * @param str String to be encoded */ 'rawurlencode' : function( str ) { - str = (str + '').toString(); + str = ( str + '' ).toString(); return encodeURIComponent( str ) .replace( /!/g, '%21' ).replace( /'/g, '%27' ).replace( /\(/g, '%28' ) .replace( /\)/g, '%29' ).replace( /\*/g, '%2A' ).replace( /~/g, '%7E' ); @@ -166,16 +165,16 @@ if ( nodeList instanceof jQuery ) { $nodes = nodeList; } else if ( nodeList ) { - $nodes = $(nodeList); + $nodes = $( nodeList ); } else { // Rather than scanning all links, just the elements that // contain the relevant links this.updateTooltipAccessKeys( - $('#column-one a, #mw-head a, #mw-panel a, #p-logo a') ); + $( '#column-one a, #mw-head a, #mw-panel a, #p-logo a' ) ); // these are rare enough that no such optimization is needed - this.updateTooltipAccessKeys( $('input') ); - this.updateTooltipAccessKeys( $('label') ); + this.updateTooltipAccessKeys( $( 'input' ) ); + this.updateTooltipAccessKeys( $( 'label' ) ); return; } @@ -186,7 +185,7 @@ '[' + mw.util.tooltipAccessKeyPrefix + "$5]" ); $(this).attr( 'title', tip ); } - }); + } ); }, // jQuery object that refers to the page-content element @@ -204,23 +203,23 @@ * * By default the new link will be added to the end of the list. To * add the link before a given existing item, pass the DOM node - * (document.getElementById('foobar')) or the jQuery-selector - * ('#foobar') of that item. + * (document.getElementById( 'foobar' )) or the jQuery-selector + * ( '#foobar' ) of that item. * * @example mw.util.addPortletLink( * 'p-tb', 'http://mediawiki.org/', * 'MediaWiki.org', 't-mworg', 'Go to MediaWiki.org ', 'm', '#t-print' * ) * - * @param portlet ID of the target portlet ('p-cactions' or 'p-personal' etc.) + * @param portlet ID of the target portlet ( 'p-cactions' or 'p-personal' etc.) * @param href Link URL * @param text Link text (will be automatically converted to lower * case by CSS for p-cactions in Monobook) * @param id ID of the new item, should be unique and preferably have - * the appropriate prefix ('ca-', 'pt-', 'n-' or 't-') + * the appropriate prefix ( 'ca-', 'pt-', 'n-' or 't-' ) * @param tooltip Text to show when hovering over the link, without accesskey suffix * @param accesskey Access key to activate this link (one character, try - * to avoid conflicts. Use $('[accesskey=x').get() in the console to + * to avoid conflicts. Use $( '[accesskey=x' ).get() in the console to * see if 'x' is already used. * @param nextnode DOM node or jQuery-selector of the item that the new * item should be added before, should be another item in the same @@ -236,7 +235,7 @@ return null; } // Setup the anchor tag - var $link = $('').attr( 'href', href ).text( text ); + var $link = $( '' ).attr( 'href', href ).text( text ); // Some skins don't have any portlets // just add it to the bottom of their 'sidebar' element as a fallback @@ -251,7 +250,7 @@ default : // Skins like chick, modern, monobook, myskin, simple, vector... // Select the specified portlet - var $portlet = $('#' + portlet); + var $portlet = $( '#' + portlet); if ( $portlet.length === 0 ) { return null; } -- 2.20.1