r80659 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80658‎ | r80659 | r80660 >
Date:22:19, 20 January 2011
Author:dale
Status:deferred
Tags:
Comment:
fixed some issues with function being called ahead of initialization of globals
Modified paths:
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -676,10 +676,13 @@
677677 * classSet saves round trips to the server by grabbing things we will likely need in the first request.
678678 * @param {callback} function callback to be called once mwEmbed is ready
679679 */
680 -var mwAlreadyRequestedUi = false;
 680+var mwAlreadyRequestedUi = null;
681681 var mwQueuedLoadMwEmbedFunctions = [];
682 -var mwForceUiComponents = '$j.ui,$j.widget,$j.ui.mouse,$j.ui.button,$j.ui.draggable,$j.ui.position,$j.ui.resizable,$j.ui.slider,$j.ui.dialog';
683682 function loadMwEmbed( classSet, callback ) {
 683+ var mwForceUiComponents = '$j.ui,$j.widget,$j.ui.mouse,$j.ui.button,$j.ui.draggable,$j.ui.position,$j.ui.resizable,$j.ui.slider,$j.ui.dialog';
 684+ if( !mwQueuedLoadMwEmbedFunctions){
 685+ mwQueuedLoadMwEmbedFunctions = [];
 686+ }
684687 if( typeof classSet == 'function') {
685688 callback = classSet;
686689 }
@@ -687,10 +690,11 @@
688691 mw.load( classSet, callback);
689692 return ;
690693 }
691 - if( mwAlreadyRequestedUi !== false ){
 694+ if( mwAlreadyRequestedUi ){
692695 mwQueuedLoadMwEmbedFunctions.push(function(){
693696 mw.load( classSet, callback);
694697 });
 698+ return ;
695699 }
696700 var doLoadMwEmbed = function(){
697701 // Inject mwEmbed

Status & tagging log