From de40125722e5222e8c466703f9b1e301e25305d8 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Sun, 8 Nov 2009 22:20:56 +0000 Subject: [PATCH] * only call callback once --- js2/mwEmbed/mv_embed.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/js2/mwEmbed/mv_embed.js b/js2/mwEmbed/mv_embed.js index 130c9f5c49..7cffc260dc 100644 --- a/js2/mwEmbed/mv_embed.js +++ b/js2/mwEmbed/mv_embed.js @@ -1006,8 +1006,10 @@ var mvJsLoader = { jQueryCheck: function( callback ) { js_log( 'jQueryCheck::' ); // Skip stuff if $j is already loaded: - if( _global['$j'] && callback ) + if( _global['$j'] && callback ){ callback(); + return ; + } var _this = this; // Load jQuery _this.doLoad([ @@ -1156,7 +1158,7 @@ function mwdomReady( force ) { } } } - // Load libs and process them + // Load libs and process videos mvJsLoader.embedVideoCheck( function() { // Run any queued global events: mv_video_embed( function() { @@ -1164,20 +1166,18 @@ function mwdomReady( force ) { }); }); } else { - // If we already have jQuery, make sure it's loaded into its proper context $j - // Run any queued global events mvJsLoader.runQueuedFunctions(); } } //js2AddOnloadHook: ensure jQuery and the DOM are ready function js2AddOnloadHook( func ) { - //js_log('js2AddOnloadHook::' + func ); + //js_log('js2AddOnloadHook::' ); // If we have already run the DOM-ready function, just run the function directly: - if( mvJsLoader.doneReadyEvents ) { + if( mvJsLoader.doneReadyEvents ) { func(); } else { - mvJsLoader.jQueryCheck( function() { + mvJsLoader.jQueryCheck( function() { mvJsLoader.addLoadEvent( func ); }) } -- 2.20.1