* updated js2 stopgap stubs to reflect new function name
authorMichael Dale <dale@users.mediawiki.org>
Mon, 7 Dec 2009 19:56:42 +0000 (19:56 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Mon, 7 Dec 2009 19:56:42 +0000 (19:56 +0000)
js2AddonLoadHook -> mw.addonLoadHook
loadGM -> mw.addMessege
mvJsLoader->doLoad() -> mw.load()
mvJsLoader->doDepsMode() -> mw.load()
loadExternalScript() -> mw.load()

js2/js2stopgap.js

index c4e248b..28baceb 100644 (file)
@@ -9459,51 +9459,60 @@ window.DP_jQuery = $;
  * the JavaScript space. As such, if we get to the point of merging that stuff
  * into the main branch this code will be uneeded and probably cause issues.
  */
-// Creates global message object if not already in existence
-if ( !gMsg ) var gMsg = {};
-/**
- * Caches a list of messages for later retrieval
- * @param {Object} msgSet Hash of key:value pairs of messages to cache
- */
-function loadGM( msgSet ){
-       for ( var i in msgSet ){
-               gMsg[ i ] = msgSet[i];
-       }
-}
-/**
- * Retieves a message from the global message cache, performing on-the-fly
- * replacements using MediaWiki message syntax ($1, $2, etc.)
- * @param {String} key Name of message as it is in MediaWiki
- * @param {Array} args Array of replacement arguments
- */
-function gM( key, args ) {
-       var ms = '';    
-       if ( key in gMsg ) {
-               ms = gMsg[ key ];
-               if ( typeof args == 'object' || typeof args == 'array' ) {
-                       for ( var v in args ){
-                               var rep = '\$'+ ( parseInt(v) + 1 );
-                               ms = ms.replace( rep, args[v]);
-                       }
-               } else if ( typeof args =='string' || typeof args =='number' ) {
-                       ms = ms.replace( /\$1/, args );
-               }
-               return ms;
-       } else {
-               return '[' + key + ']';
-       }
-}
+
 /**
  * Mimics the no-conflict method used by the js2 stuff
  */
 $j = jQuery.noConflict();
 /**
- * Provides js2 compatible onload hook
- * @param func Function to call when ready
+ * Provides js2 compatible mw functions
  */
-function js2AddOnloadHook( func ) {
-       $j(document).ready( func );
-}
-
-// Define a dummy mvJsLoader.doLoad() function
-mvJsLoader = { doLoad: function( deps, callback ) { callback(); } };
\ No newline at end of file
+if( !mw ){
+   mw = { };
+   /**
+    * Provides js2 compatible onload hook
+    * @param func Function to call when ready
+    */
+   mw.addOnloadHook = function( func ) {
+       $j(document).ready( func );
+   }
+   // Define a dummy mw.load function:
+   mw.load = function( callback) { callbcak() };
+   
+   // Creates global message object if not already in existence
+       if ( !gMsg ) var gMsg = {};
+   
+       /**
+        * Caches a list of messages for later retrieval
+        * @param {Object} msgSet Hash of key:value pairs of messages to cache
+        */      
+       mw.addMessages = function ( msgSet ){
+               for ( var i in msgSet ){
+                       gMsg[ i ] = msgSet[i];
+               }
+       }
+       /**
+        * Retieves a message from the global message cache, performing on-the-fly
+        * replacements using MediaWiki message syntax ($1, $2, etc.)
+        * @param {String} key Name of message as it is in MediaWiki
+        * @param {Array} args Array of replacement arguments
+        */
+       function gM( key, args ) {
+               var ms = '';    
+               if ( key in gMsg ) {
+                       ms = gMsg[ key ];
+                       if ( typeof args == 'object' || typeof args == 'array' ) {
+                               for ( var v in args ){
+                                       var rep = '\$'+ ( parseInt(v) + 1 );
+                                       ms = ms.replace( rep, args[v]);
+                               }
+                       } else if ( typeof args =='string' || typeof args =='number' ) {
+                               ms = ms.replace( /\$1/, args );
+                       }
+                       return ms;
+               } else {
+                       return '[' + key + ']';
+               }
+       }
+   
+}
\ No newline at end of file