From: Michael Dale Date: Sun, 8 Nov 2009 16:39:25 +0000 (+0000) Subject: * fixed js2AddOnloadHook loading order X-Git-Tag: 1.31.0-rc.0~38879 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%7B%7B%20url_for%28%27admin_users%27%29%20%7D%7D?a=commitdiff_plain;h=f869fb131e6366b6e400d4487597ecd2bb5ff6c7;p=lhc%2Fweb%2Fwiklou.git * fixed js2AddOnloadHook loading order --- diff --git a/js2/mwEmbed/mv_embed.js b/js2/mwEmbed/mv_embed.js index dd4ff5b74c..98e38fdccd 100644 --- a/js2/mwEmbed/mv_embed.js +++ b/js2/mwEmbed/mv_embed.js @@ -1093,11 +1093,11 @@ var mvJsLoader = { // Check the jQuery flag. This way, when remote embedding, we don't load jQuery // unless js2AddOnloadHook was used or there is video on the page. runQueuedFunctions: function() { - js_log("runQueuedFunctions"); + js_log("runQueuedFunctions"); var _this = this; - this.jQueryCheck( function() { - this.doneReadyEvents = true; + this.jQueryCheck( function() { _this.runReadyEvents(); + _this.doneReadyEvents = true; }); }, runReadyEvents: function() { @@ -1172,15 +1172,14 @@ function mwdomReady( force ) { //js2AddOnloadHook: ensure jQuery and the DOM are ready function js2AddOnloadHook( func ) { - js_log('js2AddOnloadHook::'); + js_log('js2AddOnloadHook::' + func ); // If we have already run the DOM-ready function, just run the function directly: - if( mvJsLoader.doneReadyEvents ) { - // Make sure jQuery is there: - mvJsLoader.jQueryCheck( function() { - func(); - }); + if( mvJsLoader.doneReadyEvents ) { + func(); } else { - mvJsLoader.addLoadEvent( func ); + mvJsLoader.jQueryCheck( function() { + mvJsLoader.addLoadEvent( func ); + }) } } // Deprecated mwAddOnloadHook in favor of js2 naming (for clear separation of js2 code from old MW code