📄 runtime.js
字号:
_JSVM_Namespace.runtimeEnvironment.loadModule("runtime",function(){var jsre=_JSVM_Namespace.runtimeEnvironment,JSVM=jsre.JSVM;var Exception=_JSVM_Namespace.kernel.Exception;var func=function(name,code){JSVM.getContainer().putClassCode(name,code);JSVM.logger.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(){$class.$super.apply(this,arguments.length>0?arguments:["Arguments Illegal."]);};})();');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()||System.isOperaBrowser())){throw new NotSupportException("BObject only support IE5+,Moz or Opera!");};this.uniqueID=BObject.createUniqueId();};var uidPrefix="_jbo_"+new Date().getTime().toString(16)+"_";var sequence=0;BObject.createUniqueId=function(){return uidPrefix+(sequence++);};BObject.prototype.getUniqueId=function(){return this.uniqueID;};var container={};BObject.prototype.globalize=function(bool){var uid=this.getUniqueId();container[uid]=this;if(bool==true){window[uid]=this;}};BObject.prototype.unglobalize=function(){var uid=this.getUniqueId();delete container[uid];delete window[uid];};BObject.getGlobalObjectByUniqueId=function(sId){return container[sId];};BObject.getAllGlobalObjects=function(){var objs=[],i=0;for(var uid in container){objs[i++]=container[uid];};return 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(){};Cloneable.prototype.clone=function(){var co=this.getClass().newInstance();for(var p in this){var v=this[p];if(typeof(v)=="function"){continue;};co[p]=v;};return co;};Cloneable.cloneObject=function(o){if(o instanceof Cloneable){return o.clone();};var 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;};if(o instanceof Date){return new Date(o.getTime());};if(o instanceof Number){return new Number(o.valueOf());};if(o instanceof Boolean){return new Boolean(o.valueOf());};if(o instanceof Error){return new Error(o.number,o.message);};if(o instanceof Array){return o.concat([]);};if(o instanceof JObject){throw new ArgumentException(Cloneable.getName()+".cloneObject(o) error, coundn\'t clone a \'"+o.getClass().getName()+"\' instance.");};if(o instanceof Object){var co={};for(var k in o){co[k]=o[k];};return co;};default:break;};throw 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);};js.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(){$class.$super.apply(this,arguments.length>0?arguments:["System don\'t support!"]);}})();');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(){$class.$super.apply(this,arguments.length>0?arguments:["Runtime Exception."]);}})();');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++]=String(s);str=null;return this;};this.insert=function(index,s){var v=this.toString();str=v.substring(0,index)+s+v.substring(index);strs=[str];curr=1;return this;};this.indexOf=function(s){return this.toString().indexOf(s);};this.lastIndexOf=function(s){return this.toString().lastIndexOf(s);};this.substring=function(st,ed){return(ed)?this.toString().substring(st):this.toString().substring(st,ed);};this.toString=function(){if(str==null){str=strs.join("");strs=[str];curr=1;};return str;};this.length=function(){return this.toString().length;};this.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;};if(s!=null){this.append(s);}};})();');func('js.lang.System','(function(){_$package("js.lang");var ArgumentException=_$import("js.lang.ArgumentException");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 new NotSupportException(System.getName()+" cannot be instantiated.");};System.NS=_JSVM_Namespace;System.RE=System.NS.runtimeEnvironment;System.VM=System.RE.JSVM;System.getRuntimeEnvironment=function(){return System.RE;};var _platform=null;System.getPlatform=function(){if(_platform!=null){return _platform;};if(typeof(navigator)=="undefined"){return "not-browser";};var ua=navigator.userAgent.toLowerCase();if(/gecko/i.test(ua)){_platform="moz";}else if(/opera/i.test(ua)){_platform="opera";}else 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{_platform="other";};return _platform;};var isIE=/ie/.test(System.getPlatform());var isMoz=System.getPlatform()=="moz";var isOpera=System.getPlatform()=="opera";System.isIeBrowser=function(){return isIE;};System.isMozBrowser=function(){return isMoz;};System.isOperaBrowser=function(){return isOpera;};System.isDebug=function(){return System.RE.debug;};System.exit=function(){if(!(System.isMozBrowser()||System.isIeBrowser()||System.isOperaBrowser())){throw new NotSupportException("The Platform Must be IE5+, Moz or Opera 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();}};System.getClassloader=function(){return System.VM.getClassloader();};System.getBaseHome=function(){return System.RE.jsvmHome;};System.getSystemHome=function(){return System.RE.jsvmHome+"/bin";};System.getClassHome=function(){var jsre=System.RE;return((tmp=jsre.config.getParameter("class_home"))==null)?(jsre.jsvmHome+"/classes"):tmp.replace("${jsvmHome}",jsre.jsvmHome);};System.getLibHome=function(){var jsre=System.RE;return((tmp=jsre.config.getParameter("lib_home"))==null)?(jsre.jsvmHome+"/lib"):tmp.replace("${jsvmHome}",jsre.jsvmHome);};System.getResourceHome=function(){var jsre=System.RE;return((tmp=jsre.config.getParameter("res_home"))==null)?(jsre.jsvmHome+"/res"):tmp.replace("${jsvmHome}",jsre.jsvmHome);};System.getSystemVariable=function(name){return System.RE.config.getParameter(name);};System.getPlugIn=function(name){return _JSVM_Namespace.plugIn[name];};System.gc=function(){if(System.isIeBrowser()){CollectGarbage();setTimeout("CollectGarbage();",1);}};var props=null;var initProperties=function(){if(props==null){props=(System.RE.mode!="module")?Class.forName("js.util.Properties").newInstance():System.RE.getParent().JSVM.loadClass("js.lang.System").getProperties();}};System.getProperties=function(){initProperties();return props;};System.setProperties=function(oProps){if(!oProps.instanceOf("js.util.Properties")){throw new ArgumentException(System.getName()+".setProperties() error: argument is not an"+" instance of js.util.Properties.");};props=oProps;};System.getProperty=function(key,def){initProperties();return props.getProperty(key,def);};System.setProperty=function(key,value){initProperties();return props.setProperty(key,value);};System.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;};Window.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(/,$/,"");};Window.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();}",1000);handle.document.close();return(this.handle=handle);};Window.prototype.open=function(){return window.open((/HTTPS:/i.test(document.URL)?Window.getCommonWebURL():"about:blank"),this.name,this.getWindowStyle());};Window.prototype.close=function(){if(this.isActive()){this.handle.close();};this.handle=null;};Window.prototype.focus=function(){if(this.isActive()){this.handle.focus();}};Window.prototype.isActive=function(){try{return(this.handle!=null&&this.handle.closed==false);}catch(ex){return false;}};Window.prototype.valueOf=function(){return this.handle;};Window.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 NotSupportException=_$import("js.lang.NotSupportException");var $class=js.dom.StyleSheet=function(){return $StyleSheet.apply(this,arguments);};var StyleSheet=$class;$class.$extends(BObject);var $StyleSheet=function(cs){if(!(System.isIeBrowser()||System.isMozBrowser())){throw new NotSupportException(StyleSheet.getName()+"() error: does not support \'"+System.getPlatform()+"\'");};this.__sst=cs;};StyleSheet.prototype.addRule=function(sSelector,sStyle,iIndex){if(iIndex==null){iIndex=(js.lang.System.isIeBrowser())?this.__sst.rules.length:this.__sst.cssRules.length;};if(js.lang.System.isIeBrowser()){this.__sst.addRule(sSelector,sStyle,iIndex);};if(js.lang.System.isMozBrowser()){this.__sst.insertRule(sSelector+" { "+sStyle+"} ",iIndex);}};StyleSheet.prototype.removeRule=function(iIndex){if(js.lang.System.isIeBrowser()){this.__sst.removeRule(iIndex);};if(js.lang.System.isMozBrowser()){this.__sst.deleteRule(iIndex);}};StyleSheet.create=function(doc){if(!(System.isIeBrowser()||System.isMozBrowser())){throw new NotSupportException(StyleSheet.getName()+".create() error: does not support \'"+System.getPlatform()+"\'");};doc=doc||document;var elmt=doc.createElement("style");var heads=doc.getElementsByTagName("HEAD");if(heads.length>0){heads[0].appendChild(elmt);}else if(doc.body!=null){doc.body.appendChild(elmt);}else{doc.write("<style/>");};var len=doc.styleSheets.length;return new StyleSheet(doc.styleSheets.item(len-1));};StyleSheet.addCssLink=function(url,doc){doc=doc||document;var elmt=doc.createElement("link");var heads=doc.getElementsByTagName("HEAD");if(heads.length>0){heads[0].appendChild(elmt);}else if(doc.body!=null){doc.body.appendChild(elmt);}else{var uid=BObject.createUniqueId();doc.write("<link id=\\""+uid+"\\" rel=\\"stylesheet\\" href=\\""+url+"\\" />");return doc.getElementById(uid);};elmt.setAttribute("rel","stylesheet");elmt.setAttribute("href",url);return elmt;};})();');func('js.dom.EventManager','(function(){_$package("js.dom");var System=_$import("js.lang.System");var BObject=_$import("js.lang.BObject");var NotSupportException=_$import("js.lang.NotSupportException");var ArgumentException=_$import("js.lang.ArgumentException");var HashMap=_$import("js.util.HashMap");var $class=js.dom.EventManager=function(){return $EventManager.apply(this,arguments);};var EventManager=$class;$class.$extends(BObject);var $EventManager=function(){throw new NotSupportException(EventManager.getName()+" cannot be instantiated.");};var registerMap=new HashMap();var getEventListenerByHanlder=function(fHandle,oScope){return registerMap.remove(fHandle);};var createEventListenerByHanlder=function(fHandle,oScope){var fpNotify=function(evt){return fHandle.call(oScope,(evt||window.event));};registerMap.put(fHandle,fpNotify);return fpNotify;};EventManager.attachEvent=function(oTarget,sType,fHandle,oScope,bUseCapture){try{var fpNotify=createEventListenerByHanlder(fHandle,oScope);var useCapture=(bUseCapture==true);if(oTarget.addEventListener){oTarget.addEventListener(sType,fpNotify,useCapture);}else if(oTarget.attachEvent){oTarget.attachEvent("on"+sType,fpNotify);if(useCapture&&oTarget.setCapture){oTarget.setCapture();}}}catch(ex){throw new ArgumentException(EventManager.getName()+".attachEvent() arguments error.",ex);}};EventManager.detachEvent=function(oTarget,sType,fHandle,oScope,bUseCapture){try{var fpNotify=getEventListenerByHanlder(fHandle,oScope);if(fpNotify==null){return;};var useCapture=(bUseCapture==true);if(oTarget.removeEventListener){oTarget.removeEventListener(sType,fpNotify,useCapture);}else if(oTarget.detachEvent){oTarget.detachEvent("on"+sType,fpNotify);if(useCapture&&oTarget.releaseCapture){oTarget.releaseCapture();}};registerMap.remove(fHandle);}catch(ex){throw new ArgumentException(EventManager.getName()+".detachEvent() arguments error.",ex);}};})();');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(domain,path,expires){this.__subfix="";this.__subfix+=(domain==null)?"":("; domain="+domain);this.__subfix+=(path==null)?"":("; path="+path);this.__subfix+=(expires==null)?"":("; expires="+expires.toGMTString());};Cookie.prototype.setValue=function(name,value){document.cookie=name+"="+escape(value)+this.__subfix+";";};Cookie.prototype.getValue=function(name){return(new RegExp(" "+name+"=([^;]*)").test(" "+document.cookie))?unescape(RegExp.$1):null;};})();');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(){$class.$super.apply(this,arguments.length>0?arguments:["Input/Output Error."]);}})();');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 trsfmer=new function(){var xmldom=js.net.XmlDom.create();xmldom.setAsync(false);xmldom.loadXML("<ROOT/>");this.createElement=function(name,text){var node=xmldom.createElement(name);if(typeof(text)!="undefined"){node.appendChild(xmldom.createTextNode(String(text)));};return node;};this.createTextNode=function(text){return xmldom.createTextNode(String(text));};this.transformXMLToElement=function(xml){return xmldom.utility.parseNode(xml);};this.getText=function(node){return xmldom.utility.getText(node);};this.getXML=function(node){return xmldom.utility.getXML(node);};this.destroy=function(){xmldom.destroy();xmldom=null;}};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){var isJO=(obj instanceof JObject);node.setAttribute("type",(isJO?obj.getClass().getName():"Object"));var oid=objectMap.get(obj);if(oid!=null){node.setAttribute("ref",oid);break;}else{oid=sequence++;objectMap.put(obj,oid);node.setAttribute("oid",oid);};for(var p in obj){var v=obj[p];if((isJO&&p=="window")||typeof(v)=="function")continue;var pnode=trsfmer.createElement("member",__this._serialize(v));pnode.setAttribute("name",p);node.appendChild(pnode);}}else{node.setAttribute("type","unknow");}};break;case "unknow":default:node=trsfmer.createElement("unknow");};return node;};var unserializeFromNode=function(node){var type=node.tagName;switch(type){case "void":return void(0);case "null":return null;case "number":return isNaN(trsfmer.getText(node))?Number.NaN:eval(trsfmer.getText(node));case "string":return trsfmer.getText(node);case "boolean":return(trsfmer.getText(node)=="true");case "function":return new Function(trsfmer.getText(node));case "array":var nodes=node.childNodes,l=nodes.length,arr=[];for(var i=0;i<l;i++){arr[i]=unserializeFromNode(nodes[i]);};return arr;case "object":var otype=node.getAttribute("type");if(otype=="Date"){return new Date(parseInt(trsfmer.getText(node),10));}else if(otype=="Error"){return new Exception(parseInt(trsfmer.getText(node.selectSingleNode("number"))),trsfmer.getText(node.selectSingleNode("description")));}else if(otype=="String"){return new String(trsfmer.getText(node));}else if(otype=="Boolean"){return new Boolean(trsfmer.getText(node)=="true");}else if(otype=="Number"){return new Number(trsfmer.getText(node));}else if(otype=="RegExp"){return new RegExp(trsfmer.getText(node));}else if(otype=="unknow"){return null;}else{var ref=node.getAttribute("ref");if(ref!=null&&ref!=""){return objectMap.get(ref);};var 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(trsfmer.getText(cnode));if(typeof(value)!="undefined"){obj[name]=value;}};return obj;};case "unknow":default:throw new IOException(Serializer.getName()+".unserializeFromNode() error: "+"unknow data type ["+type+"]");}};this._serialize=function(obj){var node;return(null==(node=serializeToNode(obj)))?null:XmlDom.utility.getXML(node);};this._unserialize=function(str){var node=trsfmer.transformXMLToElement(str);if(node!=null){return unserializeFromNode(node);};throw new IOException(Serializer.getName()+": _unserialize() error; dataformat error.");};this.destroy=function(){trsfmer.destroy();}};Serializer.serialize=function(obj){var serializer=new Serializer();var str=serializer._serialize(obj);serializer.destroy();return str;};Serializer.unserialize=function(str){var serializer=new Serializer();var obj=serializer._unserialize(str);serializer.destroy();return obj;}})();');func('js.io.WebPrinter','(function(){_$package("js.io");var BObject=_$import("js.lang.BObject");var System=_$import("js.lang.System");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=utf-8\\"><title>"+"Web Printer</title>"+"<script>var owner=null;function write(s){"+(System.isIeBrowser()?"document.body.insertAdjacentHTML(\\"beforeEnd\\", 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\\"></body></html>");this.outputWindow.printer=this;this.outputWindow.width=ds.width;this.outputWindow.height=ds.height;this.outputWindow.resizable=ds.resizable;this.outputWindow.scrollbars=ds.scrollbars;this.outputWindow.status=ds.status;};WebPrinter.defaultStyle={style:"background-color:white;color:black;font-family:MS Sans Serif;font-size:12px;",width:640,height:480,resizable:1,status:0,scrollbars:"yes"};WebPrinter.prototype.prompt="";WebPrinter.prototype.showOutputWindow=function(){if(!this.outputWindow.isActive()){this.outputWindow.show();if(this.prompt!=""){this.outputWindow.handle.write(this.prompt);}}};WebPrinter.prototype.closeOutputWindow=function(){this.outputWindow.close();};WebPrinter.prototype.write=function(s){this.showOutputWindow();this.outputWindow.handle.write(String(s));};WebPrinter.prototype.print=function(s){s=encodeHTML(String(s));this.write(s);};WebPrinter.prototype.println=function(s){this.print(s+"\\r\\n");};WebPrinter.prototype.printError=function(ex){this.write("<XMP style=\\"color:red\\">"+ex+"</XMP>");};WebPrinter.prototype.printHTML=function(s){this.write(String(s));};WebPrinter.prototype.clear=function(){if(this.outputWindow.isActive()){this.outputWindow.handle.clear();}};WebPrinter.prototype.close=function(){this.outputWindow.close();};var 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(){this.init();};XmlHttp.prototype.getXMLHttpRequest=function(){return this.__request;};XmlHttp.prototype.init=function(){this.__request=XmlHttp.create();};XmlHttp.prototype.destroy=function(){this.__request=null;};XmlHttp.create=function(){if(!System.isIeBrowser()){return new XMLHttpRequest();}else{if(progId!=null){return new ActiveXObject(progId);};for(var i=0;i<progIds.length;i++){try{var obj=new ActiveXObject(progIds[i]);progId=progIds[i];return obj;}catch(ex){}finally{obj=null;}}};throw new NotSupportException(XmlHttp.getName()+".create() error: can\'t create xmlhttp object ["+System.getPlatform()+"].");};var 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 XmlHttp=_$import("js.net.XmlHttp");var $class=js.net.XmlDom=function(){return $XmlDom.apply(this,arguments);};var XmlDom=$class;$class.$extends(_JSVM_Namespace.kernel.Object);var $XmlDom=function(){var __self=this,doc=null;if(!isIE){doc=document.implementation.createDocument("","",null);doc.addEventListener("load",function(){fireLoadEvent(__self);},false);}else{if(progId!=null){doc=new ActiveXObject(progId);};var l=progIds.length;for(var i=0;i<l;i++){try{doc=new ActiveXObject(progIds[i]);progId=progIds[i];break;}catch(ex){}};if(i==l){throw new NotSupportException("Cannot create XmlDom object under \'"+System.getPlatform()+"\'!");};doc.onreadystatechange=function(){if(doc.readyState==4){fireLoadEvent(__self);}}};this.__doc=doc;this.__async=false;syncProperties(this);this.nodeName="#document";this.namespaceURI="";this.prefix="";this.nodeType=9;this.state=0;this.onload=null;this.destroy=function(){for(var p in this){delete this[p];};doc=null;this.__doc=null;}};var isIE=System.isIeBrowser();var isMoz=System.isMozBrowser();var isOpera=System.isOperaBrowser();XmlDom.create=function(){return new XmlDom();};var progIds=["MSXML2.DOMDocument","Microsoft.XMLDOM","MSXML.DOMDocument","MSXML3.DOMDocument"];var progId=null;var properties=["async","nodeValue","parentNode","childNodes","firstChild","lastChild","previousSibling","nextSibling","attributes","ownerDocument","doctype","implementation","documentElement"];var syncProperties=function(o){var doc=o.__doc;var l=properties.length;for(var i=0;i<l;i++){var name=properties[i];eval("o."+name+"=doc."+name);}};var fireLoadEvent=function(o){this.state=4;syncProperties(o);var func=o.onload;if("function"==typeof(func)){func();}};var $p=XmlDom.prototype;$p.insertBefore=function(newElement,targetElement){return this.__doc.insertBefore(newElement,targetElement);};$p.replaceChild=function(newChild,oldChild){return this.__doc.replaceChild(newChild,oldChild);};$p.removeChild=function(child){return this.__doc.removeChild(child);};$p.appendChild=function(child){return this.__doc.appendChild(child);};$p.cloneNode=function(deep){return this.__doc.cloneNode(deep);};$p.createElement=function(tagName){return this.__doc.createElement(tagName);};$p.createDocumentFragment=function(){return this.__doc.createDocumentFragment();};$p.createTextNode=function(data){return this.__doc.createTextNode(data);};$p.createComment=function(data){return this.__doc.createComment(data);};$p.createCDATASection=function(data){return this.__doc.createCDATASection(data);};$p.createProcessingInstruction=function(target,data){return this.__doc.createProcessingInstruction(target,data);};$p.createAttribute=function(name){return this.__doc.createAttribute(name);};$p.getElementsByTagName=function(name){return this.__doc.getElementsByTagName(name);};$p.getDomDocument=function(){return this.__doc;};$p.getDocumentElement=function(){return this.__doc.documentElement;};$p.setAsync=function(b){this.__async=b;this.__doc.async=b;};$p.getAsync=function(b){return this.__async;};$p.selectNodes=function(s){return this.__doc.selectNodes(s);};$p.selectSingleNode=function(s){return this.__doc.selectSingleNode(s);};$p.hasChildNodes=isOpera?function(){return(this.__doc.childNodes.length>0);}:function(){return this.__doc.hasChildNodes();};$p.getXML=isIE?function(){return this.__doc.xml;}:function(){return(isOpera?"<?xml version=\\"1.0\\"?>":"")+(new XMLSerializer()).serializeToString(this.__doc);};$p.load=isOpera?function(url){try{this.state=0;this.__doc=document.implementation.createDocument("","",null);syncProperties(this);var async=this.getAsync();var http=XmlHttp.create();if(async){var _this=this;http.onreadystatechange=function(){if(http.readyState==4){_this.__doc=http.responseXML;fireLoadEvent(_this);}}};http.open("GET",url,async);http.send(null);if(!async){this.__doc=http.responseXML;return(this.__doc.documentElement!=null);}}catch(ex){if(!async){return false;}}finally{if(!async){fireLoadEvent(this);}}}:function(url){this.state=0;return this.__doc.load(url);};$p.loadXML=isIE?function(s){return this.__doc.loadXML(s);}:function(s){try{this.state=0;this.__doc=(new DOMParser()).parseFromString(s,"text/xml");this.__doc.async=this.__async;if(this.__async){return;};return(this.__doc.documentElement!=null)&&(this.__doc.documentElement.localName!="parsererror"||this.__doc.documentElement.getAttribute("xmlns")!="http://www.mozilla.org/newlayout/xml/parsererror.xml");}catch(ex){return false;}finally{fireLoadEvent(this);}};$p.createNode=isIE?function(stype,name,ns){return this.__doc.createNode(stype,name,ns);}:function(stype,name,ns){var doc=this.__doc;switch(stype){case 1:return(ns==null||ns=="")?doc.createElement(name):doc.createElementNS(ns,name);case 2:return(ns==null||ns=="")?doc.createAttribute(name):doc.createAttributeNS(ns,name);case 3:default:return doc.createTextNode("");}};if(isMoz){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[res.length]=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;}};if(isOpera){var __re_0001=/^\\/([^\\/])/;var __re_0002=/^\\/\\/([^\\/])/;var __getChildNodes=function(oNode,sExpr,bRec){if(sExpr==""){return [];};var idx=sExpr.indexOf("/");var sPre=(idx==-1)?sExpr:sExpr.substring(0,idx);var sSub=(idx==-1)?null:sExpr.substring(idx+1);var isAll=(sPre=="*");var isFin=(sSub==null);var nodes=oNode.childNodes;var l=nodes.length;var a=[];for(var i=0,j=0;i<l;i++){var node=nodes[i];if(node.nodeType!=1){continue;};if(isAll||node.nodeName==sPre){a=a.concat(isFin?node:__getChildNodes(node,sSub));};if(bRec){a=a.concat(__getChildNodes(node,sExpr,bRec));}};return a;};Node.prototype.selectNodes=function(sExpr){if(sExpr==""||sExpr==null){return [];};if(sExpr=="/"){return [this.ownerDocument];};if(__re_0001.test(sExpr)){return __getChildNodes((this.nodeType==9)?this:this.ownerDocument,sExpr.substring(1),false);};if(__re_0002.test(sExpr)){return __getChildNodes((this.nodeType==9)?this:this.ownerDocument,sExpr.substring(2),true);};return __getChildNodes(this,sExpr,false);};Node.prototype.selectSingleNode=function(sExpr){var nodes=this.selectNodes(sExpr);return(nodes.length>0)?nodes[0]:null;}};XmlDom.prototype.utility=XmlDom.utility=new function(){this.getXML=isIE?function(o){return o.xml;}:function(o){return(new XMLSerializer()).serializeToString(o);};this.getText=isIE?function(o){return o.text;}:function(o){if(o instanceof Text){return o.nodeValue;}else{var cs=o.childNodes;var l=cs.length;var sb=new Array(l);for(var i=0;i<l;i++){sb[i]=this.getText(cs[i]);};return sb.join("");}};this.getBaseName=isIE?function(o){return o.nodeName;}:function(o){var lParts=o.nodeName.split(":");return lParts[lParts.length-1];};this.parseNode=function(s){var doc=new XmlDom();doc.setAsync(false);doc.loadXML(s);var node=doc.documentElement;doc.destroy();return node;};this.selectNodes=function(o,s){return o.selectNodes(s);};this.selectSingleNode=function(o,s){return o.selectSingleNode(s);};};})();');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=[];};ArrayList.prototype.toArray=function(){return this.__array;};ArrayList.prototype.indexOf=function(o){var l=this.__array.length;for(var i=0;i<l;i++){if(this.__array[i]==o){return i;}};return-1;};ArrayList.prototype.lastIndexOf=function(o){var l=this.__array.length-1;for(var i=l;i>=0;i--){if(this.__array[i]==o){return i;}};return-1;};ArrayList.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);}};ArrayList.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.");}};ArrayList.prototype.removeAt=function(i){var l=this.__array.length;if(i<0||i>=l){return null;};var o=this.__array[i];this.__array=this.__array.slice(0,i).concat(this.__array.slice(i+1,l));return o;};ArrayList.prototype.remove=function(o){var i=this.indexOf(o);if(i==-1){return this;};return this.removeAt(i);};ArrayList.prototype.contains=function(o){return this.indexOf(o)!=-1;};ArrayList.prototype.clear=function(){this.__array.length=0;};ArrayList.prototype.size=function(){return this.__array.length;};ArrayList.prototype.get=function(i){var size=this.size();if(i>=0&&i<size){return this.__array[i];}else{return null;}};ArrayList.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.__table={};};HashMap.prototype.elements=function(){var a=[],i=0;for(var h in this.__table){if(!/^\\$hc_/.test(h)){continue;};var e=this.__table[h];a[i++]=e.__value;};return new Iterator(a);};HashMap.prototype.get=function(key){var h=hash(key);var e=this.__table[h];return(e==null)?null:e.__value;};HashMap.prototype.isEmpty=function(){return(this.size()==0);};HashMap.prototype.keys=function(){var a=[],i=0;for(var h in this.__table){if(!/^\\$hc_/.test(h)){continue;};var e=this.__table[h];a[i++]=e.__key;};return new Iterator(a);};HashMap.prototype.put=function(key,value){var h=hash(key);var oe=this.__table[h];var oldValue=(oe==null)?null:oe.__value;this.__table[h]=new Entry(h,key,value);return oldValue;};HashMap.prototype.remove=function(key){var h=hash(key);var oe=this.__table[h];delete this.__table[h];return(oe==null)?null:oe.__value;};HashMap.prototype.size=function(){var l=0;for(var h in this.__table){l+=/^\\$hc_/.test(h)?1:0;};return l;};HashMap.prototype.clear=function(){this.__table={};};HashMap.prototype.containsValue=function(value){for(var key in this.__table){if(this.__table[key].__value==value){return true;}};return false;};HashMap.prototype.containsKey=function(key){var h=hash(key);return(typeof(this.__table[h])!="undefined");};var NULL_KEY="$hc_NULL";var hash=function(o){if(o==null){return NULL_KEY;};switch(typeof(o)){case "string":return("$hc_s"+o);case "number":return("$hc_n"+o);case "boolean":return("$hc_b"+o);case "object":if(o instanceof String){return("$hc_s"+o.valueOf());};if(o instanceof Number){return("$hc_n"+o.valueOf());};if(o instanceof Boolean){return("$hc_b"+o.valueOf());};if(o instanceof JObject){return("$hc_j"+o.hashCode());};default:return _getObjHashCode(o);}};var _hsObjs=[];var _getObjHashCode=function(o){var l=_hsObjs.length;for(var i=0;i<l;i++){if(_hsObjs[i]==o){return "$hc_o"+i;}};_hsObjs[l]=o;return "$hc_o"+l;};HashMap.prototype.toArray=function(){var entities=[],i=0;for(var h in this.__table){entities[i++]=this.__table[h];};return entities;};HashMap.prototype.clone=function(){var map=new HashMap();map.__table=Cloneable.cloneObject(this.__table);return map;};var Entry=function(h,k,v){this.__hash=h;this.__key=k;this.__value=v;};Entry.prototype.getKey=function(){return this.__key;};Entry.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);};this.next=function(){return array[index++];}}})();');func('js.util.Properties','(function(){_$package("js.util");var Cloneable=_$import("js.lang.Cloneable");var ArgumentException=_$import("js.lang.ArgumentException");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.__ctx=new HashMap();};Properties.prototype.getProperty=function(key,defaultValue){var val=this.__ctx.get(key);return(val==null)?defaultValue:val;};Properties.prototype.setProperty=function(key,value){if(key==null||key==""){throw new ArgumentException(this.getClass().getName()+".setProperty(key, value) error: key can\'t be null and empty.");};this.__ctx.put(key,String(value));};Properties.prototype.clear=function(){return this.__ctx.clear();};Properties.prototype.propertyNames=function(){return this.__ctx.keys();};Properties.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(sURL) Fail. Cound not access the resource [sURL:"+sURL+"].",ex);};if(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);};var text=xmlHttp.responseText;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);}}};Properties.prototype.loadFromXML=function(sURL){var doc=XmlDom.create();doc.setAsync(false);if(!doc.load(sURL)){throw new IOException(this.getClass().getName()+".loadFromXML(sURL) Fail. Cound not load from the resource [sURL:"+sURL+"].",ex);};var root=doc.getDocumentElement();var ptNodes=XmlDom.utility.selectNodes(root,"entity");var l=ptNodes.length;for(var i=0;i<l;i++){var node=ptNodes[i];this.setProperty(node.getAttribute("key"),XmlDom.utility.getText(node));}};Properties.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));}};Properties.prototype.clone=function(){var ps=new Properties();ps.__ctx=this.__ctx.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();};Stack.prototype.empty=function(){return(this.__list.size()==0);};Stack.prototype.peek=function(){if(this.empty()){return null;};var o=this.__list.get(0);return o;};Stack.prototype.pop=function(){if(this.empty()){return null;};var o=this.__list.get(0);this.__list.removeAt(0);return o;};Stack.prototype.push=function(o){this.__list.add(0,o);};Stack.prototype.search=function(o){return this.__list.indexOf(o);};Stack.prototype.clone=function(){var o=new Stack();o.__list=this.__list.clone();return o;}})();');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=[/(\/\*)\/?(([^\*]\/)|[^\/])*(\*\/)/g,/(\s|^)+\/\/([^\n\r])*/g];var regExps_strings=[/("(\\"|[^"\n\r]|(\\\r\n))*")/g,/('(\\'|[^'\n\r]|(\\\r\n))*')/g];var strings_tmpPrefix="${10b7bd2c-d345-eb59-6268-206460fc8dde";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));};code=code.replace(regExps_comments[0],"");code=code.replace(regExps_comments[1],"");code=code.replace(regExp_package,"$1_$package(\"$5\")");var packageName=RegExp.$5;code=code.replace(regExp_import,"$1var $7 = _$import(\"$5\")");code=code.replace(regExp_super,"$1$class.$super$2");if(regExp_class.test(code)){var className=RegExp.$5;var superName=RegExp.$7.replace(/(\s*)extends(\s+)/,"");var shortClassName=className;if(className.indexOf(".")==-1){className=packageName+"."+className;}else{shortClassName=className.replace(/\w*\./g,"");};var str="\r\nvar $class = "+className+" = function(){return $"+shortClassName+".apply(this,arguments);};\r\n"+"var "+shortClassName+" = $class;\r\n";if(superName==""){str+="$class.$extends(_JSVM_Namespace.kernel.Object);";}else{str+="$class.$extends("+superName+");";};str+="\r\nvar $"+shortClassName+" = function(";code=code.replace(regExp_class,"$1"+str);}else{throw new Exception(0x001E,"JSVM jsvm2-parser@compiler "+"error: can't found keyword 'class'.");};for(var i=0;i<constStrs.length;i++){code=code.replace((strings_tmpPrefix+i+strings_tmpSuffix),constStrs[i]);};return code;}});JSVM.setConsole(new function(){var printer=null;this.output=function(msg){if(printer==null){printer=jsre.JSVM.loadClass("js.io.WebPrinter").newInstance();printer.prompt="JSVM Console output [Version "+jsre.currentVersion+"]<br>(C) All Copyright 2004-2005 JSVM Team. <br><br>";};printer.print(msg);};this.input=function(){return window.prompt("JSVM Console; Input: ");}});JSVM.logger.log("JSVM redefine console succ.");jsre.loadModule("runtime.module",function(){var jsre=_JSVM_Namespace.runtimeEnvironment;window.Class=_JSVM_Namespace.kernel.Class;window._import=function(name){try{var clazz=jsre.JSVM.loadClass(name);var shortName=name.replace(/(.*)\./,"");if("undefined"==typeof(window[shortName])){window[shortName]=clazz;}}catch(ex){ex.printStackTrace();throw ex;}}});});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -