event-min.js revision 3a2bae0778978fd21c0bb592e0480bc7354f5925
(function(){var GLOBAL_ENV=YUI.Env,C=YUI.config,D=C.doc,POLL_INTERVAL=C.pollInterval||40,_ready=function(e){GLOBAL_ENV._ready();};if(!GLOBAL_ENV._ready){GLOBAL_ENV._ready=function(){if(!GLOBAL_ENV.DOMReady){GLOBAL_ENV.DOMReady=true;if(D.removeEventListener){D.removeEventListener("DOMContentLoaded",_ready,false);}}};
/* DOMReady: based on work by: Dean Edwards/John Resig/Matthias Miller/Diego Perini */
if(navigator.userAgent.match(/MSIE/)){if(window!==window.top){document.onreadystatechange=function(){if(document.readyState=="complete"){document.onreadystatechange=null;_ready();}};}else{GLOBAL_ENV._dri=setInterval(function(){try{document.documentElement.doScroll("left");clearInterval(GLOBAL_ENV._dri);GLOBAL_ENV._dri=null;_ready();}catch(ex){}},POLL_INTERVAL);}}else{D.addEventListener("DOMContentLoaded",_ready,false);}}})();YUI.add("event-base",function(A){(function(){var C=YUI.Env,B=function(){A.fire("domready");};A.publish("domready",{fireOnce:true});if(C.DOMReady){B();}else{A.before(B,C,"_ready");}})();(function(){var C=A.UA,B={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9,63272:46,63273:36,63275:35},D=function(F){if(!F){return null;}try{if(C.webkit&&3==F.nodeType){F=F.parentNode;}}catch(E){}return A.Node.get(F);};A.DOMEventFacade=function(L,F,E){E=E||{};var H=L,G=F,I=A.config.doc,M=I.body,N=H.pageX,K=H.pageY,J,O;this.altKey=H.altKey;this.ctrlKey=H.ctrlKey;this.metaKey=H.metaKey;this.shiftKey=H.shiftKey;this.type=H.type;this.clientX=H.clientX;this.clientY=H.clientY;if(!N&&0!==N){N=H.clientX||0;K=H.clientY||0;if(C.ie){N+=Math.max(I.documentElement.scrollLeft,M.scrollLeft);K+=Math.max(I.documentElement.scrollTop,M.scrollTop);}}this._yuifacade=true;this._event=H;this.pageX=N;this.pageY=K;J=H.keyCode||H.charCode||0;if(C.webkit&&(J in B)){J=B[J];}this.keyCode=J;this.charCode=J;this.button=H.which||H.button;this.which=this.button;this.target=D(H.target||H.srcElement);this.currentTarget=D(G);O=H.relatedTarget;if(!O){if(H.type=="mouseout"){O=H.toElement;}else{if(H.type=="mouseover"){O=H.fromElement;}}}this.relatedTarget=D(O);if(H.type=="mousewheel"||H.type=="DOMMouseScroll"){this.wheelDelta=(H.detail)?(H.detail*-1):Math.round(H.wheelDelta/80)||((H.wheelDelta<0)?-1:1);}this.stopPropagation=function(){if(H.stopPropagation){H.stopPropagation();}else{H.cancelBubble=true;}E.stopped=1;};this.stopImmediatePropagation=function(){if(H.stopImmediatePropagation){H.stopImmediatePropagation();}else{this.stopPropagation();}E.stopped=2;};this.preventDefault=function(P){if(H.preventDefault){H.preventDefault();}H.returnValue=P||false;E.prevented=1;};this.halt=function(P){if(P){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};})();(function(){var H=YUI.Env.add,B=YUI.Env.remove,F=function(){YUI.Env.windowLoaded=true;A.Event._load();B(window,"load",F);},E=function(){A.Event._unload();B(window,"unload",E);},I="domready",G="~yui|2|compat~",D=function(K){try{return((K&&typeof K!=="string"&&K.length&&!K.tagName&&!K.alert&&(K.item||typeof K[0]!=="undefined")));}catch(J){return false;}},C=function(){var L=false,M=0,K=[],N={},J=null,O={};return{POLL_RETRYS:1000,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var P=A.Event;if(!P._interval){P._interval=setInterval(A.bind(P._poll,P),P.POLL_INTERVAL);}},onAvailable:function(W,S,V,U,T,Q){var P=A.Array(W),R;for(R=0;R<P.length;R=R+1){K.push({id:P[R],fn:S,obj:V,override:U,checkReady:T,compat:Q});}M=this.POLL_RETRYS;setTimeout(A.bind(A.Event._poll,A.Event),0);return new A.EventHandle();},onContentReady:function(T,Q,S,R,P){return this.onAvailable(T,Q,S,R,true,P);},attach:function(S,R,Q,P){return A.Event._attach(A.Array(arguments,0,true));},_createWrapper:function(V,U,P,Q,T){var W=A.stamp(V),S="event:"+W+U,R;if(false===T){S+="native";}if(P){S+="capture";}R=N[S];if(!R){R=A.publish(S,{bubbles:false,contextFn:function(){R.nodeRef=R.nodeRef||A.get(R.el);return R.nodeRef;}});R.el=V;R.type=U;R.fn=function(X){R.fire(A.Event.getEvent(X,V,(Q||(false===T))));};if(V==A.config.win&&U=="load"){R.fireOnce=true;J=S;}N[S]=R;O[W]=O[W]||{};O[W][S]=R;H(V,U,R.fn,P);}return R;},_attach:function(V,R){var Y=V.slice(1),a,e=A.Event,c,T,Z,P,S=false,U,W=V[0],X=V[1],Q=V[2]||A.config.win,d=R&&R.facade,b=R&&R.capture;if(Y[Y.length-1]===G){a=true;Y.pop();}if(!X||!X.call){return false;}if(D(Q)){c=[];A.each(Q,function(g,f){V[2]=g;c.push(e._attach(V,R));});return(c.length===1)?c[0]:c;}else{if(A.Lang.isString(Q)){if(a){T=A.DOM.byId(Q);}else{T=A.Selector.query(Q);switch(T.length){case 0:T=null;break;case 1:T=T[0];break;default:V[2]=T;return e._attach(V,R);}}if(T){Q=T;}else{return this.onAvailable(Q,function(){e._attach(V,R);},e,true,false,a);}}}if(!Q){return false;}if(A.Node&&Q instanceof A.Node){Q=A.Node.getDOMNode(Q);}Z=this._createWrapper(Q,W,b,a,d);if(Q==A.config.win&&W=="load"){if(YUI.Env.windowLoaded){S=true;}}P=Y[2];Y[1]=P;Y.splice(2,1);U=Z.on.apply(Z,Y);if(S){Z.fire();}return U;},detach:function(W,Y,R,S){var V=A.Array(arguments,0,true),Z,T,U,X,P,Q;if(V[V.length-1]===G){Z=true;}if(W&&W.detach){return W.detach();}if(typeof R=="string"){R=(Z)?A.DOM.byId(R):A.Selector.query(R);return A.Event.detach.apply(A.Event,V);}else{if(D(R)){X=true;for(T=0,U=R.length;T<U;++T){V[2]=R[T];X=(A.Event.detach.apply(A.Event,V)&&X);}return X;}}if(!W||!Y||!Y.call){return this.purgeElement(R,false,W);}P="event:"+A.stamp(R)+W;Q=N[P];if(Q){return Q.detach(Y);}else{return false;}},getEvent:function(S,Q,P){var R=S||window.event;return(P)?R:new A.DOMEventFacade(R,Q,N["event:"+A.stamp(Q)+S.type]);},generateId:function(P){var Q=P.id;if(!Q){Q=A.stamp(P);P.id=Q;}return Q;},_isValidCollection:D,_load:function(P){if(!L){L=true;if(A.fire){A.fire(I);}A.Event._poll();}},_poll:function(){if(this.locked){return;}if(A.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return;}this.locked=true;var U=!L,T,V,Q,P,S,R;if(!U){U=(M>0);}T=[];V=function(Y,Z){var X,W=Z.override;if(Z.compat){if(Z.override){if(W===true){X=Z.obj;}else{X=W;}}else{X=Y;}Z.fn.call(X,Z.obj);
}else{X=Z.obj||A.get(Y);Z.fn.apply(X,(A.Lang.isArray(W))?W:[]);}};for(Q=0,P=K.length;Q<P;++Q){S=K[Q];if(S&&!S.checkReady){R=(S.compat)?A.DOM.byId(S.id):A.Selector.query(S.id,null,true);if(R){V(R,S);K[Q]=null;}else{T.push(S);}}}for(Q=0,P=K.length;Q<P;++Q){S=K[Q];if(S&&S.checkReady){R=(S.compat)?A.DOM.byId(S.id):A.Selector.query(S.id,null,true);if(R){if(L||(R.get&&R.get("nextSibling"))||R.nextSibling){V(R,S);K[Q]=null;}}else{T.push(S);}}}M=(T.length===0)?0:M-1;if(U){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return;},purgeElement:function(U,V,T){var R=(A.Lang.isString(U))?A.Selector.query(U,null,true):U,Q=this.getListeners(R,T),S,P;if(Q){for(S=0,P=Q.length;S<P;++S){Q[S].detachAll();}}if(V&&R&&R.childNodes){for(S=0,P=R.childNodes.length;S<P;++S){this.purgeElement(R.childNodes[S],V,T);}}},getListeners:function(T,S){var U=A.stamp(T,true),P=O[U],R=[],Q=(S)?"event:"+U+S:null;if(!P){return null;}if(Q){if(P[Q]){R.push(P[Q]);}}else{A.each(P,function(W,V){R.push(W);});}return(R.length)?R:null;},_unload:function(Q){var P=A.Event;A.each(N,function(S,R){S.detachAll();B(S.el,S.type,S.fn);delete N[R];});B(window,"load",P._load);},nativeAdd:H,nativeRemove:B};}();A.Event=C;if(A.config.injected||YUI.Env.windowLoaded){F();}else{H(window,"load",F);}if(A.UA.ie){A.on(I,C._poll,C,true);}H(window,"unload",E);C.Custom=A.CustomEvent;C.Subscriber=A.Subscriber;C.Target=A.EventTarget;C.Handle=A.EventHandle;C.Facade=A.EventFacade;C._poll();})();A.Env.evt.plugins.available={on:function(D,C,F,E){var B=arguments.length>4?A.Array(arguments,4,true):[];return A.Event.onAvailable.call(A.Event,F,C,E,B);}};A.Env.evt.plugins.contentready={on:function(D,C,F,E){var B=arguments.length>4?A.Array(arguments,4,true):[];return A.Event.onContentReady.call(A.Event,F,C,E,B);}};},"@VERSION@",{requires:["event-custom-base"]});YUI.add("event-delegate",function(B){var J=B.Event,F=B.Lang,E={},A={mouseenter:"mouseover",mouseleave:"mouseout"},I={focus:J._attachFocus,blur:J._attachBlur},H=function(L){try{if(L&&3==L.nodeType){return L.parentNode;}}catch(K){}return L;},D=function(L,Q,N){var R=H((Q.target||Q.srcElement)),O=E[L],U,P,M,T,S;var K=function(Y,V,W){var X;if(!Y||Y===W){X=false;}else{X=B.Selector.test(Y,V)?Y:K(Y.parentNode,V,W);}return X;};for(U in O){if(O.hasOwnProperty(U)){P=O[U];T=O.fn;M=null;if(B.Selector.test(R,U,N)){M=R;}else{if(B.Selector.test(R,((U.replace(/,/gi," *,"))+" *"),N)){M=K(R,U,N);}}if(M){if(!S){S=new B.DOMEventFacade(Q,N);S.container=S.currentTarget;}S.currentTarget=B.Node.get(M);B.publish(P,{contextFn:function(){return S.currentTarget;}});if(T){T(S,P);}else{B.fire(P,S);}}}}},G=function(N,M,L){var O=I[N],K=[N,function(P){D(M,(P||window.event),L);},L];if(O){O(K,{capture:true,facade:false});}else{J._attach(K,{facade:false});}},C=B.cached(function(K){return K.replace(/[|,:]/g,"~");});B.Env.evt.plugins.delegate={on:function(P,O,N,K,L){var M=B.Array(arguments,0,true);M.splice(3,1);M[0]=K;return B.delegate.apply(B,M);}};B.Event.delegate=function(P,S,L,T){if(!T){return false;}var R=(F.isString(L)?L:B.stamp(L)),M="delegate:"+R+P+C(T),K=P+R,Q=E[K],O=B.Array(arguments,0,true),N;if(!Q){Q={};N=F.isString(L)?B.Selector.query(L):B.Node.getDOMNode(L);if(A[P]){P=A[P];Q.fn=J._fireMouseEnter;}if(F.isArray(N)){B.Array.each(N,function(U){G(P,K,U);});}else{G(P,K,N);}E[K]=Q;}Q[T]=M;O[0]=M;O.splice(2,2);return B.on.apply(B,O);};B.delegate=J.delegate;},"@VERSION@",{requires:["event-base"]});YUI.add("event-mousewheel",function(C){var B="DOMMouseScroll",A=function(E){var D=C.Array(E,0,true),F;if(C.UA.gecko){D[0]=B;F=C.config.win;}else{F=C.config.doc;}if(D.length<3){D[2]=F;}else{D.splice(2,0,F);}return D;};C.Env.evt.plugins.mousewheel={on:function(){return C.Event._attach(A(arguments));},detach:function(){return C.Event.detach.apply(C.Event,A(arguments));}};},"@VERSION@",{requires:["event-base"]});YUI.add("event-mouseenter",function(D){D.Event._fireMouseEnter=function(H,F){var E=H.relatedTarget,G=H.currentTarget;if(!G.compareTo(E)&&!G.contains(E)){D.publish(F,{contextFn:function(){return G;}});D.fire(F,H);}};var C=D.Env.evt.plugins,A=D.Lang.isString,B={on:function(I,H,G){var E=(I==="mouseenter")?"mouseover":"mouseout",J=I+":"+(A(G)?G:D.stamp(G))+E,F=D.Array(arguments,0,true);if(!D.getEvent(J)){D.on(E,D.rbind(D.Event._fireMouseEnter,D,J),G);}F[0]=J;F.splice(2,1);return D.on.apply(D,F);}};C.mouseenter=B;C.mouseleave=B;},"@VERSION@",{requires:["event-base"]});YUI.add("event-key",function(A){A.Env.evt.plugins.key={on:function(E,G,B,K,C){var I=A.Array(arguments,0,true),F,J,H,D;F=K&&K.split(":");if(!K||K.indexOf(":")==-1||!F[1]){I[0]="key"+((F&&F[0])||"press");return A.on.apply(A,I);}J=F[0];H=(F[1])?F[1].split(/,|\+/):null;D=(A.Lang.isString(B)?B:A.stamp(B))+K;D=D.replace(/,/g,"_");if(!A.getEvent(D)){A.on(E+J,function(P){var Q=false,M=false,N,L,O;for(N=0;N<H.length;N=N+1){L=H[N];O=parseInt(L,10);if(A.Lang.isNumber(O)){if(P.charCode===O){Q=true;}else{M=true;}}else{if(Q||!M){Q=(P[L+"Key"]);M=!Q;}}}if(Q){A.fire(D,P);}},B);}I.splice(2,2);I[0]=D;return A.on.apply(A,I);}};},"@VERSION@",{requires:["event-base"]});YUI.add("event-focus",function(A){(function(){var D=A.Env.evt.plugins,E={capture:true},C=function(){},B=function(G,I){var F=(A.Lang.isString(I))?A.Selector.query(I,null,true):I,H=F&&F.parentNode;if(H){A.Event._attach([G,C,H],E);}};A.Event._attachFocus=function(H,G){var F=A.Array(H,0,true);if(A.UA.ie){F[0]=F[0].replace(/focus/,"focusin");}else{if(A.UA.opera){B(F[0],F[2]);}}return A.Event._attach(F,G);};A.Event._attachBlur=function(H,G){var F=A.Array(H,0,true);if(A.UA.ie){F[0]=F[0].replace(/blur/,"focusout");}else{if(A.UA.opera){B(F[0],F[2]);}}return A.Event._attach(F,G);};D.focus={on:function(){return A.Event._attachFocus(arguments,E);}};D.blur={on:function(){return A.Event._attachBlur(arguments,E);}};})();},"@VERSION@",{requires:["event-base"]});YUI.add("event-resize",function(A){(function(){var C,B,E="window:resize",D=function(F){if(A.UA.gecko){A.fire(E,F);}else{if(B){B.cancel();}B=A.later(A.config.windowResizeDelay||40,A,function(){A.fire(E,F);
});}};A.Env.evt.plugins.windowresize={on:function(H,G){if(!C){C=A.Event._attach(["resize",D]);}var F=A.Array(arguments,0,true);F[0]=E;return A.on.apply(A,F);}};})();},"@VERSION@",{requires:["event-base"]});YUI.add("event",function(A){},"@VERSION@",{use:["event-base","event-delegate","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize"]});