event-min.js revision 833987a6d18134e5f1f2e741cf4ebd959dec1398
(function(){var E=YUI.Env,G=YUI.config,F=G.doc,B=G.pollInterval||40,A=function(C){E._ready();};if(!E._ready){E._ready=function(){if(!E.DOMReady){E.DOMReady=true;if(F.removeEventListener){F.removeEventListener("DOMContentLoaded",A,false);}}};if(navigator.userAgent.match(/MSIE/)){E._dri=setInterval(function(){try{document.documentElement.doScroll("left");clearInterval(E._dri);E._dri=null;A();}catch(C){}},B);}else{F.addEventListener("DOMContentLoaded",A,false);}}})();YUI.add("event",function(F){(function(){var I=YUI.Env,G=F.Env.evt.plugins,H=function(){F.fire("domready");};F.mix(G,{domready:{},"event:ready":{on:function(){var J=F.Array(arguments,0,true);J[0]="domready";return F.subscribe.apply(F,J);},detach:function(){var J=F.Array(arguments,0,true);J[0]="domready";return F.unsubscribe.apply(F,J);}}});F.publish("domready",{fireOnce:true});if(I.DOMReady){H();}else{F.before(H,I,"_ready");}})();(function(){var H=F.UA,G={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},I=function(K){if(!K){return null;}try{if(H.webkit&&3==K.nodeType){K=K.parentNode;}}catch(J){}return F.Node.get(K);};F.DOMEventFacade=function(R,K,J){var N=R,L=K,O=F.config.doc,S=O.body,T=N.pageX,Q=N.pageY,M,P,U;this.altKey=N.altKey;this.ctrlKey=N.ctrlKey;this.metaKey=N.metaKey;this.shiftKey=N.shiftKey;if(!T&&0!==T){T=N.clientX||0;Q=N.clientY||0;if(H.ie){T+=Math.max(O.documentElement.scrollLeft,S.scrollLeft);Q+=Math.max(O.documentElement.scrollTop,S.scrollTop);}}this._yuifacade=true;this.pageX=T;this.pageY=Q;P=N.keyCode||N.charCode||0;if(H.webkit&&(P in G)){P=G[P];}this.keyCode=P;this.charCode=P;this.button=N.which||N.button;this.which=this.button;this.target=I(N.target||N.srcElement);this.currentTarget=I(L);U=N.relatedTarget;if(!U){if(N.type=="mouseout"){U=N.toElement;}else{if(N.type=="mouseover"){U=N.fromElement;}}}this.relatedTarget=I(U);this.stopPropagation=function(){if(N.stopPropagation){N.stopPropagation();}else{N.cancelBubble=true;}J.stopPropagation();};this.stopImmediatePropagation=function(){if(N.stopImmediatePropagation){N.stopImmediatePropagation();}else{this.stopPropagation();}J.stopImmediatePropagation();};this.preventDefault=function(){if(N.preventDefault){N.preventDefault();}else{N.returnValue=false;}J.preventDefault();};this.halt=function(V){if(V){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};})();(function(){var O=YUI.Env.add,J=YUI.Env.remove,M=function(){YUI.Env.windowLoaded=true;F.Event._load();J(window,"load",M);},G=function(){F.Event._unload();J(window,"unload",G);},H="domready",K="~yui|2|compat~",I="capture_",L=function(Q){try{return(Q&&typeof Q!=="string"&&(Q.length&&((!Q.size)||(Q.size()>1)))&&!Q.tagName&&!Q.alert&&(Q.item||typeof Q[0]!=="undefined"));}catch(P){return false;}},N=function(){var R=false,S=0,Q=[],T={},P=null,U={};return{POLL_RETRYS:1000,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var V=F.Event;if(!V._interval){V._interval=setInterval(F.bind(V._poll,V),V.POLL_INTERVAL);}},onAvailable:function(d,Y,c,b,Z,W){var V=F.Array(d),X;for(X=0;X<V.length;X=X+1){Q.push({id:V[X],fn:Y,obj:c,override:b,checkReady:Z,compat:W});}S=this.POLL_RETRYS;setTimeout(F.bind(F.Event._poll,F.Event),0);return new F.EventHandle();},onContentReady:function(Z,W,Y,X,V){return this.onAvailable(Z,W,Y,X,true,V);},attach:function(d,e,W,a){W=W||F.config.win;var c=F.Array(arguments,0,true),h=c.slice(1),i,l=F.Event,k=false,j,Z,X,g,f,V,Y=false,b;if(d.indexOf(I)>-1){d=d.substr(I.length);k=true;}if(h[h.length-1]===K){i=true;h.pop();}if(!e||!e.call){return false;}if(L(W)){j=[];F.each(W,function(n,m){c[2]=n;j.push(l.attach.apply(l,c));});return(j.length===1)?j[0]:j;}else{if(F.Lang.isString(W)){Z=(i)?F.DOM.byId(W):F.Selector.query(W);if(Z){if(F.Lang.isArray(Z)){if(Z.length==1){W=Z[0];}else{c[2]=Z;return l.attach.apply(l,c);}}else{W=Z;}}else{return this.onAvailable(W,function(){l.attach.apply(l,c);},l,true,false,i);}}}if(!W){return false;}if(F.Node&&W instanceof F.Node){return W.on.apply(W,c);}X=F.stamp(W);g="event:"+X+d;f=T[g];if(!f){f=F.publish(g,{bubbles:false});f.el=W;f.type=d;f.fn=function(m){f.fire(l.getEvent(m,W,i));};if(W==F.config.win&&d=="load"){f.fireOnce=true;P=g;if(YUI.Env.windowLoaded){Y=true;}}T[g]=f;U[X]=U[X]||{};U[X][g]=f;O(W,d,f.fn,k);}V=h[2]||((i)?W:F.get(W));h[1]=V;h.splice(2,1);b=f.subscribe.apply(f,h);if(Y){f.fire();}return b;},detach:function(c,e,X,Y){var b=F.Array(arguments,0,true),f,Z,a,d,V,W;if(b[b.length-1]===K){f=true;}if(c&&c.detach){return c.detach();}if(typeof X=="string"){X=(f)?F.DOM.byId(X):F.Selector.query(X);return F.Event.detach.apply(F.Event,b);}else{if(L(X)){d=true;for(Z=0,a=X.length;Z<a;++Z){b[2]=X[Z];d=(F.Event.detach.apply(F.Event,b)&&d);}return d;}}if(!c||!e||!e.call){return this.purgeElement(X,false,c);}V="event:"+F.stamp(X)+c;W=T[V];if(W){return W.detach(e);}else{return false;}},getEvent:function(Y,W,V){var X=Y||window.event;return(V)?X:new F.DOMEventFacade(X,W,T["event:"+F.stamp(W)+Y.type]);},generateId:function(V){var W=V.id;if(!W){W=F.stamp(V);V.id=W;}return W;},_isValidCollection:L,_load:function(V){if(!R){R=true;if(F.fire){F.fire(H);}F.Event._poll();}},_poll:function(){if(this.locked){return;}if(F.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return;}this.locked=true;var a=!R,Z,b,W,V,Y,X;if(!a){a=(S>0);}Z=[];b=function(e,f){var d,c=f.override;if(f.compat){if(f.override){if(c===true){d=f.obj;}else{d=c;}}else{d=e;}f.fn.call(d,f.obj);}else{d=f.obj||F.get(e);f.fn.apply(d,(F.Lang.isArray(c))?c:[]);}};for(W=0,V=Q.length;W<V;++W){Y=Q[W];if(Y&&!Y.checkReady){X=(Y.compat)?F.DOM.byId(Y.id):F.Selector.query(Y.id,null,true);if(X){b(X,Y);Q[W]=null;}else{Z.push(Y);}}}for(W=0,V=Q.length;W<V;++W){Y=Q[W];if(Y&&Y.checkReady){X=(Y.compat)?F.DOM.byId(Y.id):F.Selector.query(Y.id,null,true);if(X){if(R||(X.get&&X.get("nextSibling"))||X.nextSibling){b(X,Y);Q[W]=null;}}else{Z.push(Y);}}}S=(Z.length===0)?0:S-1;if(a){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return;
},purgeElement:function(a,b,Z){var X=(F.Lang.isString(a))?F.Selector.query(a,null,true):a,W=this.getListeners(X,Z),Y,V;if(W){for(Y=0,V=W.length;Y<V;++Y){W[Y].detachAll();}}if(b&&X&&X.childNodes){for(Y=0,V=X.childNodes.length;Y<V;++Y){this.purgeElement(X.childNodes[Y],b,Z);}}},getListeners:function(Z,Y){var a=F.stamp(Z,true),V=U[a],X=[],W=(Y)?"event:"+a+Y:null;if(!V){return null;}if(W){if(V[W]){X.push(V[W]);}}else{F.each(V,function(c,b){X.push(c);});}return(X.length)?X:null;},_unload:function(W){var V=F.Event;F.each(T,function(Y,X){Y.detachAll();J(Y.el,Y.type,Y.fn);delete T[X];});J(window,"load",V._load);J(window,"unload",V._unload);},nativeAdd:O,nativeRemove:J};}();F.Event=N;if(F.config.injected||YUI.Env.windowLoaded){M();}else{O(window,"load",M);}if(F.UA.ie){F.on(H,N._poll,N,true);}O(window,"unload",G);N.Custom=F.CustomEvent;N.Subscriber=F.Subscriber;N.Target=F.EventTarget;N.Handle=F.EventHandle;N.Facade=F.EventFacade;N._poll();})();F.Env.evt.plugins.available={on:function(I,H,K,J){var G=arguments.length>4?F.Array(arguments,4,true):[];return F.Event.onAvailable.call(F.Event,K,H,J,G);}};F.Env.evt.plugins.contentready={on:function(I,H,K,J){var G=arguments.length>4?F.Array(arguments,4,true):[];return F.Event.onContentReady.call(F.Event,K,H,J,G);}};(function(){var J=F.UA.ie?"focusin":"focus",K=F.UA.ie?"focusout":"blur",L="capture_",I=F.Env.evt.plugins,H=function(){},G=function(N,P){var M=(F.Lang.isString(P))?F.Selector.query(P):P,O=M&&M.parentNode;if(O){F.Event.attach(N,H,O);}};I.focus={on:function(O,N,P){var M=F.Array(arguments,0,true);M[0]=L+J;if(F.UA.opera){G(M[0],P);}return F.Event.attach.apply(F.Event,M);},detach:function(){var M=F.Array(arguments,0,true);M[0]=L+J;return F.Event.detach.apply(F.Event,M);}};I.blur={on:function(O,N,P){var M=F.Array(arguments,0,true);M[0]=L+K;if(F.UA.opera){G(M[0],P);}return F.Event.attach.apply(F.Event,M);},detach:function(){var M=F.Array(arguments,0,true);M[0]=L+K;return F.Event.detach.apply(F.Event,M);}};})();F.Env.evt.plugins.key={on:function(J,L,G,P,H){var N=F.Array(arguments,0,true),K,O,M,I;if(!P||P.indexOf(":")==-1){N[0]="keypress";return F.on.apply(F,N);}K=P.split(":");O=K[0];M=(K[1])?K[1].split(/,|\+/):null;I=(F.Lang.isString(G)?G:F.stamp(G))+P;I=I.replace(/,/g,"_");if(!F.getEvent(I)){F.on(J+O,function(U){var V=false,R=false,S,Q,T;for(S=0;S<M.length;S=S+1){Q=M[S];T=parseInt(Q,10);if(F.Lang.isNumber(T)){if(U.charCode===T){V=true;}else{R=true;}}else{if(V||!R){V=(U[Q+"Key"]);R=!V;}}}if(V){F.fire(I,U);}},G);}N.splice(2,2);N[0]=I;return F.on.apply(F,N);}};(function(){var H={},G=function(K,O){var N=O.target,M=H[K],J,L;for(J in M){if(M.hasOwnProperty(J)){L=M[J];O.currentTarget.queryAll(J).some(function(Q,P){if(Q.compareTo(N)||Q.contains(N)){O.target=Q;F.fire(L,O);return true;}});}}},I=F.cached(function(J){return J.replace(/[|,:]/g,"~");});F.Env.evt.plugins.delegate={on:function(N,P,L,J,R){if(!R){return false;}var O=(F.Lang.isString(L)?L:F.stamp(L)),M="delegate:"+O+J+I(R),K=J+O,Q=F.Array(arguments,0,true);if(!(K in H)){H[K]={};F.on(J,function(S){G(K,S);},L);}H[K][R]=M;Q[0]=M;Q.splice(2,3);return F.on.apply(F,Q);}};})();(function(){var H,G,J="window:resize",I=function(K){if(F.UA.gecko){F.fire(J,K);}else{if(G){G.cancel();}G=F.later(F.config.windowResizeDelay||40,F,function(){F.fire(J,K);});}};F.Env.evt.plugins.windowresize={on:function(M,L){if(!H){H=F.on("resize",I);}var K=F.Array(arguments,0,true);K[0]=J;return F.on.apply(F,K);}};})();var A=F.Lang.isString,C=function(J,G,I,K,H){if(!J.compareTo(G)&&!J.contains(G)){K.target=J;F.fire(I,K);}},D=function(L,I,H){var G=L.relatedTarget,K=L.currentTarget,J=L.target;if(H){K.queryAll(H).some(function(M){var N;if(M.compareTo(J)||M.contains(J)){C(M,G,I,L,H);N=true;}return N;});}else{C(K,G,I,L);}},E=F.cached(function(G){return G.replace(/[|,:]/g,"~");}),B={on:function(L,K,J,H){var G=(L==="mouseenter")?"mouseover":"mouseout",M=L+":"+(A(J)?J:F.stamp(J))+G,I=F.Array(arguments,0,true),N;if(A(H)){N=H;M=M+E(N);}if(!F.getEvent(M)){F.on(G,function(O){D(O,M,N);},J);}I[0]=M;if(N){I.splice(2,2);}else{I.splice(2,1);}return F.on.apply(F,I);}};F.Env.evt.plugins.mouseenter=B;F.Env.evt.plugins.mouseleave=B;},"@VERSION@",{requires:["event-custom"]});