📄 bilauncher.js
字号:
/* * Bindows 1.01 * http://www.bindows.net/ * Copyright (c) 2003-2004 MB Technologies * * Bindows(tm) belongs to MB Technologies (Georgia, USA). All rights reserved. * You are not allowed to copy or modify this code. Commercial use requires * license. */function BiXmlHttp(){ if (window.XMLHttpRequest) return new XMLHttpRequest(); else if (window.ActiveXObject) return new ActiveXObject(BiXmlHttp._activeXName);}BiXmlHttp.create = function(){ return new BiXmlHttp();} ;function BiXmlDocument(){ if (document.implementation && document.implementation.createDocument) { var doc = document.implementation.createDocument("", "", null); doc.addEventListener("load", function(e) { this.readyState = 4; } , false); doc.readyState = 4; return doc; } else if (window.ActiveXObject) return new ActiveXObject(BiXmlDocument._activeXName);}BiXmlDocument.create = function(){ return new BiXmlDocument();} ;BiXmlDocument._biGetActiveXName = BiXmlHttp._biGetActiveXName = function(sType){ var servers = ["MSXML2", "Microsoft", "MSXML", "MSXML3"]; var o; for (var i = 0; i < servers.length; i++) { try { o = new ActiveXObject(servers[i] + "." + sType); return servers[i] + "." + sType; } catch (ex) { } ; } throw new Error("Could not find an installed XML parser");};if (window.ActiveXObject){ BiXmlDocument._activeXName = BiXmlDocument._biGetActiveXName("DomDocument"); BiXmlHttp._activeXName = BiXmlHttp._biGetActiveXName("XmlHttp");}function BiWebService(){ var el = document.createElement("meta"); if (el.addBehavior) { el.addBehavior(application.getPath() + "" + BiWebService.HTC_PATH); document.getElementsByTagName("head")[0].appendChild(el); return el; } throw new Error("Not yet implemented");}BiWebService.HTC_PATH = "js/biwebservice.htc";BiWebService.create = function(){ return new BiWebService;} ;if (window.XMLHttpRequest){ XMLDocument.prototype.__realLoad = XMLDocument.prototype.load; XMLDocument.prototype.load = function(sUri) { this.readyState = 0; this.__realLoad(sUri); }; XMLDocument.prototype.__defineSetter__("onreadystatechange", function(f) { if (this._onreadystatechange) this.removeEventListener("load", this._onreadystatechange, false); this._onreadystatechange = f; if (f) this.addEventListener("load", f, false); return f; }); XMLDocument.prototype.__defineGetter__("onreadystatechange", function() { return this._onreadystatechange; } ); XMLDocument.prototype.loadXML = function(s) { var doc2 = ( new DOMParser).parseFromString(s, "text/xml"); while (this.hasChildNodes()) this.removeChild(this.lastChild); var cs = doc2.childNodes; var l = cs.length; for (var i = 0; i < l; i++) this.appendChild(this.importNode(cs[i], true)); }; BiXmlDocument._mozHasParseError = function(oDoc) { return !oDoc.documentElement || oDoc.documentElement.localName == "parsererror" && oDoc.documentElement.getAttribute("xmlns") == "http://www.mozilla.org/newlayout/xml/parsererror.xml"; } ; XMLDocument.prototype.__defineGetter__("parseError", function() { var hasError = BiXmlDocument._mozHasParseError(this); var res = { errorCode: 0, filepos: 0, line: 0, linepos: 0, reason: "", srcText: "", url: "" }; if (hasError) { res.errorCode = -1; try { res.srcText = this.getElementsByTagName("sourcetext")[0].firstChild.data; res.srcText = res.srcText.replace(/\n\-\^$/, ""); } catch (ex) { res.srcText = ""; } try { var s = this.documentElement.firstChild.data; var re = /XML Parsing Error\:(.+)\nLocation\:(.+)\nLine Number(\d+)\,Column(\d+)/; var a = re.exec(s); res.reason = a[1]; res.url = a[2]; res.line = a[3]; res.linepos = a[4]; } catch (ex) { res.reason = "Uknown"; } } return res; }); Node.prototype.__defineGetter__("xml", function() { return ( new XMLSerializer).serializeToString(this); } ); Attr.prototype.__defineGetter__("xml", function() { var nv = ( new XMLSerializer).serializeToString(this); return this.nodeName + "=\"" + nv.replace(/\"/g, """) + "\""; }); Text.prototype.__defineGetter__("text", function() { return this.nodeValue; } ); Node.prototype.__defineGetter__("text", function() { var cs = this.childNodes; var l = cs.length; var sb = new Array(l); for (var i = 0; i < l; i++) sb[i] = cs[i].text; return sb.join(""); }); Node.prototype.selectNodes = function(sExpr) { var doc = this.nodeType == 9 ? this : this.ownerDocument; var nsRes = doc.createNSResolver(this.nodeType == 9 ? this.documentElement : this); var xpRes = doc.evaluate(sExpr, this, nsRes, 5, null); var res = []; var item; while ((item = xpRes.iterateNext())) res.push(item); return res; }; Node.prototype.selectSingleNode = function(sExpr) { var doc = this.nodeType == 9 ? this : this.ownerDocument; var nsRes = doc.createNSResolver(this.nodeType == 9 ? this.documentElement : this); var xpRes = doc.evaluate(sExpr, this, nsRes, 9, null); return xpRes.singleNodeValue; }; Node.prototype.transformNode = function(oXsltNode) { var doc = this.nodeType == 9 ? this : this.ownerDocument; var processor = new XSLTProcessor(); processor.importStylesheet(oXsltNode); var df = processor.transformToFragment(this, doc); return df.xml; }; Node.prototype.transformNodeToObject = function(oXsltNode, oOutputDocument) { var doc = this.nodeType == 9 ? this : this.ownerDocument; var outDoc = oOutputDocument.nodeType == 9 ? oOutputDocument : oOutputDocument.ownerDocument; var processor = new XSLTProcessor(); processor.importStylesheet(oXsltNode); var df = processor.transformToFragment(this, doc); while (oOutputDocument.hasChildNodes()) oOutputDocument.removeChild(oOutputDocument.lastChild); var cs = df.childNodes; var l = cs.length; for (var i = 0; i < l; i++) oOutputDocument.appendChild(outDoc.importNode(cs[i], true)); };}function biExec(sRootPath, sAdfRelPath, bUseCurrentWindow){ var left, top, width, height, centered, resizable, fullScreen; var adfPath, adfName; function _toPixel(s, sAxis) { if (String(s).indexOf("%") != -1) { var n = Number(s.replace(/\%/g, "")); return n / 100 * (sAxis == "x" ? screen.availWidth : screen.availHeight); } return s; } function _getAttr(el, name, def, tp) { var res; if (!el || !el.getAttribute(name)) res = def; else res = el.getAttribute(name); if (tp) return _toPixel(res, tp); return res; } sRootPath = String(sRootPath); sAdfRelPath = String(sAdfRelPath); if (sRootPath.charAt(sRootPath.length - 1) != "/") sRootPath = sRootPath + "/"; var re = /([^\/]+\/)?(\w+)(\.[^\/]*)?$/; var ok = re.test(sAdfRelPath); if (ok) adfName = RegExp.$2; else errorMessage = "The ADF argument cannot be parsed"; if (/(^http\:)|(^https\:)|(^file\:)|(^\/)/.test(sAdfRelPath)) { adfPath = sAdfRelPath; } else { var curPath = document.location.href; slashIndex = curPath.lastIndexOf("/"); curPath = curPath.substring(0, slashIndex); adfPath = curPath + "/" + sAdfRelPath; } var uri = sRootPath + "bimain.html?Adf=" + encodeURIComponent(adfPath) + ";AdfName=" + adfName + ";Params=" + Math.max(0, (arguments.length - 3)); for (var i = 3; i < arguments.length; i++) { uri += ";Param" + (i - 3) + "=" + encodeURIComponent(arguments[i]); } var fs = /^file\:/.test(adfPath); var error = false; var errorMessage = ""; var xmlHttp = new BiXmlHttp(); xmlHttp.open("GET", adfPath, false); try { xmlHttp.send(null); } catch (ex) { error = true; errorMessage = "File not found" } if (!error) { if (fs) { var s = String(xmlHttp.responseText).replace(/<\?xml[^\?]*\?>/, ""); xmlHttp.responseXML.loadXML(s); } else if (xmlHttp.status != 200) { error = true; errorMessage = xmlHttp.status + ": " + xmlHttp.statusText; } } if (!error) { if (xmlHttp.responseXML.parseError.errorCode != 0) { error = true; errorMessage = xmlHttp.responseXML.parseError.reason; } } if (!error) { var doc = xmlHttp.responseXML; var n = doc.selectSingleNode("/application/window | /Application/Window"); left = _getAttr(n, "left", "", "x"); right = _getAttr(n, "right", "", "x"); top = _getAttr(n, "top", "", "y"); bottom = _getAttr(n, "bottom", "", "y"); width = _getAttr(n, "width", "", "x"); height = _getAttr(n, "height", "", "y"); centered = _getAttr(n, "centered", "false") == "true"; resizable = _getAttr(n, "resizable", "true") != "false"; fullScreen = _getAttr(n, "fullScreen", "false") == "true"; var sw = screen.width; var sh = screen.height; if (right != "" && width != "") left = sw - width - right; else if (left != "" && right != "") width = sw - left - right; if (bottom != "" && height != "") top = sh - height - bottom; else if (top != "" && bottom != "") height = sh - top - bottom; if (left == "" && right == "" && centered) left = (sw - width) / 2; if (top == "" && bottom == "" && centered) top = (sh - height) / 2; if (!bUseCurrentWindow) { var w = window.open(uri, adfName, "menubar=0,location=0,status=0,toolbar=0,scrollbars=1" + (left ? ",left=" + left : "") + (top ? ",top=" + top : "") + (width ? ",width=" + (width - 8) : "") + (height ? ",height=" + (height - 32) : "") + (fullScreen ? ",fullscreen=1" : "") + (resizable ? ",resizable=1" : ""), false); w.focus(); } else { document.location.href = uri; window.focus(); } } else alert(errorMessage); return !error;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -