📄 qzfl.js
字号:
function _bootStrap(){if(document.addEventListener){if(ua.safari){var interval=setInterval(function(){if((/loaded|complete/).test(document.readyState)){_onloadHook();clearInterval(interval);}},50);}else{document.addEventListener("DOMContentLoaded",_onloadHook,true);}}else{var src='javascript:void(0)';if(window.location.protocol=='https:'){src='//:';}document.write('<script onreadystatechange="if(this.readyState==\'complete\'){this.parentNode.removeChild(this);QZFL.pageEvents._onloadHook();}" defer="defer" src="'+src+'"><\/script\>');}window.onload=QZFL.lang.chain(window.onload,function(){_onloadHook();_runHooks('onafterloadhooks');});window.onbeforeunload=function(){return _runHooks('onbeforeunloadhooks');};window.onunload=QZFL.lang.chain(window.onunload,function(){_runHooks('onunloadhooks');});}function _onloadHook(){_runHooks('onloadhooks');window.loaded=true;}function _runHook(handler){try{handler();}catch(ex){rt.error('Uncaught exception in hook (run after page load): {0}',ex);}}function _runHooks(hooks){var isbeforeunload=(hooks=='onbeforeunloadhooks');var warn=null;var hc=window.ENV.hookPool;do{var h=hc[hooks];if(!isbeforeunload){hc[hooks]=null;}if(!h){break;}for(var ii=0;ii<h.length;ii++){if(isbeforeunload){warn=warn||h[ii]();}else{h[ii]();}}if(isbeforeunload){break;}}while(hc[hooks]);if(isbeforeunload){if(warn){return warn;}else{window.loaded=false;}}}function _addHook(hooks,handler){var c=window.ENV.hookPool;(c[hooks]?c[hooks]:(c[hooks]=[])).push(handler);}function _insertHook(hooks,handler,position){var c=window.ENV.hookPool;if(typeof(position)=='number'&&position>=0&&c[hooks]){c[hooks].splice(position,0,handler);}else{return false;}}function _lr(handler){window.loaded?_runHook(handler):_addHook('onloadhooks',handler);}function _bulr(handler){_addHook('onbeforeunloadhooks',handler);}function _ulr(handler){_addHook('onunloadhooks',handler);}function pinit(){_bootStrap();_ihp();ua.adjustBehaviors();var _dt=$("__DEBUG_out");if(_dt){ENV.set("dout",_dt);}var __dalert;if(!ENV.get("alertConverted")){__dalert=alert;eval('var alert=function(msg){if(msg!=undefined){__dalert(msg);return msg;}}');ENV.set("alertConverted",true);}}return{onloadRegister:_lr,onbeforeunloadRegister:_bulr,onunloadRegister:_ulr,initHttpParams:_ihp,bootstrapEventHandlers:_bootStrap,_onloadHook:_onloadHook,insertHooktoHooksQueue:_insertHook,pageBaseInit:pinit};})();function commonReplace(s,p,r){return s.replace(p,r);}function listRaplace(s,l){if(isHashMap(l)){for(var i in l){s=(commonReplace(s,l[i],i)||s);}return s;}else{return s;}}function trim(str){return commonReplace(str+"",trim.re,'');}trim.re=/^\s*|\s*$/g;function ltrim(str){return commonReplace(str+"",ltrim.re,'');}ltrim.re=/^\s*/g;function rtrim(str){return commonReplace(str+"",rtrim.re,'');}rtrim.re=/\s*$/g;function nl2br(str){return commonReplace(str+"",nl2br.re,'<br />');}nl2br.re=/\n/g;function s2nb(str){return commonReplace(str+"",s2nb.re,' ');}s2nb.re=/[\x20]{2}/g;function URIencode(str){var cc,ccc;return(str+"").replace(URIencode.re,function(a){if(a=="\x20"){return"+";}else if(a=="\x0D"){return"";}cc=a.charCodeAt(0);ccc=cc.toString(16);return"%"+((cc<16)?("0"+ccc):ccc);});}URIencode.re=/[\x09\x0A\x0D\x20\x21-\x29\x2B\x2C\x2F\x3A-\x3F\x5B-\x5E\x60\x7B-\x7E]/g;function escHTML(str){return listRaplace((str+""),{'&':escHTML.re_amp,'<':escHTML.re_lt,'>':escHTML.re_gt,''':escHTML.re_apos,'"':escHTML.re_quot});}escHTML.re_amp=/&/g;escHTML.re_lt=/</g;escHTML.re_gt=/>/g;escHTML.re_apos=/\x27/g;escHTML.re_quot=/\x22/g;function escString(str){return listRaplace((str+""),{'\\\\':escString.bsls,'\\n':escString.nl,'':escString.rt,'\\t':escString.tab,'\\\'':escHTML.re_apos,'\\"':escHTML.re_quot});}escString.bsls=/\\/g;escString.nl=/\n/g;escString.rt=/\r/g;escString.tab=/\t/g;function restHTML(str){if(!restHTML.__utilDiv){restHTML.__utilDiv=document.createElement("div");}var t=restHTML.__utilDiv;t.innerHTML=(str+"");if(typeof(t.innerText)!='undefined'){return t.innerText;}else if(typeof(t.textContent)!='undefined'){return t.textContent;}else if(typeof(t.text)!='undefined'){return t.text;}else{return'';}}function restXHTML(str){return listRaplace((str+""),{'<':restXHTML.re_lt,'>':restXHTML.re_gt,'\x27':restXHTML.re_apos,'\x22':restXHTML.re_quot,'&':restXHTML.re_amp});}restXHTML.re_amp=/&/g;restXHTML.re_lt=/</g;restXHTML.re_gt=/>/g;restXHTML.re_apos=/&(?:apos|#0?39);/g;restXHTML.re_quot=/"/g;var StringBuilder=function(){this._strList=arg2arr(arguments);};StringBuilder.prototype.append=function(str){if(isString(str)){this._strList.push(str.toString());}};StringBuilder.prototype.insertFirst=function(str){if(isString(str)){this._strList.unshift(str.toString());}};StringBuilder.prototype.appendArray=function(arr){if(isArray(arr)){this._strList=this._strList.concat(arr);}};StringBuilder.prototype.toString=function(spliter){return this._strList.join(!spliter?'':spliter);};StringBuilder.prototype.clear=function(){this._strList.splice(0,this._strList.length);};function write(strFormat,someArgs){if(arguments.length<1||!isString(strFormat)){rt.warn('No patern to write()');return'';}var rArr=arg2arr(arguments);var result=rArr.shift();var tmp;return result.replace(write._pt,function(a,b,c){b=parseInt(b,10);if(b<0||(typeof rArr[b]=='undefined')){rt.warn('write() wrong patern:{0:Q}',strFormat);return'(n/a)';}else{if(!c){return rArr[b];}else{switch(c){case'x':return'0x'+rArr[b].toString(16);case'o':return'o'+rArr[b].toString(8);case'd':return rArr[b].toString(10);case'Q':return'\x22'+rArr[b].toString(16)+'\x22';case'q':return'`'+rArr[b].toString(16)+'\x27';case'b':return'<'+!!rArr[b]+'>';}}}});}write._pt=/\{(\d{1,2})(?:\:([xodQqb]))?\}/g;function isURL(s){return isURL.p.test(s);}isURL.p=/^(?:ht|f)tp(?:s)?\:\/\/(?:[\w\-\.]+)\.\w+/i;function customEncode(s,type){var r;if(typeof type=='undefined'){type='';}switch(type.toUpperCase()){case"URICPT":r=encodeURIComponent(s);break;default:r=encodeURIComponent(s);}return r;}function escapeURI(s){if(!isString(s)){return'';}if(window.encodeURIComponent){return encodeURIComponent(s);}if(window.escape){return escape(s);}}function parseXML(text){if(window.ActiveXObject){var doc=QZFL.lang.tryThese(function(){return new ActiveXObject('MSXML2.DOMDocument.6.0');},function(){return new ActiveXObject('MSXML2.DOMDocument.5.0');},function(){return new ActiveXObject('MSXML2.DOMDocument.4.0');},function(){return new ActiveXObject('MSXML2.DOMDocument.3.0');},function(){return new ActiveXObject('MSXML2.DOMDocument');},function(){return new ActiveXObject('Microsoft.XMLDOM');});doc.async="false";doc.loadXML(text);if(doc.parseError.reason){rt.error(doc.parseError.reason);return null;}}else{var parser=new DOMParser();var doc=parser.parseFromString(text,"text/xml");if(doc.documentElement.nodeName=='parsererror'){rt.error(doc.documentElement.textContent);return null;}}var x=doc.documentElement;return x;}function fillLength(s,l,ss,isBack){if(typeof(s)!='string'){s=s.toString();}if(s.length<l){var res=(1<<(l-s.length)).toString(2).substring(1);if(typeof(ss)!='undefined'&&!!ss){res=res.replace("0",ss.toString()).substring(1);}return isBack?(s+res):(res+s);}else{return s;}};function timeFormatString(s,format){var n;if(typeof(s)=='number'){n=new Date();n.setTime(s);s=n;}if(typeof(s)=='object'){try{s.getTime();}catch(err){rt.error("需要输入时间对象");return"";}if(typeof(format)!='string'){return s.toString();}else{return format.replace(timeFormatString.re,function(a,b,c){var tmp;switch(b){case'y':tmp=s.getYear().toString();return fillLength(tmp.substring(tmp.length-2),2);case'Y':return fillLength(s.getFullYear(),2);case'M':return fillLength(s.getMonth()+1,2,c);case'd':return fillLength(s.getDate(),2,c);case'h':return fillLength(s.getHours(),2,c);case'm':return fillLength(s.getMinutes(),2);case's':return fillLength(s.getSeconds(),2);}});}}}timeFormatString.re=/\{([yYMdhms])(\:[\d\w\s]|)\}/g;function cut(s,bl,tails){if(typeof(s)!='string')return'';if(typeof(tails)=='undefined')tails="";if(getRealLen(s)<=bl){return s;}var res=[],tmp;for(var i=0,cnt=0,len=s.length;i<len&&cnt<bl;++i){res.push(tmp=s.charAt(i));if(cut.ascii_re.test(tmp)){cnt++;}else{cnt+=2;}}return res.join("")+tails;}cut.ascii_re=/[\x00-\xFF]/;function getRealLen(s,isUTF8){if(typeof(s)!='string'){return 0;}if(!isUTF8){return s.replace(getRealLen.r0,"**").length;}else{var cc=s.replace(getRealLen.r1,"");return(s.length-cc.length)+(encodeURI(cc).length/3);}}getRealLen.r0=/[^\x00-\xFF]/g;getRealLen.r1=/[\x00-\xFF]/g;QZFL.namespace.extend(QZFL.transitions,{backEaseIn:function(t,b,c,d){var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;},backEaseOut:function(t,b,c,d,a,p){var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;},backEaseInOut:function(t,b,c,d,a,p){var s=1.70158;if((t/=d/2)<1){return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;}return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;},bounceEaseOut:function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+0.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+0.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+0.984375)+b;}},bounceEaseIn:function(t,b,c,d){return c-QZFL.transitions.bounceEaseOut(d-t,0,c,d)+b;},bounceEaseInOut:function(t,b,c,d){if(t<d/2){return QZFL.transitions.bounceEaseIn(t*2,0,c,d)*0.5+b;}elsereturn QZFL.transitions.bounceEaseOut(t*2-d,0,c,d)*0.5+c*0.5+b;},strongEaseIn:function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;},strongEaseOut:function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;},strongEaseInOut:function(t,b,c,d){if((t/=d/2)<1){return c/2*t*t*t*t*t+b;}return c/2*((t-=2)*t*t*t*t+2)+b;},elasticEaseIn:function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*0.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}else{var s=p/(2*Math.PI)*Math.asin(c/a);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -