r82497 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82496‎ | r82497 | r82498 >
Date:23:52, 19 February 2011
Author:krinkle
Status:ok
Tags:
Comment:
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)
Modified paths:
  • /trunk/phase3/includes/resourceloader/ResourceLoader.php (modified) (history)
  • /trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php (modified) (history)
  • /trunk/phase3/resources/mediawiki.special/mediawiki.special.search.js (modified) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.js (modified) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.log.js (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/resourceloader/ResourceLoader.php
@@ -563,7 +563,7 @@
564564 'mw.loader.implement',
565565 array(
566566 $name,
567 - new XmlJsCode( "function( $, mw ) {{$scripts}}" ),
 567+ new XmlJsCode( "function( $ ) {{$scripts}}" ),
568568 (object)$styles,
569569 (object)$messages
570570 ) );
@@ -667,10 +667,10 @@
668668 $dependencies = null, $group = null )
669669 {
670670 if ( is_array( $name ) ) {
671 - return Xml::encodeJsCall( 'mw.loader.register', array( $name ) );
 671+ return Xml::encodeJsCall( 'mediaWiki.loader.register', array( $name ) );
672672 } else {
673673 $version = (int) $version > 1 ? (int) $version : 1;
674 - return Xml::encodeJsCall( 'mw.loader.register',
 674+ return Xml::encodeJsCall( 'mediaWiki.loader.register',
675675 array( $name, $version, $dependencies, $group ) );
676676 }
677677 }
@@ -693,7 +693,7 @@
694694 * @param $configuration Array: List of configuration values keyed by variable name
695695 */
696696 public static function makeConfigSetScript( array $configuration ) {
697 - return Xml::encodeJsCall( 'mw.config.set', array( $configuration ) );
 697+ return Xml::encodeJsCall( 'mediaWiki.config.set', array( $configuration ) );
698698 }
699699
700700 /**
Index: trunk/phase3/includes/resourceloader/ResourceLoaderStartUpModule.php
@@ -178,7 +178,7 @@
179179 $registrations = self::getModuleRegistrations( $context );
180180 $out .= "var startUp = function() {\n" .
181181 "\t$registrations\n" .
182 - "\t" . Xml::encodeJsCall( 'mw.config.set', array( $configuration ) ) .
 182+ "\t" . Xml::encodeJsCall( 'mediaWiki.config.set', array( $configuration ) ) .
183183 "};\n";
184184
185185 // Conditional script injection
Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.search.js
@@ -1,11 +1,11 @@
22 /*
33 * JavaScript for Specical:Search
44 */
5 -( function( $, mw ) {
 5+( function( $ ) {
66
77 // Emulate HTML5 autofocus behavior in non HTML5 compliant browsers
88 if ( !( 'autofocus' in document.createElement( 'input' ) ) ) {
99 $( 'input[autofocus]:first' ).focus();
1010 }
1111
12 -} )( jQuery, mediaWiki );
\ No newline at end of file
 12+} )( jQuery );
\ No newline at end of file
Index: trunk/phase3/resources/mediawiki/mediawiki.js
@@ -670,7 +670,7 @@
671671 }
672672 // Execute script
673673 try {
674 - registry[module].script( jQuery, mediaWiki );
 674+ registry[module].script( jQuery );
675675 registry[module].state = 'ready';
676676 // Run jobs who's dependencies have just been met
677677 for ( var j = 0; j < jobs.length; j++ ) {
Index: trunk/phase3/resources/mediawiki/mediawiki.log.js
@@ -2,7 +2,7 @@
33 * Implementation for mediaWiki.log stub
44 */
55
6 -(function ($, mw) {
 6+(function ($) {
77
88 /**
99 * Log output to the console.
@@ -22,7 +22,7 @@
2323 }
2424 // Try to use an existing console
2525 if ( typeof window.console !== 'undefined' && typeof window.console.log == 'function' ) {
26 - window.console.log( string );
 26+ console.log( string );
2727 } else {
2828 // Set timestamp
2929 var d = new Date();
@@ -61,4 +61,4 @@
6262 }
6363 };
6464
65 -})(jQuery, mediaWiki);
 65+})(jQuery);
\ No newline at end of file

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82496Using the mw alias for mediaWiki in core. Saves bandwidth and makes sense (th...krinkle22:59, 19 February 2011

Status & tagging log