Clean up: Consistently use "$" instead of "$( document ).ready"
authorTimo Tijhof <krinklemail@gmail.com>
Tue, 16 Jul 2013 22:08:49 +0000 (00:08 +0200)
committerTimo Tijhof <krinklemail@gmail.com>
Thu, 18 Jul 2013 22:00:38 +0000 (00:00 +0200)
Change-Id: Ie370fec8c851607f5ea7401e92129f9f60b6268b

21 files changed:
includes/installer/WebInstallerPage.php
resources/mediawiki.action/mediawiki.action.edit.editWarning.js
resources/mediawiki.action/mediawiki.action.edit.js
resources/mediawiki.action/mediawiki.action.edit.preview.js
resources/mediawiki.action/mediawiki.action.history.js
resources/mediawiki.page/mediawiki.page.patrol.ajax.js
resources/mediawiki.page/mediawiki.page.startup.js
resources/mediawiki.page/mediawiki.page.watch.ajax.js
resources/mediawiki.special/mediawiki.special.block.js
resources/mediawiki.special/mediawiki.special.changeemail.js
resources/mediawiki.special/mediawiki.special.createAccount.js
resources/mediawiki.special/mediawiki.special.movePage.js
resources/mediawiki.special/mediawiki.special.preferences.js
resources/mediawiki.special/mediawiki.special.recentchanges.js
resources/mediawiki.special/mediawiki.special.search.js
resources/mediawiki.special/mediawiki.special.undelete.js
resources/mediawiki.special/mediawiki.special.upload.js
resources/mediawiki/mediawiki.htmlform.js
resources/mediawiki/mediawiki.searchSuggest.js
skins/common/config.js
skins/common/upload.js

index 8a9fc2d..6ac1912 100644 (file)
@@ -1254,8 +1254,8 @@ class WebInstaller_Complete extends WebInstallerPage {
                $lsUrl = $this->getVar( 'wgServer' ) . $this->parent->getURL( array( 'localsettings' => 1 ) );
                if ( isset( $_SERVER['HTTP_USER_AGENT'] ) &&
                         strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false ) {
-                       // JS appears the only method that works consistently with IE7+
-                       $this->addHtml( "\n<script>jQuery( document ).ready( function () { document.location = " .
+                       // JS appears to be the only method that works consistently with IE7+
+                       $this->addHtml( "\n<script>jQuery( function () { document.location = " .
                                Xml::encodeJsVar( $lsUrl ) . "; } );</script>\n" );
                } else {
                        $this->parent->request->response()->header( "Refresh: 0;url=$lsUrl" );
index cfe9762..89bb64d 100644 (file)
@@ -2,7 +2,7 @@
  * Javascript for module editWarning
  */
 ( function ( mw, $ ) {
-       $( document ).ready( function () {
+       $( function () {
                // Check if EditWarning is enabled and if we need it
                if ( $( '#wpTextbox1' ).length === 0 ) {
                        return true;
index d29ee42..38d4bb8 100644 (file)
        // Explose API publicly
        mw.toolbar = toolbar;
 
-       $( document ).ready( function () {
+       $( function () {
                var buttons, i, b, $iframe, editBox, scrollTop, $editForm;
 
                // currentFocus is used to determine where to insert tags
index 602aadb..0f95b62 100644 (file)
                } );
        }
 
-       $( document ).ready( function () {
+       $( function () {
                // Do not enable on user .js/.css pages, as there's no sane way of "previewing"
                // the scripts or styles without reloading the page.
                if ( $( '#mw-userjsyoucanpreview' ).length || $( '#mw-usercssyoucanpreview' ).length ) {
index e9d320c..04f045a 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * JavaScript for History action
  */
-jQuery( document ).ready( function ( $ ) {
+jQuery( function ( $ ) {
        var     $historyCompareForm = $( '#mw-history-compare' ),
                $historySubmitter,
                $lis = $( '#pagehistory > li' );
index d7a07d7..75908ee 100644 (file)
@@ -11,7 +11,7 @@
                // that didn't have patrolToken yet.
                return;
        }
-       $( document ).ready( function () {
+       $( function () {
                var $patrolLinks = $( '.patrollink a' );
                $patrolLinks.on( 'click', function ( e ) {
                        var $spinner, href, rcid, apiRequest;
index 029039d..ee61b72 100644 (file)
@@ -13,6 +13,6 @@
        // Enqueued into domready from here instead of mediawiki.page.ready to ensure that it gets enqueued
        // before other modules hook into document ready, so that mw.util.$content (defined by mw.util.init),
        // is defined for them.
-       $( document ).ready( mw.util.init );
+       $( mw.util.init );
 
 }( mediaWiki, jQuery ) );
index 5ba77a1..545cd07 100644 (file)
                updateWatchLink: updateWatchLink
        };
 
-       $( document ).ready( function () {
+       $( function () {
                var $links = $( '.mw-watchlink a, a.mw-watchlink, ' +
                        '#ca-watch a, #ca-unwatch a, #mw-unwatch-link1, ' +
                        '#mw-unwatch-link2, #mw-watch-link2, #mw-watch-link1' );
index 2a158df..b8bcf17 100644 (file)
@@ -2,7 +2,7 @@
  * JavaScript for Special:Block
  */
 ( function ( mw, $ ) {
-       $( document ).ready( function () {
+       $( function () {
                var $blockTarget = $( '#mw-bi-target' ),
                        $anonOnlyRow = $( '#mw-input-wpHardBlock' ).closest( 'tr' ),
                        $enableAutoblockRow = $( '#mw-input-wpAutoBlock' ).closest( 'tr' ),
index 14c2f03..2d22bad 100644 (file)
@@ -23,7 +23,7 @@
                }
        }
 
-       $( document ).ready( function () {
+       $( function () {
                // Lame tip to let user know if its email is valid. See bug 22449.
                // Only bind once for 'blur' so that the user can fill it in without errors;
                // after that, look at every keypress for immediate feedback.
index 2cd5625..1281b11 100644 (file)
@@ -5,7 +5,7 @@
 
        // When sending password by email, hide the password input fields.
        // This function doesn't need to be loaded early by ResourceLoader, but is tiny.
-       function hidePasswordOnEmail( $ ) {
+       function hidePasswordOnEmail() {
                // Always required if checked, otherwise it depends, so we use the original
                var $emailLabel = $( 'label[for="wpEmail"]' ),
                        originalText = $emailLabel.text(),
@@ -29,7 +29,7 @@
 
        // Move the FancyCaptcha image into a more attractive container.
        // This function does need to be run early by ResourceLoader.
-       function adjustFancyCaptcha( $, mw ) {
+       function adjustFancyCaptcha() {
                var $content = $( '#mw-content-text' ),
                        $submit = $content.find( '#wpCreateaccount' ),
                        tabIndex,
@@ -99,9 +99,9 @@
                }
        }
 
-       $( document ).ready( function( $ ) {
-               adjustFancyCaptcha( $, mw);
-               hidePasswordOnEmail( $ );
+       $( function () {
+               adjustFancyCaptcha();
+               hidePasswordOnEmail();
        } );
 
 }( mediaWiki, jQuery ) );
index f719d07..922eba5 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * JavaScript for Special:MovePage
  */
-jQuery( document ).ready( function ( $ ) {
+jQuery( function ( $ ) {
        $( '#wpReason, #wpNewTitleMain' ).byteLimit();
 } );
index 6eaec6a..03d93d0 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * JavaScript for Special:Preferences
  */
-jQuery( document ).ready( function ( $ ) {
+jQuery( function ( $ ) {
        var $preftoc, $preferences, $fieldsets, $legends,
                hash,
                $tzSelect, $tzTextbox, $localtimeHolder, servertime;
index d1c1354..79d793a 100644 (file)
@@ -27,7 +27,7 @@
                }
        };
 
-       $( document ).ready( rc.init );
+       $( rc.init );
 
        mw.special.recentchanges = rc;
 
index 2dab302..035252b 100644 (file)
@@ -2,7 +2,7 @@
  * JavaScript for Special:Search
  */
 ( function ( mw, $ ) {
-       $( document ).ready( function () {
+       $( function () {
                var $checkboxes, $headerLinks;
 
                // Emulate HTML5 autofocus behavior in non HTML5 compliant browsers
index d20aab5..0dea3ef 100644 (file)
@@ -1,7 +1,7 @@
 /**
  * JavaScript for Special:Undelete
  */
-jQuery( document ).ready( function ( $ ) {
+jQuery( function ( $ ) {
        $( '#mw-undelete-invert' ).click( function ( e ) {
                $( '#undelete input[type="checkbox"]' ).prop( 'checked', function ( i, val ) {
                        return !val;
index 75532f1..3f40c54 100644 (file)
@@ -6,7 +6,7 @@
        /**
         * Add a preview to the upload form
         */
-       $( document ).ready( function () {
+       $( function () {
                /**
                 * Is the FileAPI available with sufficient functionality?
                 */
        /**
         * Disable all upload source fields except the selected one
         */
-       $( document ).ready( function () {
+       $( function () {
                var i, $row,
                        $rows = $( '.mw-htmlform-field-UploadSourceField' );
 
index f93cac1..77ceee4 100644 (file)
                } );
        }
 
-       $( document ).ready( function() {
+       $( function () {
                var $matrixTooltips = $( '.mw-htmlform-matrix .mw-htmlform-tooltip' );
                if ( $matrixTooltips.length ) {
                        mw.loader.using( 'jquery.tipsy', function () {
index 08f10fe..7f07862 100644 (file)
@@ -2,7 +2,7 @@
  * Add search suggestions to the search form.
  */
 ( function ( mw, $ ) {
-       $( document ).ready( function ( $ ) {
+       $( function () {
                var map, resultRenderCache, searchboxesSelectors,
                        // Region where the suggestions box will appear directly below
                        // (using the same width). Can be a container element or the input
index b1e28ab..73a6dba 100644 (file)
@@ -1,5 +1,5 @@
 ( function ( $ ) {
-       $( document ).ready( function () {
+       $( function () {
                var $label, labelText;
 
                function syncText() {
index df819e1..4246e82 100644 (file)
@@ -307,6 +307,6 @@ window.wgUploadLicenseObj = {
 
 };
 
-$( document ).ready( uploadSetup );
+$( uploadSetup );
 
 }( mediaWiki, jQuery ) );