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

📄 bilauncher.js

📁 ajax 框价.是个好工具.javascript 矿家.可以用在任何平台.
💻 JS
字号:
/* * Bindows 1.5 * http://www.bindows.net/ * Copyright (c) 2003-2005 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. */var _biInPrototype=false;function _biExtend(fConstr,fSuperConstr,sName){_biInPrototype=true;var p=fConstr.prototype=new fSuperConstr;if(sName){p._className=sName;}
p.constructor=fConstr;_biInPrototype=false;return p;}
function BiXmlHttp()
{if(_biInPrototype)return;if(window.XMLHttpRequest)
return new XMLHttpRequest();else if(window.ActiveXObject)
return new ActiveXObject(BiXmlHttp._activeXName);throw new Error("Your browser does not support XML HTTP Requests");}
BiXmlHttp.prototype=new Object;BiXmlHttp.create=function(){return new BiXmlHttp();};function BiXmlDocument(){if(_biInPrototype)return;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);throw new Error("Your browser does not support creating DOM documents at runtime");}
BiXmlDocument.prototype=new Object;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");}
if(window.XMLHttpRequest)
{(function(){var _xmlDocPrototype=XMLDocument.prototype;_xmlDocPrototype.__proto__={__proto__:_xmlDocPrototype.__proto__};var _p=_xmlDocPrototype.__proto__;_p.createNode=function(aType,aName,aNamespace)
{switch(aType)
{case 1:if(aNamespace&&aNamespace!="")
return this.createElementNS(aNamespace,aName);else return this.createElement(aName);case 2:if(aNamespace&&aNamespace!="")
return this.createAttributeNS(aNamespace,aName);else return this.createAttribute(aName);case 3:default:return this.createTextNode("");}};_p.__realLoad=_xmlDocPrototype.load;_p.load=function(sUri)
{this.readyState=0;this.__realLoad(sUri);};_p.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));};_p.setProperty=function(sName,sValue)
{if(sName=="SelectionNamespaces")
{this._selectionNamespaces={};var parts=sValue.split(/\s+/);var re= /^xmlns\:([^=]+)\=((\"([^\"]*)\")|(\'([^\']*)\'))$/;for(var i=0;i<parts.length;i++)
{re.test(parts[i]);this._selectionNamespaces[RegExp.$1]=RegExp.$4||RegExp.$6;}}};_p.__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;});_p.__defineGetter__("onreadystatechange",function()
{return this._onreadystatechange;});BiXmlDocument._mozHasParseError=function(oDoc)
{return!oDoc.documentElement||oDoc.documentElement.localName=="parsererror"&&oDoc.documentElement.getAttribute("xmlns")=="http://www.mozilla.org/newlayout/xml/parsererror.xml";};_p.__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="Unknown";}}
return res;});var _nodePrototype=Node.prototype;_nodePrototype.__proto__={__proto__:_nodePrototype.__proto__};_p=_nodePrototype.__proto__;_p.__defineGetter__("xml",function()
{return(new XMLSerializer).serializeToString(this);});_p.__defineGetter__("baseName",function()
{var lParts=this.nodeName.split(":");return lParts[lParts.length-1];});_p.__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("");});_p.selectNodes=function(sExpr)
{var doc=this.nodeType==9?this:this.ownerDocument;var nsRes=doc.createNSResolver(this.nodeType==9?this.documentElement:this);var nsRes2;if(doc._selectionNamespaces)
{nsRes2=function(s)
{if(s in doc._selectionNamespaces)
return doc._selectionNamespaces[s];return nsRes.lookupNamespaceURI(s);};}
else nsRes2=nsRes;var xpRes=doc.evaluate(sExpr,this,nsRes2,5,null);var res=[];var item;while((item=xpRes.iterateNext()))
res.push(item);return res;};_p.selectSingleNode=function(sExpr)
{var doc=this.nodeType==9?this:this.ownerDocument;var nsRes=doc.createNSResolver(this.nodeType==9?this.documentElement:this);var nsRes2;if(doc._selectionNamespaces)
{nsRes2=function(s)
{if(s in doc._selectionNamespaces)
return doc._selectionNamespaces[s];return nsRes.lookupNamespaceURI(s);};}
else nsRes2=nsRes;var xpRes=doc.evaluate(sExpr,this,nsRes2,9,null);return xpRes.singleNodeValue;};_p.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;};_p.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));};var _attrPrototype=Attr.prototype;_attrPrototype.__proto__={__proto__:_attrPrototype.__proto__};_p=_attrPrototype.__proto__;_p.__defineGetter__("xml",function()
{var nv=(new XMLSerializer).serializeToString(this);return this.nodeName+"=\""+nv.replace(/\"/g,"&quot;")+"\"";});var _textPrototype=Text.prototype;_textPrototype.__proto__={__proto__:_textPrototype.__proto__};_p=_textPrototype.__proto__;_p.__defineGetter__("text",function()
{return this.nodeValue;});})();}
if(typeof BiObject=="undefined")
BiObject=new Function;function BiBrowserCheck(){if(_biInPrototype)return;if(BiBrowserCheck._singleton)
return BiBrowserCheck._singleton;var ua=navigator.userAgent;this._ie= /msie/i.test(ua);this._moz=navigator.product=="Gecko";this._platform=navigator.platform;if(this._moz)
{/rv\:([^\);]+)(\)|;)/.test(ua);this._version=RegExp.$1;this._ie55=false;this._ie6=false;this._hta=false;}
else {/MSIE\s+([^\);]+)(\)|;)/.test(ua);this._version=RegExp.$1;this._ie55= /msie 5\.5/i.test(ua);this._ie6= /msie 6/i.test(ua);this._hta=!window.external;}
BiBrowserCheck._singleton=this;}
_p=_biExtend(BiBrowserCheck,BiObject,"BiBrowserCheck");_p.getIe=function()
{return this._ie;};_p.getIe55=function()
{return	this._ie55;};_p.getIe6=function()
{return this._ie6;};_p.getMoz=function()
{return this._moz;};_p.getVersion=function()
{return this._version;};_p.getPlatform=function()
{return this._platform;};_p.getHta=function(){return this._hta;};(function(){var bc=new BiBrowserCheck;BiBrowserCheck.ie=bc.getIe();BiBrowserCheck.ie55=bc.getIe55();BiBrowserCheck.ie6=bc.getIe6();BiBrowserCheck.moz=bc.getMoz();BiBrowserCheck.version=bc.getVersion();BiBrowserCheck.platform=bc.getPlatform();BiBrowserCheck.hta=bc.getHta();bc=null;})();function BiLauncher(sRootPath)
{if(_biInPrototype)return;if(sRootPath)
this.setRootPath(sRootPath);this._arguments=[];}
_p=_biExtend(BiLauncher,Object,"BiLauncher");_p._reuseWindow=true;_p._newWindow=true;_p._errorMessage="";_p._accessibilityMode=false;_p._focusOnLoad=true;BiLauncher.MISSING_ADF_ARGUMENT="Missing ADF argument";BiLauncher.ADF_ARGUMENT_PARSE_ERROR="The ADF argument cannot be parsed";BiLauncher.IE_ERROR_PLATFORM="Bindows requires Internet Explorer for Windows"
BiLauncher.IE_ERROR_VERSION="Bindows requires Internet Explorer 5.5 or later"
BiLauncher.GECKO_ERROR_VERSION="Bindows requires Mozilla (Gecko) 1.4 or later"
BiLauncher.NOT_SUPPORTED_ERROR="Bindows requires Internet Explorer 5.5+ or Mozilla 1.4+"
BiLauncher.FILE_NOT_FOUND="File not found";BiLauncher.POPUP_BLOCKER_QUESTION="Failed to open window. Are you using a popup blocker?";_p.getReuseWindow=function()
{return this._reuseWindow;};_p.setReuseWindow=function(b)
{this._reuseWindow=b;};_p.getNewWindow=function()
{return this._newWindow;};_p.setNewWindow=function(b)
{this._newWindow=b;};_p.getWindow=function()
{return this._window||null;};_p.getRootPath=function()
{return this._rootPath;};_p.setRootPath=function(s)
{s=String(s);if(s.charAt(s.length-1)!="/")
s+="/";this._rootPath=s;};_p.getAdfPath=function()
{return this._adfPath;};_p.setAdfPath=function(s)
{if(s==null||s=="")
{this._errorMessage=BiLauncher.MISSING_ADF_ARGUMENT;return;}
s=String(s);var re= /([^\/]+\/)?(\w+)(\.[^\/]*)?$/;if(re.test(s))
{this._adfName=RegExp.$2;this._adfPath=s;}
else {this._errorMessage=BiLauncher.ADF_ARGUMENT_PARSE_ERROR;}};_p.getAdfName=function()
{return this._adfName;};_p.setAdfName=function(s)
{this._adfName=s;};_p.getArguments=function()
{return this._arguments;};_p.setArguments=function(a)
{this._arguments=[];for(var i=0;i<a.length;i++)
this._arguments.push(String(a[i]));};_p.getTarget=function()
{return this._target;};_p.setTarget=function(s)
{this._target=s;};_p.getFocusOnLoad=function()
{return this._focusOnLoad;};_p.setFocusOnLoad=function(b)
{this._focusOnLoad=b;};_p.getSupported=function()
{var br=new BiBrowserCheck;var p,v;if(br.getIe())
{p=String(br.getPlatform()).toLowerCase();if(p!="win32"&&p!="win64")
{this._errorMessage=BiLauncher.IE_ERROR_PLATFORM;return false;}
v=br.getVersion();if(v<"5.5")
{this._errorMessage=BiLauncher.IE_ERROR_VERSION;return false;}
return true;}
else if(br.getMoz())
{v=br.getVersion();if(v<"1.4")
{this._errorMessage=BiLauncher.GECKO_ERROR_VERSION;return false;}
return true;}
this._errorMessage=NOT_SUPPORTED_ERROR;return false;};_p.getErrorMessage=function()
{return this._errorMessage;};_p.getHasError=function()
{return this._errorMessage!="";};BiLauncher.prototype.launch=function(sAdfPath,oArgs)
{var left,right,top,bottom,width,height,centered,resizable,fullScreen;var adfPath,adfName,args;if(!this.getSupported())
return false;if(sAdfPath)
this.setAdfPath(sAdfPath);if(this.getHasError())
return false;var bUseCurrentWindow=!this.getNewWindow();var sRootPath=this.getRootPath();var sAdfRelPath=this.getAdfPath();if(arguments.length>1)
{args=[];for(var i=1;i<arguments.length;i++)
args.push(arguments[i]);this.setArguments(args);}
adfName=this.getAdfName();args=this.getArguments();if(/(^http\:)|(^https\:)|(^file\:)|(^\/)/.test(sAdfRelPath))
{adfPath=sAdfRelPath;}
else {var curPath=document.location.href;var slashIndex=curPath.lastIndexOf("/");curPath=curPath.substring(0,slashIndex);adfPath=curPath+"/"+sAdfRelPath;}
var uri=sRootPath+"bimain.html?Adf="+encodeURIComponent(adfPath)+";AdfName="+adfName+";Params="+args.length;for(i=0;i<args.length;i++)
{uri+=";Param"+i+"="+encodeURIComponent(args[i]);}
var xmlHttp=new BiXmlHttp;xmlHttp.open("GET",adfPath,false);try
{xmlHttp.send(null);}
catch(ex)
{this._errorMessage=BiLauncher.FILE_NOT_FOUND;return false;}
var fs= /^file\:/.test(adfPath);if(fs)
{var s=String(xmlHttp.responseText).replace(/<\?xml[^\?]*\?>/,"");xmlHttp.responseXML.loadXML(s);}
else if(xmlHttp.status!=200)
{this._errorMessage=xmlHttp.status+": "+xmlHttp.statusText;return false;}
if(xmlHttp.responseXML.parseError.errorCode!=0)
{this._errorMessage=xmlHttp.responseXML.parseError.reason;return false;}
var doc=xmlHttp.responseXML;var n=doc.selectSingleNode("/application/window | /Application/Window");left=BiLauncher._getAttr(n,"left","","x");right=BiLauncher._getAttr(n,"right","","x");top=BiLauncher._getAttr(n,"top","","y");bottom=BiLauncher._getAttr(n,"bottom","","y");width=BiLauncher._getAttr(n,"width","","x");height=BiLauncher._getAttr(n,"height","","y");centered=BiLauncher._getAttr(n,"centered","false")=="true";resizable=BiLauncher._getAttr(n,"resizable","true")!="false";fullScreen=BiLauncher._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;n=doc.selectSingleNode("/application/@focusOnLoad | /Application/@focusOnLoad");if(n)
this._focusOnLoad=n.text!="false";if(!bUseCurrentWindow)
{var windowName=this.getReuseWindow()?this._target||adfName:"";var w=window.open(uri,windowName,"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);if(!w)
{this._errorMessage=BiLauncher.POPUP_BLOCKER_QUESTION;return false;}
if(this._focusOnLoad)
w.focus();this._window=w;}
else {document.location.href=uri;if(this._focusOnLoad)
window.focus();this._window=window;}
return true;};BiLauncher._toPixel=function(s,sAxis)
{if(String(s).indexOf("%")!= -1)
{var n=Number(s.replace(/\%/g,""));return n/100*(sAxis=="x"?screen.availWidth:screen.availHeight);}
return s;};BiLauncher._getAttr=function(el,name,def,tp)
{var res;if(!el||!el.getAttribute(name))
res=def;else res=el.getAttribute(name);if(tp)
return BiLauncher._toPixel(res,tp);return res;};function biExec(sRootPath,sAdfRelPath,bUseCurrentWindow)
{var args=[sAdfRelPath];for(var i=3;i<arguments.length;i++)
args.push(arguments[i]);var l=new BiLauncher(sRootPath);l.setAdfPath(sAdfRelPath);l.setNewWindow(!bUseCurrentWindow);var ok=l.launch.apply(l,args);if(!ok)
alert(l.getErrorMessage())
return ok;}

⌨️ 快捷键说明

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