From: Michael Dale Date: Mon, 7 Dec 2009 19:56:42 +0000 (+0000) Subject: * updated js2 stopgap stubs to reflect new function name X-Git-Tag: 1.31.0-rc.0~38604 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=8b1b8981dc5748a156fb98e539b9276f94acb61f;p=lhc%2Fweb%2Fwiklou.git * updated js2 stopgap stubs to reflect new function name js2AddonLoadHook -> mw.addonLoadHook loadGM -> mw.addMessege mvJsLoader->doLoad() -> mw.load() mvJsLoader->doDepsMode() -> mw.load() loadExternalScript() -> mw.load() --- diff --git a/js2/js2stopgap.js b/js2/js2stopgap.js index c4e248ba6e..28baceb681 100644 --- a/js2/js2stopgap.js +++ b/js2/js2stopgap.js @@ -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