mw.loader.implement now calls script without setting mw to mediaWiki since this is already globally avaiable

* 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)
This commit is contained in:
Krinkle 2011-02-19 23:52:11 +00:00
parent b2378a694c
commit e89aab93a3
5 changed files with 11 additions and 11 deletions

View 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 ) );
}
/**

View 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

View 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 );
} )( jQuery );

View 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++ ) {

View 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);