whitespace clean up mw.util
authorKrinkle <krinkle@users.mediawiki.org>
Fri, 10 Dec 2010 00:13:34 +0000 (00:13 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Fri, 10 Dec 2010 00:13:34 +0000 (00:13 +0000)
resources/mediawiki.util/mediawiki.util.js

index a646eeb..1d38937 100644 (file)
@@ -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
                                        }
 
                                        // 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' );
                        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;
                        }
 
                                                '[' + mw.util.tooltipAccessKeyPrefix + "$5]" );
                                        $(this).attr( 'title', tip );
                                }
-                       });
+                       } );
                },
 
                // jQuery object that refers to the page-content element
                 *
                 * 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
                                return null;
                        }
                        // Setup the anchor tag
-                       var $link = $('<a />').attr( 'href', href ).text( text );
+                       var $link = $( '<a />' ).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
                        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;
                                }