📄 mootools.js
字号:
B.pseudos.push(C);break;default:B.tag=E;}return"";});return B;};Selectors.Pseudo=new Hash;Selectors.XPath={getParam:function(B,G,D,H){var A="";switch(G){case" ":A+="//";break;case">":A+="/";break;case"+":A+="/following-sibling::*[1]/self::";break;case"~":A+="/following-sibling::";break;}A+=(D.namespaceURI)?"xhtml:"+H.tag:H.tag;var C;for(C=H.pseudos.length;C--;C){var F=H.pseudos[C];if(F.parser&&F.parser.xpath){A+=F.parser.xpath(F.argument);}else{A+=($chk(F.argument))?"[@"+F.name+'="'+F.argument+'"]':"[@"+F.name+"]";}}if(H.id){A+='[@id="'+H.id+'"]';}for(C=H.classes.length;C--;C){A+='[contains(concat(" ", @class, " "), " '+H.classes[C]+' ")]';}for(C=H.attributes.length;C--;C){var E=H.attributes[C];switch(E[1]){case"=":A+="[@"+E[0]+'="'+E[2]+'"]';break;case"*=":A+="[contains(@"+E[0]+', "'+E[2]+'")]';break;case"^=":A+="[starts-with(@"+E[0]+', "'+E[2]+'")]';break;case"$=":A+="[substring(@"+E[0]+", string-length(@"+E[0]+") - "+E[2].length+' + 1) = "'+E[2]+'"]';break;case"!=":A+="[@"+E[0]+'!="'+E[2]+'"]';break;case"~=":A+='[contains(concat(" ", @'+E[0]+', " "), " '+E[2]+' ")]';break;case"|=":A+='[contains(concat("-", @'+E[0]+', "-"), "-'+E[2]+'-")]';break;default:A+="[@"+E[0]+"]";}}B.push(A);return B;},getItems:function(B,E){var F=[];var G=E.getDocument();var A=G.evaluate(".//"+B.join(""),E,Selectors.XPath.resolver,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null);for(var D=0,C=A.snapshotLength;D<C;D++){F[D]=A.snapshotItem(D);}return F;},resolver:function(A){return(A=="xhtml")?"http://www.w3.org/1999/xhtml":false;}};Selectors.Filter={getParam:function(H,B,A,P,Q){var F=[];var R=P.tag;if(B){var C={},E,D,O,L,K;var G=function(S){S.uid=S.uid||[Native.UID++];if(!C[S.uid]&&Selectors.Filter.match(S,P,Q)){C[S.uid]=true;F.push(S);return true;}return false;};for(var N=0,M=H.length;N<M;N++){O=H[N];switch(B){case" ":D=O.getElementsByTagName(R);P.tag=false;for(L=0,K=D.length;L<K;L++){G(D[L]);}break;case">":D=O.childNodes;for(L=0,K=D.length;L<K;L++){if(D[L].nodeType==1){G(D[L]);}}break;case"+":while((O=O.nextSibling)){if(O.nodeType==1){G(O);break;}}break;case"~":while((O=O.nextSibling)){if(O.nodeType==1&&G(O)){break;}}break;}}return F;}if(P.id){el=A.getElementById(P.id,true);P.id=false;return(el&&Selectors.Filter.match(el,P,Q))?[el]:false;}else{H=A.getElementsByTagName(R);P.tag=false;for(var J=0,I=H.length;J<I;J++){if(Selectors.Filter.match(H[J],P,Q)){F.push(H[J]);}}}return F;},getItems:$arguments(0)};Selectors.Filter.match=function(C,E,G){G=G||{};if(E.id&&E.id!=C.id){return false;}if(E.tag&&E.tag!="*"&&E.tag!=C.tagName.toLowerCase()){return false;}var B;for(B=E.classes.length;B--;B){if(!C.className||!C.className.contains(E.classes[B]," ")){return false;}}for(B=E.attributes.length;B--;B){var D=E.attributes[B];var A=Element.prototype.getProperty.call(C,D[0]);if(!A){return false;}if(!D[1]){continue;}var F;switch(D[1]){case"=":F=(A==D[2]);break;case"*=":F=(A.contains(D[2]));break;case"^=":F=(A.substr(0,D[2].length)==D[2]);break;case"$=":F=(A.substr(A.length-D[2].length)==D[2]);break;case"!=":F=(A!=D[2]);break;case"~=":F=A.contains(D[2]," ");break;case"|=":F=A.contains(D[2],"-");}if(!F){return false;}}for(B=E.pseudos.length;B--;B){if(!E.pseudos[B].parser.filter.call(C,E.pseudos[B].argument,G)){return false;}}return true;};Selectors.Method=(Browser.Features.xpath)?Selectors.XPath:Selectors.Filter;Element.implement({match:function(A){return(!A||Selectors.Filter.match(this,Selectors.parse(A)));}});Selectors.Pseudo.enabled={xpath:function(){return"[not(@disabled)]";},filter:function(){return !(this.disabled);}};Selectors.Pseudo.empty={xpath:function(){return"[not(node())]";},filter:function(){return !(this.innerText||this.textContent||"").length;}};Selectors.Pseudo.contains={xpath:function(A){return'[contains(text(), "'+A+'")]';},filter:function(B){for(var A=this.childNodes.length;A--;A){var C=this.childNodes[A];if(C.nodeName&&C.nodeType==3&&C.nodeValue.contains(B)){return true;}}return false;}};Selectors.Pseudo.nth={parser:function(E){E=(E)?E.match(/^([+-]?\d*)?([devon]+)?([+-]?\d*)?$/):[null,1,"n",0];if(!E){return false;}var D=parseInt(E[1]);var B=($chk(D))?D:1;var C=E[2]||false;var A=parseInt(E[3])||0;A=A-1;while(A<1){A+=B;}while(A>=B){A-=B;}switch(C){case"n":return{a:B,b:A,special:"n"};case"odd":return{a:2,b:0,special:"n"};case"even":return{a:2,b:1,special:"n"};case"first":return{a:0,special:"index"};case"last":return{special:"last"};case"only":return{special:"only"};default:return{a:(B-1),special:"index"};}},xpath:function(A){switch(A.special){case"n":return"[count(preceding-sibling::*) mod "+A.a+" = "+A.b+"]";case"last":return"[count(following-sibling::*) = 0]";case"only":return"[not(preceding-sibling::* or following-sibling::*)]";default:return"[count(preceding-sibling::*) = "+A.a+"]";}},filter:function(A,I){var J=0,C=this;switch(A.special){case"n":I.Positions=I.Positions||{};if(!I.Positions[this.uid]){var D=this.parentNode.childNodes;for(var G=0,F=D.length;G<F;G++){var B=D[G];if(B.nodeType!=1){continue;}B.uid=B.uid||[Native.UID++];I.Positions[B.uid]=J++;}}return(I.Positions[this.uid]%A.a==A.b);case"last":while((C=C.nextSibling)){if(C.nodeType==1){return false;}}return true;case"only":var E=C;while((E=E.previousSibling)){if(E.nodeType==1){return false;}}var H=C;while((H=H.nextSibling)){if(H.nodeType==1){return false;}}return true;case"index":while((C=C.previousSibling)){if(C.nodeType==1&&++J>A.a){return false;}}return true;}return false;}};Selectors.Pseudo.extend({even:{parser:function(){return{a:2,b:1,special:"n"};},xpath:Selectors.Pseudo.nth.xpath,filter:Selectors.Pseudo.nth.filter},odd:{parser:function(){return{a:2,b:0,special:"n"};},xpath:Selectors.Pseudo.nth.xpath,filter:Selectors.Pseudo.nth.filter},first:{parser:function(){return{a:0,special:"index"};},xpath:Selectors.Pseudo.nth.xpath,filter:Selectors.Pseudo.nth.filter},last:{parser:function(){return{special:"last"};},xpath:Selectors.Pseudo.nth.xpath,filter:Selectors.Pseudo.nth.filter},only:{parser:function(){return{special:"only"};},xpath:Selectors.Pseudo.nth.xpath,filter:Selectors.Pseudo.nth.filter}});Element.Events.domready={onAdd:function(E){if(Browser.loaded){return E.call(this);}var H=this,D=this.getWindow(),G=this.getDocument();var C=function(){if(!arguments.callee.done){arguments.callee.done=true;E.call(H);}return true;};var I=(Browser.Engine.webkit)?["loaded","complete"]:"complete";var B=function(J){if(I.contains(J.readyState)){return C();}return false;};if(G.readyState&&Browser.Engine.webkit){(function(){if(!B(G)){arguments.callee.delay(50);}})();}else{if(G.readyState&&Browser.Engine.trident){var F=$("ie_domready");if(!F){var A=(D.location.protocol=="https:")?"//:":"javascript:void(0)";G.write('<script id="ie_domready" defer src="'+A+'"><\/script>');F=$("ie_domready");}if(!B(F)){F.addEvent("readystatechange",B.pass(F));}}else{D.addEvent("load",C);G.addEvent("DOMContentLoaded",C);}}return null;}};window.addEvent("domready",function(){Browser.loaded=true;});var JSON=new Hash({encode:function(B){switch($type(B)){case"string":return'"'+B.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(B.map(JSON.encode).filter($defined))+"]";case"object":case"hash":var A=[];Hash.each(B,function(E,D){var C=JSON.encode(E);if(C){A.push(JSON.encode(D)+":"+C);}});return"{"+String(A)+"}";case"number":case"boolean":return String(B);case false:return"null";}return null;},$specialChars:{"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},$replaceChars:function(A){return JSON.$specialChars[A]||"\\u00"+Math.floor(A.charCodeAt()/16).toString(16)+(A.charCodeAt()%16).toString(16);},decode:function(string,secure){if($type(string)!="string"||!string.length){return null;}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"@").replace(/"[^"\\\n\r]*"/g,""))){return null;}return eval("("+string+")");}});Native.implement([Hash,Array,String,Number],{toJSON:function(){return JSON.encode(this);}});var Request=new Class({Implements:[Chain,Events,Options],options:{url:"",data:"",headers:{},async:true,method:"post",link:"ignore",isSuccess:null,emulation:true,urlEncoded:true,encoding:"utf-8",evalScripts:false,evalResponse:false},getXHR:function(){return(window.XMLHttpRequest)?new XMLHttpRequest():((window.ActiveXObject)?new ActiveXObject("Microsoft.XMLHTTP"):false);},initialize:function(A){if(!(this.xhr=this.getXHR())){return ;}this.setOptions(A);this.options.isSuccess=this.options.isSuccess||this.isSuccess;this.headers=new Hash(this.options.headers).extend({"X-Requested-With":"XMLHttpRequest",Accept:"text/javascript, text/html, application/xml, text/xml, */*"});},onStateChange:function(){if(this.xhr.readyState!=4||!this.running){return ;}this.running=false;this.status=0;$try(function(){this.status=this.xhr.status;},this);if(this.options.isSuccess.call(this,this.status)){this.response={text:this.xhr.responseText,xml:this.xhr.responseXML};this.success(this.response.text,this.response.xml);}else{this.response={text:null,xml:null};this.failure();}this.xhr.onreadystatechange=$empty;},isSuccess:function(){return((this.status>=200)&&(this.status<300));},processScripts:function(A){if(this.options.evalResponse||(/(ecma|java)script/).test(this.getHeader("Content-type"))){return $exec(A);}return A.stripScripts(this.options.evalScripts);},success:function(B,A){this.onSuccess(this.processScripts(B),A);},onSuccess:function(){this.fireEvent("onComplete",arguments).fireEvent("onSuccess",arguments).callChain();},failure:function(){this.onFailure();},onFailure:function(){this.fireEvent("onComplete").fireEvent("onFailure",this.xhr);},setHeader:function(A,B){this.headers.set(A,B);return this;},getHeader:function(A){return $try(function(){return this.getResponseHeader(A);},this.xhr)||null;},check:function(){if(!this.running){return true;}switch(this.options.link){case"cancel":this.cancel();return true;case"chain":this.chain(this.send.bind(this,arguments));return false;}return false;},send:function(D){if(!this.check(D)){return this;}this.running=true;var E=$type(D);if(E=="string"||E=="element"){D={data:D};}var A=this.options;D=$extend({data:A.data,url:A.url,method:A.method},D);var G=D.data,C=D.url,H=D.method;switch($type(G)){case"element":G=$(G).toQueryString();break;case"object":case"hash":G=Hash.toQueryString(G);}if(this.options.emulation&&["put","delete"].contains(H)){var B="_method="+H;G=(G)?B+"&"+G:B;H="post";}if(this.options.urlEncoded&&H=="post"){var F=(this.options.encoding)?"; charset="+this.options.encoding:"";this.headers.set("Content-type","application/x-www-form-urlencoded"+F);}if(G&&H=="get"){C=C+(C.contains("?")?"&":"?")+G;G=null;}this.xhr.open(H.toUpperCase(),C,this.options.async);this.xhr.onreadystatechange=this.onStateChange.bind(this);this.headers.each(function(J,I){try{this.xhr.setRequestHeader(I,J);}catch(K){this.fireEvent("onException",[K,I,J]);}},this);this.fireEvent("onRequest");this.xhr.send(G);if(!this.options.async){this.onStateChange();}return this;},cancel:function(){if(!this.running){return this;}this.running=false;this.xhr.abort();this.xhr.onreadystatechange=$empty;this.xhr=this.getXHR();this.fireEvent("onCancel");return this;}});(function(){var A={};["get","post","GET","POST","PUT","DELETE"].each(function(B){A[B]=function(){var C=Array.link(arguments,{url:String.type,data:$defined});return this.send($extend(C,{method:B.toLowerCase()}));};});Request.implement(A);})();Element.Properties.send={get:function(A){if(A||!this.retrieve("send")){this.set("send",A);}return this.retrieve("send");},set:function(A){var B=this.retrieve("send");if(B){B.cancel();}return this.store("send",new Request($extend({data:this,link:"cancel",method:this.get("method")||"post",url:this.get("action")},A)));}};Element.implement({send:function(A){var B=this.get("send");B.send({data:this,url:A||B.options.url});return this;}});Request.JSON=new Class({Extends:Request,options:{secure:true},initialize:function(A){arguments.callee.parent(A);},success:function(A){this.response.json=JSON.decode(A,this.options.secure);this.onSuccess(this.response.json,A);}});
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -