event-min.js revision 5dca01b3e9223702077784d350880971273b2a49
6574N/A(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(Q,K,J){var M=Q,L=K,N=F.config.doc,R=N.body,S=M.pageX,P=M.pageY,O,T;this.altKey=M.altKey;this.ctrlKey=M.ctrlKey;this.metaKey=M.metaKey;this.shiftKey=M.shiftKey;this.type=M.type;if(!S&&0!==S){S=M.clientX||0;P=M.clientY||0;if(H.ie){S+=Math.max(N.documentElement.scrollLeft,R.scrollLeft);P+=Math.max(N.documentElement.scrollTop,R.scrollTop);}}this._yuifacade=true;this.pageX=S;this.pageY=P;O=M.keyCode||M.charCode||0;if(H.webkit&&(O in G)){O=G[O];}this.keyCode=O;this.charCode=O;this.button=M.which||M.button;this.which=this.button;this.target=I(M.target||M.srcElement);this.currentTarget=I(L);T=M.relatedTarget;if(!T){if(M.type=="mouseout"){T=M.toElement;}else{if(M.type=="mouseover"){T=M.fromElement;}}}this.relatedTarget=I(T);this.stopPropagation=function(){if(M.stopPropagation){M.stopPropagation();}else{M.cancelBubble=true;}J.stopPropagation();};this.stopImmediatePropagation=function(){if(M.stopImmediatePropagation){M.stopImmediatePropagation();}else{this.stopPropagation();}J.stopImmediatePropagation();};this.preventDefault=function(){if(M.preventDefault){M.preventDefault();}else{M.returnValue=false;}J.preventDefault();};this.halt=function(U){if(U){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};})();(function(){var M=YUI.Env.add,G=YUI.Env.remove,K=function(){YUI.Env.windowLoaded=true;F.Event._load();G(window,"load",K);},J=function(){F.Event._unload();G(window,"unload",J);},N="domready",L="~yui|2|compat~",I=function(P){try{return(P&&typeof P!=="string"&&(P.length&&((!P.size)||(P.size()>1)))&&!P.tagName&&!P.alert&&(P.item||typeof P[0]!=="undefined"));}catch(O){return false;}},H=function(){var Q=false,R=0,P=[],S={},O=null,T={};return{POLL_RETRYS:1000,POLL_INTERVAL:40,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){var U=F.Event;if(!U._interval){U._interval=setInterval(F.bind(U._poll,U),U.POLL_INTERVAL);}},onAvailable:function(c,X,b,Z,Y,V){var U=F.Array(c),W;for(W=0;W<U.length;W=W+1){P.push({id:U[W],fn:X,obj:b,override:Z,checkReady:Y,compat:V});}R=this.POLL_RETRYS;setTimeout(F.bind(F.Event._poll,F.Event),0);return new F.EventHandle();},onContentReady:function(Y,V,X,W,U){return this.onAvailable(Y,V,X,W,true,U);},attach:function(W,V,U,X){return F.Event._attach(F.Array(arguments,0,true));},_attach:function(Z,j){var Y=Z.slice(1),c,e=F.Event,U,f,X,l,i,a,V=false,k,b=Z[0],d=Z[1],W=Z[2]||F.config.win,g=j&&j.facade,h=j&&j.capture;if(Y[Y.length-1]===L){c=true;Y.pop();}if(!d||!d.call){return false;}if(I(W)){U=[];F.each(W,function(n,m){Z[2]=n;U.push(e._attach(Z,j));});return(U.length===1)?U[0]:U;}else{if(F.Lang.isString(W)){f=(c)?F.DOM.byId(W):F.Selector.query(W);if(f){if(F.Lang.isArray(f)){if(f.length==1){W=f[0];}else{Z[2]=f;return e._attach(Z,j);}}else{W=f;}}else{return this.onAvailable(W,function(){e._attach(Z,j);},e,true,false,c);}}}if(!W){return false;}if(F.Node&&W instanceof F.Node){return W.on.apply(W,Z);}X=F.stamp(W);l="event:"+X+b;if(false===g){l+="native";}if(h){l+="capture";}i=S[l];if(!i){i=F.publish(l,{bubbles:false});i.el=W;i.type=b;i.fn=function(m){console.log(j);i.fire(e.getEvent(m,W,(c||(false===g))));};if(W==F.config.win&&b=="load"){i.fireOnce=true;O=l;if(YUI.Env.windowLoaded){V=true;}}S[l]=i;T[X]=T[X]||{};T[X][l]=i;M(W,b,i.fn,h);}a=Y[2]||((c)?W:F.get(W));Y[1]=a;Y.splice(2,1);k=i.subscribe.apply(i,Y);if(V){i.fire();}return k;},detach:function(b,d,W,X){var a=F.Array(arguments,0,true),e,Y,Z,c,U,V;if(a[a.length-1]===L){e=true;}if(b&&b.detach){return b.detach();}if(typeof W=="string"){W=(e)?F.DOM.byId(W):F.Selector.query(W);return F.Event.detach.apply(F.Event,a);}else{if(I(W)){c=true;for(Y=0,Z=W.length;Y<Z;++Y){a[2]=W[Y];c=(F.Event.detach.apply(F.Event,a)&&c);}return c;}}if(!b||!d||!d.call){return this.purgeElement(W,false,b);}U="event:"+F.stamp(W)+b;V=S[U];if(V){return V.detach(d);}else{return false;}},getEvent:function(X,V,U){var W=X||window.event;return(U)?W:new F.DOMEventFacade(W,V,S["event:"+F.stamp(V)+X.type]);},generateId:function(U){var V=U.id;if(!V){V=F.stamp(U);U.id=V;}return V;},_isValidCollection:I,_load:function(U){if(!Q){Q=true;if(F.fire){F.fire(N);}F.Event._poll();}},_poll:function(){if(this.locked){return;}if(F.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return;}this.locked=true;var Z=!Q,Y,a,V,U,X,W;if(!Z){Z=(R>0);}Y=[];a=function(d,e){var c,b=e.override;if(e.compat){if(e.override){if(b===true){c=e.obj;}else{c=b;}}else{c=d;}e.fn.call(c,e.obj);}else{c=e.obj||F.get(d);e.fn.apply(c,(F.Lang.isArray(b))?b:[]);}};for(V=0,U=P.length;V<U;++V){X=P[V];if(X&&!X.checkReady){W=(X.compat)?F.DOM.byId(X.id):F.Selector.query(X.id,null,true);if(W){a(W,X);P[V]=null;}else{Y.push(X);}}}for(V=0,U=P.length;V<U;++V){X=P[V];if(X&&X.checkReady){W=(X.compat)?F.DOM.byId(X.id):F.Selector.query(X.id,null,true);if(W){if(Q||(W.get&&W.get("nextSibling"))||W.nextSibling){a(W,X);P[V]=null;}}else{Y.push(X);}}}R=(Y.length===0)?0:R-1;if(Z){this.startInterval();
6574N/A}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return;},purgeElement:function(Z,a,Y){var W=(F.Lang.isString(Z))?F.Selector.query(Z,null,true):Z,V=this.getListeners(W,Y),X,U;if(V){for(X=0,U=V.length;X<U;++X){V[X].detachAll();}}if(a&&W&&W.childNodes){for(X=0,U=W.childNodes.length;X<U;++X){this.purgeElement(W.childNodes[X],a,Y);}}},getListeners:function(Y,X){var Z=F.stamp(Y,true),U=T[Z],W=[],V=(X)?"event:"+Z+X:null;if(!U){return null;}if(V){if(U[V]){W.push(U[V]);}}else{F.each(U,function(b,a){W.push(b);});}return(W.length)?W:null;},_unload:function(V){var U=F.Event;F.each(S,function(X,W){X.detachAll();G(X.el,X.type,X.fn);delete S[W];});G(window,"load",U._load);G(window,"unload",U._unload);},nativeAdd:M,nativeRemove:G};}();F.Event=H;if(F.config.injected||YUI.Env.windowLoaded){K();}else{M(window,"load",K);}if(F.UA.ie){F.on(N,H._poll,H,true);}M(window,"unload",J);H.Custom=F.CustomEvent;H.Subscriber=F.Subscriber;H.Target=F.EventTarget;H.Handle=F.EventHandle;H.Facade=F.EventFacade;H._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 I=F.Env.evt.plugins,J={capture:true},H=function(){},G=function(L,N){var K=(F.Lang.isString(N))?F.Selector.query(N,null,true):N,M=K&&K.parentNode;if(M){F.Event._attach([L,H,M],J);}};I.focus={on:function(M,L,N){var K=F.Array(arguments,0,true);if(F.UA.opera){G(M,N);}return F.Event._attach(K,J);}};I.blur={on:function(M,L,N){var K=F.Array(arguments,0,true);if(F.UA.opera){G(M,N);}return F.Event._attach(K,J);}};})();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"]});