📄 jsx_opt.js
字号:
jsx3.Class.defineClass("jsx3.net.Form",null,[jsx3.util.EventDispatcher],function(q,d){var Lc=jsx3.util.Logger.getLogger(q.jsxclass.getName());q.Je=0;q.Uf=250;q.zp=30000;q.METHOD_GET="get";q.METHOD_POST="post";q.xD="application/x-www-form-urlencoded";q.aG="multipart/form-data";q.EVENT_FILE_SELECTED="fileSelected";q.EVENT_ON_RESPONSE="onResponse";q.EVENT_ON_ERROR="onError";q.EVENT_ON_TIMEOUT="onTimeout";d.init=function(i,b,k){this.ge="jsx_httpform_"+q.Je++;if(i==-1){this.YA(b);}else{this.YA();this.setMethod(i!=null?i:q.METHOD_GET);this.setAction(b);this.setMultipart(k);}};q.newFromFragment=function(i){return new q(-1,i);};d.YA=function(e){var Jb=e;if(!Jb)Jb="<form method=\"get\" action=\"\"><input type=\"submit\"/></form>";var qc="<html><body class=\"jsx30form\">"+Jb+"</body></html>";jsx3.html.insertAdjacentHTML(document.body,"beforeEnd","<span id='"+this.ge+"_span' style='border:2px solid black;position:absolute;left:-50px;top:0px;width:10px;height:10px;overflow:hidden;'><iframe id='"+this.ge+"_frame' style='width:100%;height:100%;'></iframe></span>");this._l=document.getElementById(this.ge+"_l");this.io=this.eval(this.ge+"_frame");var X=this.io.document||this.io.contentDocument;if(X==null)throw new jsx3.Exception("No document in IFRAME.");X.open();X.write(qc);X.close();this.xp=X.getElementsByTagName("form")[0];if(e){if(this.xp==null)throw {description:"the HTML fragment did not contain a valid <form> tag: "+e};this.Re=this.xp.action;this.rG=this.xp.method;this.dC=this.xp.encoding&&this.xp.encoding.toLowerCase()==q.aG;}};d.getMethod=function(){return this.rG;};d.setMethod=function(p){p=p!=null?p.toLowerCase():q.METHOD_GET;this.rG=p;this.lD().setAttribute("method",p);};d.getAction=function(){return this.Re;};d.setAction=function(c){c=jsx3.app.Browser.getLocation().resolve(c).toString();this.Re=c;this.lD().setAttribute("action",c);};d.getMultipart=function(){return this.dC;};d.setMultipart=function(c){this.dC=c;this.lD().setAttribute("encoding",c?q.aG:q.xD);};d.Ci=function(){return this._l;};d.fq=function(){return this.io;};d.lD=function(){return this.xp;};d.getField=function(c){var Ib=this.lD().elements[c];return Ib!=null&&typeof(Ib)=="object"?Ib.value:null;};d.getFields=function(){var Bb=[];var Wb=this.lD().elements;for(var R in Wb){Bb[R]=Wb[R].name;}return Bb;};d.setField=function(c,l,g){var ib=this.lD();var Ec=ib.elements[c];if(Ec==null||typeof(Ec)!="object"){jsx3.html.insertAdjacentHTML(ib,"beforeEnd","<div>"+c+": <input type='text' name='"+c+"'/></div>");Ec=ib.elements[c];}if(g&&Ec.value){Ec.value=Ec.value+" "+l;}else{Ec.value=l;}};d.removeField=function(g){var X=this.lD();var V=X.elements[g];if(V!=null&&V.parentNode)V.parentNode.parentNode.removeChild(V.parentNode);};d.addFileUploadField=function(h){var Ib=this.lD();var H=Ib.elements[h];if(H==null||typeof(H)!="object"){jsx3.html.insertAdjacentHTML(Ib,"beforeEnd","<div>"+h+": <input type='file' name='"+h+"'/></div>");H=Ib.elements[h];var Kb=this;H.onchange=function(){Kb.KF(h,H.value);};}else{throw new jsx3.Exception("Form already has field "+h+".");}};d.promptForFile=function(i){var X=this.lD();var I=X.elements[i];if(I!=null&&I.type=="file"){Lc.warn("jsx3.net.Form does not support prompting file upload fields in Firefox.");I.click();}else{throw new jsx3.Exception("Form does not have file upload field "+i+".");}};d.KF=function(s,i){this.publish({subject:q.EVENT_FILE_SELECTED,field:s,value:i});};d.Kq=function(){this.xp=null;this.publish({subject:q.EVENT_ON_RESPONSE});};d.we=function(i){this.xp=null;this.publish({subject:q.EVENT_ON_ERROR,message:i});};d.abort=function(){window.clearInterval(this.Uj);};d.send=function(a,n){if(a==null)a=q.Uf;if(n==null)n=q.zp;var Kb=this;this.io.onload=function(){Kb.Lu();};try{this.xp.submit();}catch(Kc){this.we(jsx3.NativeError.wrap(Kc).toString());return;}this.Uj=window.setTimeout(function(){Kb.Dl();},a*n);};d.Lu=function(){this.io.onload=null;if(this.Uj){window.clearTimeout(this.Uj);this.Uj=null;}try{var fb=" "+this.io.contentDocument.childNodes[0].innerHTML;}catch(Kc){this.publish({subject:q.EVENT_ON_ERROR,message:jsx3.NativeError.wrap(Kc).toString()});return;}this.Kq();};d.Dl=function(){this.io.onload=null;this.Uj=null;this.destroy();this.publish({subject:q.EVENT_ON_TIMEOUT});};d.getResponseText=function(){var db=this.io.contentDocument;if(db instanceof XMLDocument){return (new XMLSerializer()).serializeToString(db);}else{if(db instanceof HTMLDocument){return db.childNodes[0].innerHTML;}else{Lc.warn("Unsupported document type: "+db);return "";}}};d.getResponseXML=function(){var Gc=this.io.contentDocument;if(Gc instanceof XMLDocument){var Wb=(new XMLSerializer()).serializeToString(Gc);return (new jsx3.xml.Document()).loadXML(Wb);}else{if(Gc instanceof HTMLDocument){var Wb=Gc.childNodes[0].innerHTML;return (new jsx3.xml.Document()).loadXML(Wb);}else{Lc.warn("Unsupported document type: "+Gc);return (new jsx3.xml.Document()).loadXML("<html/>");}}};d.destroy=function(){var Qb=this.Ci();if(Qb!=null){Qb.parentNode.removeChild(Qb);this._l=null;this.io=null;this.xp=null;}else{jsx3.util.Logger.doLog("HTFM01","HttpForm probably already destroyed");}};d.reveal=function(f,l,n,j){if(f==null)f=10;if(l==null)l=10;if(n==null)n=Math.round(this._l.parentNode.offsetWidth/3);if(j==null)j=Math.round(this._l.parentNode.offsetHeight/3);var Ic=this._l.style;Ic.left=f+"px";Ic.top=l+"px";Ic.width=n+"px";Ic.height=j+"px";Ic.zIndex=30000;};d.conceal=function(){var fb=this._l.style;fb.left="-50px";fb.top="0px";fb.width="10px";fb.height="10px";fb.zIndex=0;};});jsx3.HttpForm=jsx3.net.Form;jsx3.Class.defineInterface("jsx3.xml.Cacheable",null,function(k,n){var E=jsx3.xml.Document;var Ob=jsx3.xml.CDF;var bc=jsx3.util.Logger.getLogger(k.jsxclass.getName());k.DEFAULTSTYLESHEET=jsx3.resolveURI("jsx:///xsl/xml.xsl");k.DEFAULTXSLCACHEID="JSX_XML_XSL";k.CLEANUPRESOURCES=0;k.SHARERESOURCES=1;n.doTransform=function(m,i){var gb=this.getNodeSet()!=null?this.getNodeSet():this.getXML();if(m==null&&this.jsxxslparams!=null)m=this.jsxxslparams;var Eb=0;var sb="";if(gb!=null){Eb=1;var cc=this.getXSL();if(cc!=null){Eb=2;sb=gb.transformNode(cc,m);if(sb!="")Eb=3;}}if(Eb==2){}else{if(Eb==1){if(i!=true)bc.error("XML02","Transformation Failed: When attempting to load the XSL for the control, "+this.getId()+", it resulted in a null object.",3);}else{if(Eb==0){}}}return sb;};n.getXSLParams=function(){if(this.jsxxslparams==null)this.jsxxslparams={};return this.jsxxslparams;};n.setXSLParam=function(p,r){if(r!=null)this.getXSLParams()[p]=r;else delete this.getXSLParams()[p];return this;};n.removeXSLParam=function(o){delete this.getXSLParams()[o];return this;};n.removeXSLParams=function(){delete this.jsxxslparams;return this;};n.getNodeSet=function(){return this._jsxft;};n.setNodeSet=function(f){this._jsxft=f;};n.onDestroyCached=function(q){if(this.getShareResources()==k.CLEANUPRESOURCES)this.resetCacheData(q.getServer());delete this._jsxft;};n.resetCacheData=function(a){var oc=(a||this.getServer()).getCache();oc.clearById(this.getXSLId());oc.clearById(this.getXMLId());};n.resetXmlCacheData=function(e){var lc=(e||this.getServer()).getCache();lc.clearById(this.getXMLId());};n.resetXslCacheData=function(b){var Lb=(b||this.getServer()).getCache();Lb.clearById(this.getXSLId());};n.clearXmlData=function(){this.getServer().getCache().setDocument(this.getXMLId(),Ob.newDocument());};n.getShareResources=function(){return this.jsxshare==null?k.CLEANUPRESOURCES:this.jsxshare;};n.setShareResources=function(h){this.jsxshare=h;return this;};n.getXML=function(){var lc=this.getServer();if(lc==null)return Ob.newDocument();var bb=lc.getCache().getDocument(this.getXMLId());if(bb==null){var eb=this.getXMLString();if(!jsx3.util.strEmpty(eb)){bb=new E();bb.loadXML(eb);}else{var Wb=this.getXMLURL();if(!jsx3.util.strEmpty(Wb)){bb=new E();bb.load(this.getUriResolver().resolveURI(Wb));}else{bb=Ob.newDocument();}}if(bb.hasError()){bc.error("Error parsing or loading the XML file for "+this+": "+bb.getError().description);return bb;}bb=this.setSourceXML(bb);}return bb;};n.setSourceXML=function(a){a=this.Tt(a);this.getServer().getCache().setDocument(this.getXMLId(),a);if(this.instanceOf(Ob)){if(a.getNodeName()=="data"&&a.getAttribute("jsxassignids")=="1")this.assignIds();this.convertProperties(this.getServer().getProperties());}return a;};n.getXMLId=function(){return this.jsxxmlid||this.getId()+"_XML";};n.setXMLId=function(s){this.jsxxmlid=s;return this;};n.getXMLString=function(){return this.jsxxml;};n.setXMLString=function(b){this.jsxxml=b;return this;};n.getXMLURL=function(){return this.jsxxmlurl;};n.setXMLURL=function(b){this.jsxxmlurl=b;return this;};n.getXSL=function(m){var hb=this.getXSLId();var Bc=this.getServer().getCache().getDocument(hb);if(Bc==null){Bc=new E();if(this.getXSLString()!=null){Bc.loadXML(this.getXSLString());}else{if(this.getXSLURL()!=null){Bc.load(this.getUriResolver().resolveURI(this.getXSLURL()));}else{if(m!=true){Bc.load(k.DEFAULTSTYLESHEET);hb=k.DEFAULTXSLCACHEID;}else{return null;}}}if(Bc.hasError()){bc.error("Error parsing or loading the XSL file for "+this+": "+Bc.getError().description);return Bc;}this.getServer().getCache().setDocument(hb,Bc);}return Bc;};n.getXSLId=function(){return this.jsxxslid||this.getId()+"_XSL";};n.setXSLId=function(a){this.jsxxslid=a;return this;};n.getXSLString=function(){return this.jsxxsl;};n.setXSLString=function(c){this.jsxxsl=c;return this;};n.getXSLURL=function(){return this.jsxxslurl;};n.setXSLURL=function(p){this.jsxxslurl=p;return this;};n.getXMLTransformers=function(){return this.jsxxmltrans!=null?this.jsxxmltrans.split(/\s*,\s*/g):[];};n.setXMLTransformers=function(a){this.jsxxmltrans=a!=null?a instanceof Array?a.join(","):a:null;};n.Tt=function(d){var Y=this.getXMLTransformers();if(Y.length>0){var v=this.getServer();var nc=v.getCache();var ib=d;for(var wb=0;wb<Y.length;wb++){var Q=Y[wb];var Fb=nc.getDocument(Q);if(Fb==null){Q=v.resolveURI(Q);Fb=nc.openDocument(Q,Q);}if(Fb==null||Fb.hasError()){bc.warn("Bad XML transformer for "+this+": "+Q+" ("+Fb.getError().description+")");nc.clearById(Q);continue;}var ub=new jsx3.xml.Processor(ib,Fb,this.getXSLParams());ib=ub.transformToObject();if(ib.hasError()){throw new jsx3.Exception("Error transforming XML for object "+this+": "+ib.getError().description);}}return ib;}else{return d;}};k.getVersion=function(){return "3.00.00";};});jsx3.xml.Cacheable.prototype.resetData=jsx3.xml.Cacheable.prototype.clearXmlData;jsx3.Class.defineClass("jsx3.app.Monitor",jsx3.util.Logger.FormatHandler,null,function(f,k){var t=jsx3.app.Server;f.ed=false;f.lu=jsx3.net.URIResolver.DEFAULT.resolveURI("jsx:///html/jsx3.app.Monitor.html");f.ideDidLoad=function(){f.ed=true;};k.Vt=false;k.Fz=true;k.mw=null;k.Qx=false;k.jf=null;k.cd=null;k.init=function(p){this.jsxsuper(p);};k.onAfterInit=function(){if(this.mw!=null){var jb=null;if(jsx3.Class.forName("jsx3.lang.System"))jb=jsx3.System.getApp(this.mw);if(jb!=null){this.xC(jb);}else{t.subscribe(t.EVENT_SERVER_INITED,this,"ci");}}else{this.Fz=false;this.Qx=false;this.Vt=true;this.ne();}};k.xC=function(c){this.Vt=true;this.jf=c;if(this.Qx){var nc=this;c.registerHotKey(function(o){nc.pB();},"m",false,true,true);}else{this.ne();}};k.ci=function(r){var sb=r.target;if(sb.getEnv("namespace")==this.mw){if(!f.ed||!this.Fz)this.xC(sb);t.unsubscribe(t.EVENT_SERVER_INITED,this);}};k.handle=function(b){if(this.Vt&&(!f.ed||!this.Fz)){if(this.cd){if(this.cd.closed){if(!this.Qx)this.ne();}if(!this.cd.closed&&this.cd.appendMessage){var sc=this.format(b).escapeHTML();this.cd.appendMessage(sc,jsx3.util.Logger.levelAsString(b.getLevel()));}}}};k.pB=function(){if(this.cd==null||this.cd.closed)this.ne();};k.ne=function(){this.cd=window.open(f.lu,"Monitor_"+this.getName(),"directories=no,location=no,menubar=no,status=yes,personalbar=no,titlebar=yes,toolbar=no,resizable=yes,scrollbars=no,width=500,height=400");if(this.cd){if(this.jf){if(typeof(this.cd.setName)=="function")this.cd.setName(this.jf.getEnv("namespace"));else this.cd._jsxname=this.jf.getEnv("namespace");}window.focus();}};k.getDisableInIDE=function(){return this.Fz;};k.setDisableInIDE=function(n){this.Fz=n;};k.getServerNamespace=function(){return this.mw;};k.setServerNamespace=function(n){this.mw=n;};k.getActivateOnHotKey=function(){return this.Qx;};k.setActivateOnHotKey=function(g){this.Qx=g;};});jsx3.util.Logger.Handler.registerHandlerClass(jsx3.app.Monitor.jsxclass);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -