📄 runtime.js
字号:
var _jsvmCoreFunc_runtime=function(){var jsre=_JSVM_Namespace.runtimeEnvironment;var Exception=_JSVM_Namespace.kernel.Exception;var func=function(name,code){jsre.JSVM.getContainer().putClassCode(name,code);jsre.JSVM.logs.log("--- load class resouce: "+name);}
func("js.lang.ArgumentException","(function(){_$package(\"js.lang\");var Exception=_$import(\"js.lang.Exception\");var $class=js.lang.ArgumentException=function(){return $ArgumentException.apply(this,arguments);};var ArgumentException=$class;$class.$extends(Exception);var $ArgumentException=function(msg){if(msg==null){arguments=[\"The arguments illegal.\"];}\r\n$class.$super.apply(this,arguments);}})();");func("js.lang.BObject","(function(){_$package(\"js.lang\");var System=_$import(\"js.lang.System\");var NotSupportException=_$import(\"js.lang.NotSupportException\");var $class=js.lang.BObject=function(){return $BObject.apply(this,arguments);};var BObject=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $BObject=function(){if(!(System.isIeBrowser()||System.isMozBrowser())){throw new NotSupportException(\"BObject only support in Browser (IE5+ or Moz) !\");}}\r\nvar uidPrefix=\"_jbo_\"+new Date().getTime()+\"_\";var sequence=0;BObject.createUniqueId=function(obj){if(obj!=null&&typeof(obj)==\"object\"){if(obj.uniqueID!=null){return obj.uniqueID;}\r\nreturn obj.uniqueID=uidPrefix+(sequence++);}\r\nreturn uidPrefix+(sequence++);}\r\nBObject.prototype.getUniqueId=function(){return BObject.createUniqueId(this);}\r\nvar container={};BObject.prototype.globalize=function(bool){var uid=this.getUniqueId();container[uid]=this;if(bool==true){eval(\"window.\"+uid+\" = this;\");}}\r\nBObject.prototype.unglobalize=function(){var uid=this.getUniqueId();delete container[uid];eval(\"delete window.\"+uid);}\r\nBObject.getGlobalObjectByUniqueId=function(sId){return container[sId];}\r\nBObject.getAllGlobalObjects=function(){var objs=[],i=0;for(var uid in container){objs[i++]=container[uid];}\r\nreturn objs;}})();");func("js.lang.Cloneable","(function(){_$package(\"js.lang\");var JObject=_$import(\"js.lang.JObject\");var ArgumentException=_$import(\"js.lang.ArgumentException\");var $class=js.lang.Cloneable=function(){return $Cloneable.apply(this,arguments);};var Cloneable=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $Cloneable=function(){}\r\nCloneable.prototype.clone=function(){var co=this.getClass().newInstance();for(var p in this){var v=this[p];if(typeof(v)==\"function\"){continue;}\r\nco[p]=v;}\r\nreturn co;}\r\nCloneable.cloneObject=function(o){if(o instanceof Cloneable){return o.clone();}\r\nvar type=typeof(o);switch(type){case \"undefined\":case \"boolean\":case \"string\":case \"number\":return o;case \"function\":return o;case \"object\":if(o==null){return null;}\r\nif(o instanceof Date){return new Date(o.getTime());}\r\nif(o instanceof Number){return new Number(o.valueOf());}\r\nif(o instanceof Boolean){return new Boolean(o.valueOf());}\r\nif(o instanceof Error){return new Error(o.number,o.message);}\r\nif(o instanceof Array){return o.concat([]);}\r\nif(o instanceof JObject){throw new ArgumentException(Cloneable.getName()+\".cloneObject(o) error, coundn't clone a '\"+o.getClass().getName()+\"' instance.\");}\r\nif(o instanceof Object){var co={};for(var k in o){co[k]=o[k];}\r\nreturn co;}\r\ndefault:break;}\r\nthrow new ArgumentException(Cloneable.getName()+\".cloneObject(o) error, [type: \"+type+\"]\");}})();");func("js.lang.Exception","(function(){_$package(\"js.lang\");js.lang.Exception=function(message,cause){js.lang.Exception.$super.call(this,0,message,cause);}\r\njs.lang.Exception.$extends(_JSVM_Namespace.kernel.Exception);})();");func("js.lang.JObject","(function(){_$package(\"js.lang\");js.lang.JObject=_JSVM_Namespace.kernel.Object;js.lang.JObject.$super=Object;})();");func("js.lang.NotSupportException","(function(){_$package(\"js.lang\");var Exception=_$import(\"js.lang.Exception\");var $class=js.lang.NotSupportException=function(){return $NotSupportException.apply(this,arguments);};var NotSupportException=$class;$class.$extends(Exception);var $NotSupportException=function(msg){if(msg==null){arguments=[\"System don't support!\"];}\r\n$class.$super.apply(this,arguments);}})();");func("js.lang.RuntimeException","(function(){_$package(\"js.lang\");var Exception=_$import(\"js.lang.Exception\");var $class=js.lang.RuntimeException=function(){return $RuntimeException.apply(this,arguments);};var RuntimeException=$class;$class.$extends(Exception);var $RuntimeException=function(msg){if(msg==null){arguments=[\"Runtime Exception.\"];}\r\n$class.$super.apply(this,arguments);}})();");func("js.lang.StringBuffer","(function(){_$package(\"js.lang\");var $class=js.lang.StringBuffer=function(){return $StringBuffer.apply(this,arguments);};var StringBuffer=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $StringBuffer=function(s){var strs=[];var str=null;var curr=0;this.append=function(s){strs[curr++]=(s==null)?\"\":s.toString();str=null;return this;}\r\nthis.insert=function(index,s){var v=this.toString();str=v.substring(0,index)+s+v.substring(index);strs=[str];curr=1;return this;}\r\nthis.indexOf=function(s){return this.toString().indexOf(s);}\r\nthis.lastIndexOf=function(s){return this.toString().lastIndexOf(s);}\r\nthis.substring=function(st,ed){return(ed)?this.toString().substring(st):this.toString().substring(st,ed);}\r\nthis.toString=function(){if(str==null){str=strs.join(\"\");strs=[str];curr=1;}\r\nreturn str;}\r\nthis.length=function(){return this.toString().length;}\r\nthis.setLength=function(l){l=(l<0)?0:l;l=(l>this.length())?this.length():l;str=str.substring(0,l);strs=new Array(str);curr=1;}\r\nif(s!=null){this.append(s);}}})();");func("js.lang.System","(function(){_$package(\"js.lang\");var NotSupportException=_$import(\"js.lang.NotSupportException\");var $class=js.lang.System=function(){return $System.apply(this,arguments);};var System=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $System=function(){throw NotSupportException(System.getName()+\" cannot be instantiated.\");}\r\nSystem.NS=_JSVM_Namespace;System.VM=_JSVM_Namespace.runtimeEnvironment.JSVM;System.getRuntimeEnvironment=function(){return _JSVM_Namespace.runtimeEnvironment;}\r\nvar _platform=null;System.getPlatform=function(){if(_platform!=null){return _platform;}\r\nif(typeof(navigator)==\"undefined\"){return \"not-browser\";}\r\nvar ua=navigator.userAgent.toLowerCase();if(/msie/i.test(ua)){if(/msie 6/i.test(ua)){_platform=\"ie6\";}else if(/msie 5\\.5/i.test(ua)){_platform=\"ie5.5\";}else if(/msie 5\\.[^5]/i.test(ua)){_platform=\"ie5\";}else{_platform=\"ie\";}}else if(/gecko/i.test(ua)){_platform=\"moz\";}else if(/opera/i.test(ua)){_platform=\"opera\";}else{_platform=\"other\";}\r\nreturn _platform;}\r\nSystem.isIeBrowser=function(){return(System.getPlatform().indexOf(\"ie\")!=-1);}\r\nSystem.isMozBrowser=function(){return System.getPlatform()==\"moz\";}\r\nSystem.isDebug=function(){return System.getRuntimeEnvironment().debug;}\r\nSystem.exit=function(){if(!(System.isMozBrowser()||System.isIeBrowser())){throw new NotSupportException(\"The Platform Must be IE5+ or Moz Browser!\");}else if(System.getPlatform()<\"ie6\"){var str=\"<object id='noTipClose' \"+\"classid='clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11'>\"+\"<param name='Command' value='close'></object>\";document.body.insertAdjacentHTML(\"beforeEnd\",str);document.all.noTipClose.Click();}else{window.opener=null;window.close();}}\r\nSystem.getClassloader=function(){return System.VM.getClassloader();}\r\nSystem.getBaseHome=function(){return System.getRuntimeEnvironment().jsvmHome;}\r\nSystem.getSystemHome=function(){return System.getRuntimeEnvironment().jsvmHome+\"/bin\";}\r\nSystem.getClassHome=function(){var jsre=System.getRuntimeEnvironment();return((tmp=jsre.config.getParameter(\"class_home\"))==null)?(jsre.jsvmHome+\"/classes\"):tmp.replace(\"${jsvmHome}\",jsre.jsvmHome);}\r\nSystem.getLibHome=function(){var jsre=System.getRuntimeEnvironment();return((tmp=jsre.config.getParameter(\"lib_home\"))==null)?(jsre.jsvmHome+\"/lib\"):tmp.replace(\"${jsvmHome}\",jsre.jsvmHome);}\r\nSystem.getResourceHome=function(){var jsre=System.getRuntimeEnvironment();return((tmp=jsre.config.getParameter(\"res_home\"))==null)?(jsre.jsvmHome+\"/res\"):tmp.replace(\"${jsvmHome}\",jsre.jsvmHome);}\r\nSystem.getSystemVariable=function(name){return System.getRuntimeEnvironment().config.getParameter(name);}\r\nSystem.getPlugIn=function(name){return _JSVM_Namespace.plugIn[name];}\r\nSystem.out={print:function(s){System.VM.console.output(s);},println:function(s){System.VM.console.output(s+\"\\r\\n\");}}})();");func("js.dom.Window","(function(){_$package(\"js.dom\");var System=_$import(\"js.lang.System\");var BObject=_$import(\"js.lang.BObject\");var $class=js.dom.Window=function(){return $Window.apply(this,arguments);};var Window=$class;$class.$extends(BObject);var $Window=function(src){$class.$super.call(this);this.sourceCode=src;this.width=null;this.height=null;this.top=null;this.left=null;this.toolbar=null;this.location=null;this.directories=null;this.menubar=null;this.scrollbars=null;this.resizable=null;this.status=\"yes\";this.name=\"window_\"+new Date().getTime();this.handle=null;}\r\nWindow.prototype.getWindowStyle=function(){return(((this.width!=null)?(\"width=\"+this.width+\",\"):\"\")+((this.height!=null)?(\"height=\"+this.height+\",\"):\"\")+((this.top!=null)?(\"top=\"+this.top+\",\"):\"\")+((this.left!=null)?(\"left=\"+this.left+\",\"):\"\")+((this.toolbar!=null)?(\"toolbar=\"+this.toolbar+\",\"):\"\")+((this.location!=null)?(\"location=\"+this.location+\",\"):\"\")+((this.directories!=null)?(\"directories=\"+this.directories+\",\"):\"\")+((this.menubar!=null)?(\"menubar=\"+this.menubar+\",\"):\"\")+((this.scrollbars!=null)?(\"scrollbars=\"+this.scrollbars+\",\"):\"\")+((this.resizable!=null)?(\"resizable=\"+this.resizable+\",\"):\"\")+((this.status!=null)?(\"status=\"+this.status+\",\"):\"\")).replace(/,$/,\"\");}\r\nWindow.prototype.show=function(arg){var args={};args.arguments=arg;args.window=window;var handle=this.open(args);handle.document.open();handle.document.write(this.sourceCode);handle.window.windowArguments=args;handle.window.owner=this;handle.window.setInterval(\"try{if(!owner.live())window.close();}\"+\"catch(e){window.close();}\",3250);handle.document.close();return(this.handle=handle);}\r\nWindow.prototype.open=function(){return window.open(((document.URL.toLowerCase().indexOf(\"https\")==0)?Window.getCommonWebURL():\"about:blank\"),this.name,this.getWindowStyle());}\r\nWindow.prototype.close=function(){if(this.isActive()){this.handle.close();}}\r\nWindow.prototype.focus=function(){if(this.isActive()){this.handle.focus();}}\r\nWindow.prototype.isActive=function(){try{return(this.handle!=null&&!this.handle.closed);}catch(ex){return false;}}\r\nWindow.prototype.valueOf=function(){return this.handle;}\r\nWindow.getCommonWebURL=function(){return(System.getSystemHome()+\"/res/__web.htm\");}})();");func("js.dom.StyleSheet","(function(){_$package(\"js.dom\");var System=_$import(\"js.lang.System\");var BObject=_$import(\"js.lang.BObject\");var $class=js.dom.StyleSheet=function(){return $StyleSheet.apply(this,arguments);};var StyleSheet=$class;$class.$extends(BObject);var $StyleSheet=function(cs){this.styleSheet=cs;}\r\nStyleSheet.prototype.addRule=function(sSelector,sStyle,iIndex){if(iIndex==null){iIndex=(js.lang.System.isIeBrowser())?this.styleSheet.rules.length:this.styleSheet.cssRules.length;}\r\nif(js.lang.System.isIeBrowser()){this.styleSheet.addRule(sSelector,sStyle,iIndex);}\r\nif(js.lang.System.isMozBrowser()){this.styleSheet.insertRule(sSelector+\" { \"+sStyle+\"} \",iIndex);}}\r\nStyleSheet.prototype.removeRule=function(iIndex){if(js.lang.System.isIeBrowser()){this.styleSheet.removeRule(iIndex);}\r\nif(js.lang.System.isMozBrowser()){this.styleSheet.deleteRule(iIndex);}}\r\nStyleSheet.create=function(doc){doc=doc||document;var element=doc.createElement(\"style\");doc.getElementsByTagName(\"HEAD\")[0].appendChild(element);var len=doc.styleSheets.length;return new StyleSheet(doc.styleSheets.item(len-1));}\r\nStyleSheet.addCssLink=function(url,doc){doc=doc||document;if(System.isIeBrowser()){return doc.createStyleSheet(url);}else{var elmt=doc.createElement(\"link\");doc.getElementsByTagName(\"HEAD\")[0].appendChild(elmt);elmt.setAttribute(\"rel\",\"stylesheet\");elmt.setAttribute(\"href\",url);return elmt;}}})();");func("js.io.Cookie","(function(){_$package(\"js.io\");var BObject=_$import(\"js.lang.BObject\");var $class=js.io.Cookie=function(){return $Cookie.apply(this,arguments);};var Cookie=$class;$class.$extends(BObject);var $Cookie=function(){}\r\nCookie.prototype.setValue=function(key,value){document.cookie=key+\"=\"+escape(value);}\r\nCookie.prototype.getValue=function(key){return(new RegExp(\" \"+key+\"=([^;]*)\").test(\" \"+document.cookie))?unescape(RegExp.$1).split(\",\")[0]:null;}})();");func("js.io.File","(function(){_$package(\"js.io\");var $class=js.io.File=function(){return $File.apply(this,arguments);};var File=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $File=function(path,type){this.path=path;this.type=type;this.data=null;}\r\nFile.prototype.getFileName=function(){return(this.path==null)?null:this.path.replace(/^(.*)[\\/\\\\]/,\"\");}\r\nFile.prototype.getPath=function(){return this.path;}\r\nFile.prototype.read=function(){return this.data;}\r\nFile.prototype.write=function(data){this.data=data;}})();");func("js.io.IOException","(function(){_$package(\"js.io\");var Exception=_$import(\"js.lang.Exception\");var $class=js.io.IOException=function(){return $IOException.apply(this,arguments);};var IOException=$class;$class.$extends(Exception);var $IOException=function(msg){if(msg==null){arguments=[\"Input/Output Error.\"];}\r\n$class.$super.apply(this,arguments);}})();");func("js.io.Serializer","(function(){_$package(\"js.io\");var JObject=_$import(\"js.lang.JObject\");var IOException=_$import(\"js.io.IOException\");var XmlDom=_$import(\"js.net.XmlDom\");var HashMap=_$import(\"js.util.HashMap\");var $class=js.io.Serializer=function(){return $Serializer.apply(this,arguments);};var Serializer=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $Serializer=function(){var objectMap=new js.util.HashMap();var sequence=0;var __this=this;var serializeToNode=function(obj){var node=null;var type=typeof(obj);switch(type){case \"undefined\":node=trsfmer.createElement(\"void\");break;case \"number\":node=trsfmer.createElement(\"number\",obj);break;case \"string\":node=trsfmer.createElement(\"string\",obj);break;case \"boolean\":node=trsfmer.createElement(\"boolean\",String(obj).toLowerCase());break;case \"function\":node=trsfmer.createElement(\"function\",obj.toString());break;case \"object\":if(obj==null){node=trsfmer.createElement(\"null\");}else if(obj instanceof Array){node=trsfmer.createElement(\"array\");for(var i=0;i<obj.length;i++){var _cnode=serializeToNode(obj[i]);node.appendChild(_cnode);}}else{node=trsfmer.createElement(\"object\");if(obj instanceof Date){node.setAttribute(\"type\",\"Date\");node.appendChild(trsfmer.createTextNode(obj.getTime()));}else if(obj instanceof Error){node.setAttribute(\"type\",\"Error\");node.appendChild(trsfmer.createElement(\"number\",obj.number));node.appendChild(trsfmer.createElement(\"description\",obj.description));}else if(obj instanceof String){node.setAttribute(\"type\",\"String\");node.appendChild(trsfmer.createTextNode(obj.toString()));}else if(obj instanceof Boolean){node.setAttribute(\"type\",\"Boolean\");node.appendChild(trsfmer.createTextNode(obj.valueOf()));}else if(obj instanceof Number){node.setAttribute(\"type\",\"Number\");node.appendChild(trsfmer.createTextNode(obj.valueOf()));}else if(obj instanceof RegExp){node.setAttribute(\"type\",\"RegExp\");node.appendChild(trsfmer.createTextNode(obj.source));}else if(obj instanceof Object){if(obj instanceof JObject){node.setAttribute(\"type\",obj.getClass().getName());}else{node.setAttribute(\"type\",\"Object\");}\r\nvar oid=objectMap.get(obj);if(oid!=null){node.setAttribute(\"ref\",oid);break;}else{oid=sequence++;objectMap.put(obj,oid);node.setAttribute(\"oid\",oid);}\r\nfor(var p in obj){var v=obj[p];if(typeof(v)==\"function\")continue;var pnode=trsfmer.createElement(\"member\",__this._serialize(v));pnode.setAttribute(\"name\",p);node.appendChild(pnode);}}else{node.setAttribute(\"type\",\"unknow\");}}\r\nbreak;case \"unknow\":default:node=trsfmer.createElement(\"unknow\");}\r\nreturn node;}\r\nvar unserializeFromNode=function(node){var type=node.tagName;switch(type){case \"void\":return void(0);case \"null\":return null;case \"number\":return isNaN(node.text)?Number.NaN:eval(node.text);case \"string\":return node.text;case \"boolean\":var v=new Boolean(node.text);return v.valueOf();case \"function\":return new Function(node.text);case \"array\":var nodes=node.childNodes,l=nodes.length,arr=[];for(var i=0;i<l;i++){arr[i]=unserializeFromNode(nodes[i]);}\r\nreturn arr;case \"object\":var otype=node.getAttribute(\"type\");if(otype==\"Date\"){return new Date(parseInt(node.text,10));}else if(otype==\"Error\"){return new Exception(parseInt(node.selectSingleNode(\"number\").text),node.selectSingleNode(\"description\").text);}else if(otype==\"String\"){return new String(node.text);}else if(otype==\"Boolean\"){return new Boolean(node.text);}else if(otype==\"Number\"){return new Number(node.text);}else if(otype==\"RegExp\"){return new RegExp(node.text);}else if(otype==\"unknow\"){return new Object();}else{var ref=node.getAttribute(\"ref\");if(ref!=null){return objectMap.get(ref);}\r\nvar obj=(otype==\"Object\")?{}:Class.forName(otype).newInstance();var oid=node.getAttribute(\"oid\");objectMap.put(oid,obj);var cnodes=node.selectNodes(\"member\");for(var i=0;i<cnodes.length;i++){var cnode=cnodes[i];var name=cnode.getAttribute(\"name\");var value=__this._unserialize(cnode.text);if(typeof(value)!=\"undefined\"){obj[name]=value;}}\r\nreturn obj;}\r\ncase \"unknow\":default:throw new IOException(Serializer.getName()+\": unserializeFromNode error; unknow data type.\");}}\r\nthis._serialize=function(obj){var node;return(null==(node=serializeToNode(obj)))?null:node.xml;}\r\nthis._unserialize=function(str){var node=trsfmer.transfromXMLToElement(str);if(node!=null){return unserializeFromNode(node);}\r\nthrow new IOException(Serializer.getName()+\": _unserialize() error; dataformat error.\");}}\r\nvar trsfmer=new function(){var xmldom=js.net.XmlDom.create();xmldom.async=false;this.createElement=function(name,text){var node=xmldom.createElement(name);if(typeof(text)!=\"undefined\"){node.appendChild(xmldom.createTextNode(String(text)));}\r\nreturn node;}\r\nthis.createTextNode=function(text){return xmldom.createTextNode(String(text));}\r\nthis.transfromXMLToElement=function(xml){return(xmldom.loadXML(xml))?xmldom.documentElement:null;}}\r\nSerializer.serialize=function(obj){return new Serializer()._serialize(obj);}\r\nSerializer.unserialize=function(str){return new Serializer()._unserialize(str);}})();");func("js.io.WebPrinter","(function(){_$package(\"js.io\");var BObject=_$import(\"js.lang.BObject\");var Window=_$import(\"js.dom.Window\");var $class=js.io.WebPrinter=function(){return $WebPrinter.apply(this,arguments);};var WebPrinter=$class;$class.$extends(BObject);var $WebPrinter=function(){var ds=WebPrinter.defaultStyle;this.outputWindow=new Window('<html><head><meta http-equiv=\"Content-Type\"content=\"text/html; charset=gb2312\"><title>'+'Web Printer</title>'+'<script>var owner=null;'+'function write(s){document.body.innerHTML+=s;setTimeout('+'\"document.body.scrollTop=document.body.scrollHeight;\",10);}'+'function clear(){document.body.innerHTML=\"\";}'+'document.onkeydown=function(){if(event.keyCode==116||(event.ctrlKey&&event.keyCode==78))'+'{event.keyCode=0;event.returnValue = false;}}'+'</script>'+'</head><body style=\"' + ds.style + '\"'+' scroll=\"auto\"designMode=\"on\"contentEditable=\"false\"></body></html>');this.outputWindow.width=ds.width;this.outputWindow.height=ds.height;this.outputWindow.resizable=ds.resizable;this.outputWindow.status=ds.status;}\r\nWebPrinter.defaultStyle={style:\"background-color:white;color:black;font-family:MS Sans Serif;font-size:12px;\",width:640,height:480,resizable:1,status:0};WebPrinter.prototype.stream=\"\";WebPrinter.prototype.showOutputWindow=function(){if(!this.outputWindow.isActive()){this.outputWindow.show();if(this.stream!=\"\"){this.outputWindow.handle.write(this.stream);}}}\r\nWebPrinter.prototype.closeOutputWindow=function(){this.outputWindow.close();}\r\nWebPrinter.prototype.write=function(s){this.showOutputWindow();this.outputWindow.handle.write(String(s));this.stream+=s;}\r\nWebPrinter.prototype.print=function(s){s=encodeHTML(String(s));this.write(s);}\r\nWebPrinter.prototype.println=function(s){this.print(s+\"\\r\\n\");}\r\nWebPrinter.prototype.printError=function(ex){this.write(\"<XMP style='color:red'>\"+ex+\"</XMP>\");}\r\nWebPrinter.prototype.printHTML=function(s){this.write(String(s));}\r\nWebPrinter.prototype.clear=function(){if(this.outputWindow.isActive()){this.outputWindow.handle.clear();this.stream=\"\";}}\r\nvar encodeHTML=function(s){return s.replace(/&/g,'&').replace(/\"/g,'"').replace(/</g,'<').replace(/>/g,'>').replace(/\\r\\n/g,'<br>').replace(/\\t/g,' ');}})();");func("js.net.XmlHttp","(function(){_$package(\"js.net\");var NotSupportException=_$import(\"js.lang.NotSupportException\");var System=_$import(\"js.lang.System\");var $class=js.net.XmlHttp=function(){return $XmlHttp.apply(this,arguments);};var XmlHttp=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $XmlHttp=function(){if(js.lang.System.isMozBrowser()){return new XMLHttpRequest();}else{if(progId!=null){return new ActiveXObject(progId);}\r\nfor(var i=0;i<progIds.length;i++){try{var obj=new ActiveXObject(progIds[i]);progId=progIds[i];return obj;}catch(ex){}}}\r\nthrow new js.lang.NotSupportException(\"Can't create xmlhttp object under '\"+System.getPlatform()+\"'!\");}\r\nXmlHttp.create=function(){return(System.getPlatform()==\"ie5\")?new ActiveXObject(\"Microsoft.XMLHTTP\"):new XmlHttp();}\r\nvar progIds=[\"MSXML2.XMLHTTP\",\"Microsoft.XMLHTTP\",\"MSXML.XMLHTTP\",\"MSXML3.XMLHTTP\"];var progId=null;})();");func("js.net.XmlDom","(function(){_$package(\"js.net\");var NotSupportException=_$import(\"js.lang.NotSupportException\");var System=_$import(\"js.lang.System\");var $class=js.net.XmlDom=function(){return $XmlDom.apply(this,arguments);};var XmlDom=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $XmlDom=function(){if(js.lang.System.isMozBrowser()){var doc=document.implementation.createDocument(\"\",\"\",null);if(doc.readyState==null){doc.readyState=1;doc.addEventListener(\"load\",function(){doc.readyState=4;if(typeof doc.onreadystatechange==\"function\"){doc.onreadystatechange();}},false);}\r\nreturn doc;}else{if(progId!=null){return new ActiveXObject(progId);}\r\nfor(var i=0;i<progIds.length;i++){try{var obj=new ActiveXObject(progIds[i]);progId=progIds[i];return obj;}catch(ex){}}}\r\nthrow new js.lang.NotSupportException(\"Can't create XmlDom object under '\"+System.getPlatform()+\"'!\");}\r\nXmlDom.create=function(){return(System.getPlatform()==\"ie5\")?new ActiveXObject(\"Microsoft.XMLDOM\"):new XmlDom();}\r\nvar progIds=[\"MSXML2.DOMDocument\",\"Microsoft.XMLDOM\",\"MSXML.DOMDocument\",\"MSXML3.DOMDocument\"];var progId=null;if(js.lang.System.isMozBrowser()&&window.DOMParser&&window.XMLSerializer&&window.Node){XmlDom.prototype.loadXML=Document.prototype.loadXML=function(s){var doc2=(new DOMParser()).parseFromString(s,\"text/xml\");while(this.hasChildNodes()){this.removeChild(this.lastChild);}\r\nfor(var i=0;i<doc2.childNodes.length;i++){this.appendChild(this.importNode(doc2.childNodes[i],true));}\r\ntry{doc2.childNodes[0].xml;return true;}catch(ex){return false;}};XmlDom.prototype.__defineGetter__(\"xml\",function(){return \"<?xml version=\\\"1.0\\\"?>\"+(new XMLSerializer()).serializeToString(this);});Document.prototype.__defineGetter__(\"xml\",function(){return \"<?xml version=\\\"1.0\\\"?>\"+(new XMLSerializer()).serializeToString(this);});XmlDom.prototype.createNode=function(stype,name,ns){switch(stype){case 1:return(ns==null||ns==\"\")?this.createElement(name):this.createElementNS(ns,name);case 2:return(ns==null||ns==\"\")?this.createAttribute(name):this.createAttributeNS(ns,name);case 3:default:return this.createTextNode(\"\");}}\r\nXmlDom.prototype.__realLoad=XmlDom.prototype.load;XmlDom.prototype.load=function(uri){this.readyState=0;this.__realLoad(uri);}\r\nXmlDom.prototype.__defineSetter__(\"onreadystatechange\",function(f){if(this._onreadystatechange){this.removeEventListener(\"load\",this._onreadystatechange,false);}\r\nthis._onreadystatechange=f;if(f){this.addEventListener(\"load\",f,false);}\r\nreturn f;});XmlDom.prototype.__defineGetter__(\"onreadystatechange\",function(){return this._onreadystatechange;});XmlDom._mozHasParseError=function(oDoc){return(!oDoc.documentElement)||oDoc.documentElement.localName==\"parsererror\"&&oDoc.documentElement.getAttribute(\"xmlns\")==\"http://www.mozilla.org/newlayout/xml/parsererror.xml\";}\r\nXmlDom.prototype.__defineGetter__(\"parseError\",function(){var hasError=XmlDom._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=\"\";}\r\ntry{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\";}}\r\nreturn 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,\""\") + \"\\\"\";});Node.prototype.__defineGetter__(\"baseName\",function(){var lParts=this.nodeName.split(\":\");return lParts[lParts.length-1];});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;}\r\nreturn 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 nsRes2;if(doc._selectionNamespaces){nsRes2=function(s){return doc._selectionNamespaces[s]||nsRes.lookupNamespaceURI(s);}}else{nsRes2=nsRes;}\r\nvar xpRes=doc.evaluate(sExpr,this,nsRes2,5,null);var res=[];var item;while(item=xpRes.iterateNext()){res.push(item);}\r\nreturn res;}\r\nNode.prototype.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){return doc._selectionNamespaces[s]||nsRes.lookupNamespaceURI(s);};}else{nsRes2=nsRes;}\r\nvar xpRes=doc.evaluate(sExpr,this,nsRes2,9,null);return xpRes.singleNodeValue;}\r\nNode.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;}\r\nNode.prototype.transformNodeToObject=function(oXsltNode,oOutputDocument){var doc=(this.nodeType==9)?this:this.ownerDocument;var outDoc=(oOutputDocument.nodeType==9)?oOutputDocument:oOutputDocumentOutputDocument.ownerDocument;var processor=new XSLTProcessor();processor.importStylesheet(oXsltNode);var df=processor.transformToFragment(this,doc);while(oOutputDocument.hasChildNodes()){oOutputDocument.removeChild(oOutputDocument.lastChild);}\r\nvar cs=df.childNodes;var l=cs.length;for(var i=0;i<l;i++){oOutputDocument.appendChild(outDoc.importNode(cs[i],true));}}\r\nXmlDom.prototype.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;}}}}})();");func("js.util.ArrayList","(function(){_$package(\"js.util\");var Cloneable=_$import(\"js.lang.Cloneable\");var ArgumentException=_$import(\"js.lang.ArgumentException\");var $class=js.util.ArrayList=function(){return $ArrayList.apply(this,arguments);};var ArrayList=$class;$class.$extends(Cloneable);var $ArrayList=function(){this.array=[];}\r\nArrayList.prototype.toArray=function(){return this.array;}\r\nArrayList.prototype.indexOf=function(o){var l=this.array.length;for(var i=0;i<l;i++){if(this.array[i]==o){return i;}}\r\nreturn-1;}\r\nArrayList.prototype.lastIndexOf=function(o){var l=this.array.length-1;for(var i=l;i>=0;i--){if(this.array[i]==o){return i;}}\r\nreturn-1;}\r\nArrayList.prototype.add=function(arg1,arg2){if(arguments.length==1){var l=this.array.length;this.array[l]=arg1;}else{var l1=this.array.length;var a1=this.array.slice(0,arg1);var a2=this.array.slice(arg1,l1);var l2=a1.length;a1[l2]=arg2;this.array=a1.concat(a2);}}\r\nArrayList.prototype.addAll=function(a){if(a instanceof Array){this.array=this.array.concat(a);}else if(typeof(a.toArray)==\"function\"&&((a=a.toArray())instanceof Array)){this.array=this.array.concat(a);}else{throw new ArgumentException(this.getClass().getName()+\".addAll(): arguments error.\");}}\r\nArrayList.prototype.removeAt=function(i){var l=this.array.length;if(i<0||i>=l){return null;}\r\nvar o=this.Array[i];this.array=this.array.slice(0,i).concat(this.array.slice(i+1,l));return o;}\r\nArrayList.prototype.remove=function(o){var i=this.indexOf(o);if(i==-1){return this;}\r\nreturn this.removeAt(i);}\r\nArrayList.prototype.contains=function(o){return this.indexOf(o)!=-1;}\r\nArrayList.prototype.clear=function(){this.array.length=0;}\r\nArrayList.prototype.size=function(){return this.array.length;}\r\nArrayList.prototype.get=function(i){var size=this.size();if(i>=0&&i<size){return this.array[i];}else{return null;}}\r\nArrayList.prototype.clone=function(){var o=new ArrayList();o.addAll(this.array);return o;}})();");func("js.util.HashMap","(function(){_$package(\"js.util\");var JObject=_$import(\"js.lang.JObject\");var Cloneable=_$import(\"js.lang.Cloneable\");var Iterator=_$import(\"js.util.Iterator\");var $class=js.util.HashMap=function(){return $HashMap.apply(this,arguments);};var HashMap=$class;$class.$extends(Cloneable);var $HashMap=function(){this.vos={};}\r\nHashMap.prototype.elements=function(){var a=[],i=0;for(var key in this.vos){a[i++]=this.vos[key];}\r\nreturn new Iterator(a);}\r\nHashMap.prototype.get=function(key){return this.vos[key];}\r\nHashMap.prototype.isEmpty=function(){return(this.size()==0);}\r\nHashMap.prototype.keys=function(){var a=[],i=0;for(var key in this.vos){a[i++]=key;}\r\nreturn new Iterator(a);}\r\nHashMap.prototype.put=function(key,value){var oldValue=this.vos[key];this.vos[key]=value;return oldValue;}\r\nHashMap.prototype.remove=function(key){var value=this.vos[key];delete this.vos[key];return value;}\r\nHashMap.prototype.size=function(){var l=0;for(var key in this.vos){l++;}\r\nreturn l;}\r\nHashMap.prototype.clear=function(){this.vos={};}\r\nHashMap.prototype.containsValue=function(value){for(var key in this.vos){if(this.vos[key]==value){return true;}}\r\nreturn false;}\r\nHashMap.prototype.containsKey=function(key){for(var k in this.vos){if(k==key){return true;}}\r\nreturn false;}\r\nHashMap.prototype.toArray=function(){var entities=[];for(var key in this.vos){entities[i]=new Entry(key,this.vos[key]);}\r\nreturn entities;}\r\nHashMap.prototype.clone=function(){var map=new HashMap();map.vos=Cloneable.cloneObject(this.vos);return map;}\r\nvar Entry=js.util.HashMap.Entry=function(k,v){this.key=k;this.value=v;}\r\nEntry.$extends(js.lang.JObject);Entry.prototype.$class=Entry;Entry.$name=\"js.util.HashMap.Entry\";Entry.prototype.getKey=function(){return this.key;}\r\nEntry.prototype.setValue=function(v){this.value=v;}\r\nEntry.prototype.getValue=function(){return this.value;}})();");func("js.util.Iterator","(function(){_$package(\"js.util\");var $class=js.util.Iterator=function(){return $Iterator.apply(this,arguments);};var Iterator=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $Iterator=function(aArray){var array=aArray;var index=0;this.hasNext=function(){return(array.length>index);}\r\nthis.next=function(){return array[index++];}}})();");func("js.util.Properties","(function(){_$package(\"js.util\");var Cloneable=_$import(\"js.lang.Cloneable\");var IOException=_$import(\"js.io.IOException\");var XmlHttp=_$import(\"js.net.XmlHttp\");var XmlDom=_$import(\"js.net.XmlDom\");var HashMap=_$import(\"js.util.HashMap\");var $class=js.util.Properties=function(){return $Properties.apply(this,arguments);};var Properties=$class;$class.$extends(Cloneable);var $Properties=function(){this.context=new HashMap();}\r\nProperties.prototype.getProperty=function(key,defaultValue){var value=this.context.get(key);return(value||defaultValue);}\r\nProperties.prototype.setProperty=function(key,value){this.context.put(key,String(value));}\r\nProperties.prototype.clear=function(){return this.context.clear();}\r\nProperties.prototype.propertyNames=function(){return this.context.keys();}\r\nProperties.prototype.load=function(sUrl){var xmlHttp=XmlHttp.create();try{xmlHttp.open(\"GET\",sUrl,false);xmlHttp.send(null);}catch(ex){throw new IOException(this.getClass().getName()+\".load() Fail. Cound not access the resource [url:\"+sUrl+\"].\",ex);}\r\nif(xmlHttp.status!=200&&xmlHttp.status!=0){throw new IOException(this.getClass().getName()+\".load() Fail. Cound not access the resource [url:\"+sUrl+\", HTTP-STATUS: \"+xmlHttp.status+\"].\",ex);}\r\nvar rootNode=null,text=xmlHttp.responseText;if(xmlHttp.responseXML&&xmlHttp.responseXML.documentElement){rootNode=xmlHttp.responseXML.documentElement;}else if(text.replace(/(^\\s)/g,\"\").indexOf(\"<?xml\")!=-1){var xmldoc=XmlDom.create();xmldoc.async=false;if(xmldoc.loadXML(text)){rootNode=xmldoc.documentElement;}else{throw new IOException(this.getClass().getName()+\".load() Fail. stream content format error.\",ex);}}\r\nif(rootNode!=null){var ptNodes=rootNode.selectNodes(\"entity\");var l=ptNodes.length;for(var i=0;i<l;i++){var node=ptNodes[i];this.setProperty(node.getAttribute(\"key\"),node.text);}}else{var ps=text.replace(/#([^\"\\n\\r]*)((\\r\\n)|$)/g, \"\").replace(/\\[([^\"\\n\\r]*)\\]/g,\"\").replace(/\\r\\n(\\s)*\\r\\n/g,\"\\r\\n\").split(\"\\r\\n\");for(var i=0;i<ps.length;i++){var p=ps[i];var x=p.indexOf(\"=\");if(x!=-1){var n=p.substring(0,x).replace(/(^\\s+)|\\s+$/g,\"\");var v=p.substring(x+1).replace(/(^\\s+)|\\s+$/g,\"\");this.setProperty(n,v);}}}}\r\nProperties.prototype.list=function(out){out=out||System.out;var iterator=this.propertyNames();while(iterator.hasNext()){var pn=iterator.next();out.println(pn+\"=\"+this.getProperty(pn));}}\r\nProperties.prototype.clone=function(){var ps=new Properties();ps.context=this.context.clone();return ps;}})();");func("js.util.Stack","(function(){_$package(\"js.util\");var Cloneable=_$import(\"js.lang.Cloneable\");var ArrayList=_$import(\"js.util.ArrayList\");var $class=js.util.Stack=function(){return $Stack.apply(this,arguments);};var Stack=$class;$class.$extends(Cloneable);var $Stack=function(){this.list=new js.util.ArrayList();}\r\nStack.prototype.empty=function(){return(this.list.size()==0);}\r\nStack.prototype.peek=function(){if(this.empty()){return null;}\r\nvar o=this.list.get(0);return o;}\r\nStack.prototype.pop=function(){if(this.empty()){return null;}\r\nvar o=this.list.get(0);this.list.removeAt(0);return o;}\r\nStack.prototype.push=function(o){this.list.add(0,o);}\r\nStack.prototype.search=function(o){return this.list.indexOf(o);}\r\nStack.prototype.clone=function(){var o=new Stack();o.list=this.list.clone();return o;}})();");jsre.JSVM.getCompiler().setParser("jsvm2",new function(){var regExp_package=/(^|\s|;|})(\s*)(package)(\s+)((\w+)(\.\w+)*)(\s*)/
var regExp_import=/(^|\s|;|})(\s*)(import)(\s+)((\w+\.)*(\w+))(\s*)/g;var regExp_class=/(^|\s|;|})(\s*)(class)(\s+)(\w*(\.\w*)*)((\s+)extends(\s+)(\w*(\.\w*)*))?(\s*)\(/;var regExp_super=/([^A-Za-z0-9_\$]+)super([^A-Za-z0-9_\$]+)/g;var regExps_comments=[/(\s|^)+\/\/([^\n\r])*/g,/(\/\*)\/?(([^\*]\/)|[^\/])*(\*\/)/g];var regExps_strings=[/("(\\"|[^"\n\r]|(\\\r\n))*")/g,/('(\\'|[^'\n\r]|(\\\r\n))*')/g];var strings_tmpPrefix="${COMPILE_CONST_"+new Date().getTime();var strings_tmpSuffix="}";this.parse=function(code){var constStrs=[];var tmpStrs=code.match(regExps_strings[0]);if(tmpStrs!=null){constStrs=constStrs.concat(tmpStrs);}
var tmpStrs=code.match(regExps_strings[1]);if(tmpStrs!=null){constStrs=constStrs.concat(tmpStrs);}
for(var i=0;i<constStrs.length;i++){code=code.replace(constStrs[i],(strings_tmpPrefix+i+strings_tmpSuffix));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -