⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 application.js

📁 Bindows 1.01 完全版 Bindows 框架提供给你: 基于类的面向对象 API; 一个完整的窗口系统
💻 JS
📖 第 1 页 / 共 5 页
字号:
        s = s.replace(/<\?xml[^\?]*\?>/, "");        var d = xl.getXmlHttp().responseXML;        d.loadXML(s);        }    };function BiScriptLoaderQueue()    {    BiEventTarget.call(this);    this._items = [];    };_p = BiScriptLoaderQueue.prototype = new BiEventTarget;_p._className = "BiScriptLoaderQueue";_p._async = true;BiScriptLoaderQueue.prototype.getAsync = function()    {    return this._async;    } ;BiScriptLoaderQueue.prototype.setAsync = function(v)    {    this._async = v;    } ;_p._allExecuted = true;_p.add = function(oUri)    {    this._allExecuted = false;    var tl = new BiTextLoader();    tl.setUri(oUri);    tl.addEventListener("load", this._onProgress, this);    this._items.push({ src: oUri, textLoader: tl });    };_p.addInline = function(sText)    {    this._allExecuted = false;    this._items.push({ text: sText });    };_p.load = function()    {    if (this._getAllLoaded())        this._onAllLoaded();    else        {        for (var i = 0; i < this._items.length; i++)            {            if (this._items[i].textLoader)                {                this._items[i].textLoader.setAsync(this._async);                this._items[i].textLoader.load();                }            }        if (this._getAllLoaded())            this._onAllLoaded();        }    };_p.abort = function()    {    for (var i = 0; i < this._items.length; i++)        {        if (this._items[i].textLoader)            this._items[i].textLoader.abort();        }    };_p.getLoaded = function()    {    if (this._allExecuted)        return true;    return this._allExecuted && this._getAllLoaded()    };_p._getAllLoaded = function()    {    var items = this._items;    var tl;    for (var i = 0; i < items.length; i++)        {        tl = items[i].textLoader;        if (tl && !tl.getLoaded())            return false;        }    return true;    };_p.getLoadedCount = function()    {    if (this.getLoaded())        return this.getScriptCount();    var n = 0;    var items = this._items;    var tl;    for (var i = 0; i < items.length; i++)        {        tl = items[i].textLoader;        if (!tl || tl.getLoaded())            n++        }    return n;    };_p.getScriptCount = function()    {    return this._items.length;    } ;_p._onProgress = function(e)    {    if (e.getTarget().getError())        {        alert("Error loading file \"" + e.getTarget().getUri() + "\"");        throw new Error("Error loading file \"" + e.getTarget().getUri() + "\"");        }    if (this._getAllLoaded())        this._onAllLoaded();    else        this.dispatchEvent(new BiEvent("progress"));    };_p._onAllLoaded = function()    {    if (this._allExecuted)        return;    this.dispatchEvent(new BiEvent("progress"));    var ok = true;    var items = this._items;    for (var i = 0; i < items.length; i++)        {        try            {            if (items[i].textLoader)                {                try                    {                    if (window.execScript)                        window.execScript(items[i].textLoader.getText());                    else                        window.eval(items[i].textLoader.getText());                    }                catch (ex)                    {                    ok = false;                    alert("Error in script\n" + "Name: " + ex.name + "\n" + "Number: " + ex.number + "\n"                             + "Decription: " + ex.description + "\n" + "URI: " + items[i].textLoader.getUri());                    }                }            else                {                try                    {                    if (window.execScript)                        window.execScript(items[i].text);                    else                        window.eval(items[i].text);                    }                catch (ex)                    {                    ok = false;                    alert("Error in script\n" + "Name: " + ex.name + "\n" + "Number: " + ex.number + "\n"                             + "Decription: " + ex.description + "\n" + "Text: " + items[i].text);                    }                }            }        catch (ex)            {            ok = false;            break;            }        }    if (ok)        {        this._allExecuted = true;        this.dispatchEvent(new BiEvent("load"));        }    };_p.dispose = function()    {    if (this._disposed)        return;    BiEventTarget.prototype.dispose.call(this);    if (this._items)        {        for (var i = 0; i < this._items.length; i++)            {            if (this._items[i].textLoader)                this._items[i].textLoader.dispose();            this._items[i].textLoader = null;            this._items[i].text = null;            this._items[i] = null;            }        }    };function BiXmlResourceParser()    {    BiXmlLoader.call(this);    this._componentsById = { };    }_p = BiXmlResourceParser.prototype = new BiXmlLoader;_p.dispose();_p._disposed = false;_p._className = "BiXmlResourceParser";_p._rootNode = null;BiXmlResourceParser.getClassFromUri = function(oUri)    {    return BiXmlResourceParser.getClassFromDocument(BiXmlLoader.load(oUri));    } ;BiXmlResourceParser.getClassFromDocument = function(oDoc)    {    return BiXmlResourceParser.getClassFromNode(oDoc.documentElement);    } ;BiXmlResourceParser.getClassFromNode = function(oNode)    {    if (oNode == null || oNode.nodeType != 1)        return null;    var tagName = oNode.tagName;    var constr = window["Bi" + tagName] || window[tagName];    if (typeof constr == "function")        {        var newConstr = function()            {            constr.call(this);            this._xmlResourceParser = new BiXmlResourceParser;            this._xmlResourceParser.setRootNode(this._rootXmlNode);            this._xmlResourceParser.processAttributes(this, this._rootXmlNode);            this._xmlResourceParser.processChildNodes(this, this._rootXmlNode);            };        var p = newConstr.prototype = new constr;        p._rootXmlNode = oNode;        p.dispose();        p._disposed = false;        p.dispose = function()            {            if (this.getDisposed())                return;            constr.prototype.dispose.call(this);            this._xmlResourceParser.dispose();            this._rootXmlNode = null;            };        p.getComponentById = function(sId)            {            return this._xmlResourceParser.getComponentById(sId);            } ;        p.getXmlResourceParser = function()            {            return this._xmlResourceParser;            } ;        application.addEventListener("dispose", function()            {            newConstr.prototype._rootXmlNode = null;            newConstr = null;            });        return newConstr;        }    throw new Error("BiXmlResourceParser getClassFromNode. Cannot create object from \"" + oNode.tagName + "\"");    };_p.fromNode = function(oNode)    {    if (oNode == null || oNode.nodeType != 1)        return null;    var id = oNode.getAttribute("id");    if (id && this._componentsById[id])        return this._componentsById[id];    var tagName = oNode.tagName;    var o;    var constr = window["Bi" + tagName] || window[tagName];    if (typeof constr == "function")        {        var o = new constr;        this.processAttributes(o, oNode);        this.processChildNodes(o, oNode);        if (id)            this._componentsById[id] = o;        return o;        }    throw new Error("BiXmlResourceParser fromNode. Cannot create object from \"" + oNode.tagName + "\"");    };_p.processAttributes = function(o, oNode)    {    var attrs = oNode.attributes;    var l = attrs.length;    var name, value;    for (var i = 0; i < l; i++)        {        name = attrs[i].nodeName;        value = attrs[i].nodeValue;        o.setAttribute(name, value, this);        }    };_p.processChildNodes = function(obj, oNode)    {    var tagName = oNode.tagName;    var re = new RegExp("^" + tagName + "\\.(.+)$");    var cs = oNode.childNodes;    var l = cs.length;    var fc, s;    var emptyRe = /^\s*$/;    for (var i = 0; i < l; i++)        {        if (re.test(cs[i].tagName))            {            var propertyName = RegExp.$1;            var cs2 = cs[i].childNodes;            var l2 = cs2.length;            for (var j = 0; j < l2; j++)                {                if (cs2[j].nodeType == 3)                    {                    s = cs2[j].data;                    if (emptyRe.test(s))                        continue;                    obj.setAttribute(propertyName, s, this);                    break;                    }                else                    {                    obj.setProperty(propertyName, this.fromNode(cs2[j]));                    break;                    }                }            }        else            obj.addXmlNode(cs[i], this);        }    };_p.getComponentById = function(sId)    {    var o = this._componentsById[sId];    if (o)        return o;    if (this.getLoaded())        {        var rn = this.getRootNode();        var n = rn.selectSingleNode("//*[@id='" + sId + "']");        if (!n)            return null;        o = this.fromNode(n);        if (o)            return o;        }    return null;    };BiXmlResourceParser.prototype.setRootNode = function(v)    {    this._rootNode = v;    } ;_p.getRootNode = function()    {    if (this._rootNode)        return this._rootNode;    else        {        if (this.getLoaded())            return this.getDocument();        return null;        }    };_p.getLoaded = function()    {    return this._rootNode != null || BiXmlLoader.prototype.getLoaded.call(this);    } ;_p.dispose = function()    {    if (this.getDisposed())        return;    BiXmlLoader.prototype.dispose.call(this);    for (var id in this._componentsById)        {        this._componentsById[id].dispose();        this._componentsById[id] = null;        }    this._rootNode = null;    };function BiResourceLoader()    {    BiEventTarget.call(this);    this._resources = [];    this._resourcesById = [];    }_p = BiResourceLoader.prototype = new BiEventTarget;_p._className = "BiResourceLoader";_p._lastLoaded = -1;_p._lastStarted = -1;_p._count = 0;_p._loaded = false;_p.getResourceById = function(sId)    {    if (sId in this._resourcesById)        return this._resourcesById[sId].object;    return null;    };_p.addResource = function(sType, oData, sId)    {    var lastRes = this._resources[this._resources.length - 1];    if ((sType == "script" || sType == "inlinescript") && !(lastRes instanceof BiScriptLoaderQueue))        {        lastRes = new BiScriptLoaderQueue;        lastRes.addEventListener("load", this.load, this);        lastRes.addEventListener("progress", this._onprogress, this);        lastRes.addEventListener("error", this._onerror, this);        this._resources.push(lastRes);        }    if (sType == "script")        lastRes.add(oData);    else if (sType == "inlinescript")        lastRes.addInline(oData);    else        {        var item = { name: sType, node: oData, id: sId };        this._resources.push(item);        if (sId)            this._resourcesById[sId] = item;        }    this._count++;    };_p._createGeneralObject = function(oItem)    {    var node = oItem.node;    if (!this._xmlResourceParser)        {        this._xmlResourceParser = new BiXmlResourceParser;        this._xmlResourceParser.setRootNode(node.parentNode);        }    var o = this._xmlResourceParser.fromNode(node);    oItem.object = o;    oItem.node = null;    if (o instanceof BiEventTarget)        {        o.addEventListener("load", this.load, this);        o.addEventListener("error", this._onerror, this);        }    if (typeof o.load == "function")        o.load();    };_p.load = function()    {    if (this._loaded)        return;    var allLoaded = true;    if (this._lastStarted == -1)        {        allLoaded = false;        this._lastStarted = 0;        this._startLoad(this._resources[0]);        }    else        {        for (var i = this._lastStarted; i < this._resources.length; i++)            {            var obj = this._resources[i];            if (this._isLoaded(obj))                {                this._lastLoaded = i;                this._removeListeners(obj);                this._onprogress();                continue;                }            else                {                if (i == this._lastStarted)                    {                    allLoaded = false;                    break;                    }                this._lastStarted = i;                this._startLoad(obj);                if (!this._isLoaded(obj))                    {                    allLoaded = false;                    break;                

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -