mw.loader.implement now calls script without setting mw to mediaWiki since this is...
authorKrinkle <krinkle@users.mediawiki.org>
Sat, 19 Feb 2011 23:52:11 +0000 (23:52 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Sat, 19 Feb 2011 23:52:11 +0000 (23:52 +0000)
* Also shortens a few wrapper functions the same way
* Partial revert of r82496. Apparantly mw-alias is not available in startUp module. TODO: Find out why ?

(See also r82496 commit message)

includes/resourceloader/ResourceLoader.php
includes/resourceloader/ResourceLoaderStartUpModule.php
resources/mediawiki.special/mediawiki.special.search.js
resources/mediawiki/mediawiki.js
resources/mediawiki/mediawiki.log.js

index 354d7f3..4c3d978 100644 (file)
@@ -563,7 +563,7 @@ class ResourceLoader {
                        'mw.loader.implement', 
                        array(
                                $name,
-                               new XmlJsCode( "function( $, mw ) {{$scripts}}" ),
+                               new XmlJsCode( "function( $ ) {{$scripts}}" ),
                                (object)$styles,
                                (object)$messages
                        ) );
@@ -667,10 +667,10 @@ class ResourceLoader {
                $dependencies = null, $group = null ) 
        {
                if ( is_array( $name ) ) {
-                       return Xml::encodeJsCall( 'mw.loader.register', array( $name ) );
+                       return Xml::encodeJsCall( 'mediaWiki.loader.register', array( $name ) );
                } else {
                        $version = (int) $version > 1 ? (int) $version : 1;
-                       return Xml::encodeJsCall( 'mw.loader.register', 
+                       return Xml::encodeJsCall( 'mediaWiki.loader.register', 
                                array( $name, $version, $dependencies, $group ) );
                }
        }
@@ -693,7 +693,7 @@ class ResourceLoader {
         * @param $configuration Array: List of configuration values keyed by variable name
         */
        public static function makeConfigSetScript( array $configuration ) {
-               return Xml::encodeJsCall( 'mw.config.set', array( $configuration ) );
+               return Xml::encodeJsCall( 'mediaWiki.config.set', array( $configuration ) );
        }
        
        /**
index 87b0cb5..5b69037 100644 (file)
@@ -178,7 +178,7 @@ class ResourceLoaderStartUpModule extends ResourceLoaderModule {
                        $registrations = self::getModuleRegistrations( $context );
                        $out .= "var startUp = function() {\n" . 
                                "\t$registrations\n" . 
-                               "\t" . Xml::encodeJsCall( 'mw.config.set', array( $configuration ) ) . 
+                               "\t" . Xml::encodeJsCall( 'mediaWiki.config.set', array( $configuration ) ) . 
                                "};\n";
                        
                        // Conditional script injection
index d431718..77948ed 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * JavaScript for Specical:Search
  */
-( function( $, mw ) {
+( function( $ ) {
 
 // Emulate HTML5 autofocus behavior in non HTML5 compliant browsers
 if ( !( 'autofocus' in document.createElement( 'input' ) ) ) {
        $( 'input[autofocus]:first' ).focus();
 }
 
-} )( jQuery, mediaWiki );
\ No newline at end of file
+} )( jQuery );
\ No newline at end of file
index 4da1a81..cb5ab4d 100644 (file)
@@ -670,7 +670,7 @@ window.mediaWiki = new ( function( $ ) {
                        }
                        // Execute script
                        try {
-                               registry[module].script( jQuery, mediaWiki );
+                               registry[module].script( jQuery );
                                registry[module].state = 'ready';
                                // Run jobs who's dependencies have just been met
                                for ( var j = 0; j < jobs.length; j++ ) {
index d38d4a7..1c63b9e 100644 (file)
@@ -2,7 +2,7 @@
  * Implementation for mediaWiki.log stub
  */
 
-(function ($, mw) {
+(function ($) {
 
        /**
         * Log output to the console.
@@ -22,7 +22,7 @@
                }
                // Try to use an existing console
                if ( typeof window.console !== 'undefined' && typeof window.console.log == 'function' ) {
-                       window.console.log( string );
+                       console.log( string );
                } else {
                        // Set timestamp
                        var d = new Date();
@@ -61,4 +61,4 @@
                }
        };
 
-})(jQuery, mediaWiki);
+})(jQuery);
\ No newline at end of file