ajaxLoader : { /** A queue of embeds to load on document ready */ loadQueue: {}, /** A queue of embeds to load on after the load queue */ lazyQueue: {}, /** * Called on Document Ready to load all the queued embeds */ init: function() { jQuery.each(this.loadQueue, function(id, url) { wbHtmlWidgets.embed._load(id, url); }); jQuery.each(this.lazyQueue, function(id, url) { wbHtmlWidgets.embed._load(id, url); }); }, _load: function(id, url) { $("#" + id).load(url); }, /** * Loads a url into a dom id immediately - ensure that the page has * completely loaded before using this method, as manipulating the DOM * before it has been created does nasty things in browsers such as IE. * If you want to embed the wibl after the page has loaded, use embed.afterLoad() * @param {string} id The div id to load the embed into * @param {string} url The url to load into the specified div id */ now: function(id, url) { this._load(id, url); }, /** * Loads a url into a dom id after the onLoad queue has been processed. * @param {string} id The div id to load the embed into * @param {string} url The url to load into the specified div id */ lazy: function(id, url) { this.lazyQueue[id] = url; }, /** * Loads a url into a dom id after the page has loaded. * If you want to embed the wibl now, use embed.now() * @param {string} id The div id to load the embed into * @param {string} url The url to load into the specified div id */ afterLoad: function(id, url) { if ( $("#"+id).html() == '' ) { $("#"+id).html(''); } this.loadQueue[id] = url; } }