/* DynAPI Distribution Dynamic Loading extension to dynapi.library The DynAPI Distribution is distributed under the terms of the GNU LGPL license. */ // begin loading the object DynAPILibrary.prototype.load = function(n,fn) { var list = this._queue(n,null,arguments[2]); //return dynapi.debug.print('going to load: '+list); if (list.length) { var s,src; for (var i=0;i<\/script>'); this._export(src); } else { var elm = s.elm = dynapi.frame.document.createElement('script'); elm.src = rsrc; elm.type = 'text/javascript'; elm.defer = true; if (dynapi.ua.ie) { elm.C = 0; var o = this; elm.onreadystatechange = function() { elm.C++; if (elm.C==2 || elm.readyState=="complete") { // use 2nd statechange for onload o._export(src); } } } dynapi.frame.document.getElementsByTagName('head')[0].appendChild(elm); // I could not find way to know when the script is complete in Moz v0.9.3 if (dynapi.ua.ns6) setTimeout(this+'._export("'+src+'")',100); } } } }; // executed after a script is finished loading, run main() functions DynAPILibrary.prototype._export = function(src) { var src = this.loadList[this.loadIndex]; var s = this.scripts[src]; if (s) { this._register(s); // run elm.main)() before global main() if (dynapi.ua.ns4 && typeof(this.elm.main)=="function") { this.elm.main(); this.elm.main = null; } // run global main() if available if (typeof(main)=="function") { main(); main = null; } // clear out all functions in the layer's scope if (dynapi.ua.ns4) { for (var i in this.elm) { if (typeof(this.elm[i])=="function") delete this.elm[i]; } } this.busy = false; // load next file this._load(); } //else return alert('Library Error: unknown script '+src); }; // registers the script as loaded, exports the objects DynAPILibrary.prototype._register = function(s) { //dynapi.debug.print('loaded "'+s.src+'"'); s.loaded = true; s.queued = false; if (!s.unnamed) { var n,found; // loop through each object that the script contains for (var i=0;i0) { var ns = n.split('.'), o = dynapi.frame, b = false; for (var j=0;j, NS4 only DynAPILibrary.prototype._handleLoad = function(elm) { var args = dynapi.functions.getURLArguments(elm.src); var js = args["js"]; if (js) { js=js.replace(/\+/g,'/'); // convert + to / if (js.indexOf('http')!=0) { var l = dynapi.frame.document.location; if (js.substr(0,1)=='/') js = l.port+'//'+host+src; else js = dynapi.documentPath+js; } elm.document.write('