event-min.js revision 3a1493afa5d204a301f770bf1e95318cf9a7bff8
(function(){var E=YUI.Env,G=YUI.config,F=G.doc,B=G.pollInterval||20,A=function(C){E._ready();};if(!E._ready){E.windowLoaded=false;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(A){(function(){var C=YUI.Env,B=function(){A.fire("domready");};A.mix(A.Env.eventAdaptors,{domready:{},"event:ready":{on:function(){var D=A.Array(arguments,0,true);D[0]="domready";return A.subscribe.apply(A,D);},detach:function(){var D=A.Array(arguments,0,true);D[0]="domready";return A.unsubscribe.apply(A,D);}}});A.publish("domready",{fireOnce:true});if(C.DOMReady){B();}else{A.before(B,C,"_ready");}})();(function(){var H=function(M,L,K,J){if(M.addEventListener){M.addEventListener(L,K,!!J);}else{if(M.attachEvent){M.attachEvent("on"+L,K);}}},B=function(M,L,K,J){if(M.removeEventListener){M.removeEventListener(L,K,!!J);}else{if(M.detachEvent){M.detachEvent("on"+L,K);}}},E=function(){YUI.Env.windowLoaded=true;A.Event._load();B(window,"load",E);},D=function(){A.Event._unload();B(window,"unload",D);},I="domready",G="~yui|2|compat~",F="capture_",C=function(){var L=false,M=0,K=[],N={},J=null,O={};return{POLL_RETRYS:2000,POLL_INTERVAL:20,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var P=A.Event;if(!P._interval){P._interval=setInterval(A.bind(P._tryPreloadAttach,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._tryPreloadAttach,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(V,W,Q,T){var U=A.Array(arguments,0,true),Z=U.slice(1),a,e=A.Event,c=false,b,S,d,R,Y,X,P;if(V.indexOf(F)>-1){V=V.substr(F.length);c=true;}if(Z[Z.length-1]===G){a=true;Z.pop();}if(!W||!W.call){return false;}if(this._isValidCollection(Q)){b=[];A.each(Q,function(g,f){U[2]=g;b.push(e.attach.apply(e,U));});return(b.length===1)?b[0]:b;}else{if(A.Lang.isString(Q)){S=(a)?A.DOM.byId(Q):A.all(Q);if(S&&(S instanceof A.Node)){d=S.size();if(d>1){U[2]=S;return e.attach.apply(e,U);}else{Q=S.item(0);}}else{if(S){Q=S;}else{return this.onAvailable(Q,function(){e.attach.apply(e,U);},e,true,false,a);}}}}if(!Q){return false;}R=A.stamp(Q);Y="event:"+R+V;X=N[Y];if(!X){X=A.publish(Y,{silent:true,bubbles:false});X.el=Q;X.type=V;X.fn=function(f){X.fire(e.getEvent(f,Q,a));};if(Q==A.config.win&&V=="load"){X.fireOnce=true;J=Y;if(YUI.Env.windowLoaded){X.fire();}}N[Y]=X;O[R]=O[R]||{};O[R][Y]=X;H(Q,V,X.fn,c);}P=Z[2]||((a)?Q:A.get(Q));Z[1]=P;Z.splice(2,1);return X.subscribe.apply(X,Z);},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.all(R);}else{if(this._isValidCollection(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(!Y||!Y.call){return this.purgeElement(R,false,W);}P="event:"+A.stamp(R)+W;Q=N[P];if(Q){return Q.unsubscribe(Y);}else{return false;}},getEvent:function(S,Q,P){var R=S||window.event;return(P)?R:new A.Event.Facade(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: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;}},_load:function(P){if(!L){L=true;if(A.fire){A.fire(I);}A.Event._tryPreloadAttach();}},_tryPreloadAttach: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.get(S.id);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.get(S.id);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.get(U):U,Q=this.getListeners(R,T),S,P;if(Q){for(S=0,P=Q.length;S<P;++S){Q[S].unsubscribeAll();}}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:"+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.unsubscribeAll();B(S.el,S.type,S.fn);delete N[R];});B(window,"load",P._load);B(window,"unload",P._unload);},nativeAdd:H,nativeRemove:B};}();H(window,"load",E);H(window,"unload",D);A.Event=C;if(A.UA.ie&&A.on){A.on(I,C._tryPreloadAttach,C,true);}C.Custom=A.CustomEvent;C.Subscriber=A.Subscriber;C.Target=A.EventTarget;C.Handle=A.EventHandle;C.Facade=A.EventFacade;C._tryPreloadAttach();})();A.Env.eventAdaptors.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.eventAdaptors.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);}};(function(){var C=A.UA.ie?"focusin":"focus",D=A.UA.ie?"focusout":"blur",E="capture_",B=A.Env.eventAdaptors;
B.focus={on:function(){var F=A.Array(arguments,0,true);F[0]=E+C;return A.Event.attach.apply(A.Event,F);},detach:function(){var F=A.Array(arguments,0,true);F[0]=E+C;return A.Event.detach.apply(A.Event,F);}};B.blur={on:function(){var F=A.Array(arguments,0,true);F[0]=E+D;return A.Event.attach.apply(A.Event,F);},detach:function(){var F=A.Array(arguments,0,true);F[0]=E+D;return A.Event.detach.apply(A.Event,F);}};})();A.Env.eventAdaptors.key={on:function(E,G,B,K,C){var I=A.Array(arguments,0,true),F,J,H,D;if(!K||K.indexOf(":")==-1){I[0]="keypress";return A.on.apply(A,I);}F=K.split(":");J=F[0];H=(F[1])?F[1].split(/,|\+/):null;D=(A.Lang.isString(B)?B:A.stamp(B))+K;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);}};A.Env.eventAdaptors.delegate={on:function(G,F,E,H,C,I){var D="delegate:"+(A.Lang.isString(E)?E:A.stamp(E))+H+C,B=A.Array(arguments,0,true);A.on(H,function(L){var J=L.currentTarget.queryAll(C),K=L.target,M=false;if(J){J.each(function(O,N){if((!M)&&(O==K)){A.fire(D,L);M=true;}});}},E);B[0]=D;B.splice(2,3);return A.on.apply(A,B);}};},"@VERSION@");