/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/event/event-min.js

  • Committer: Martin Albisetti
  • Date: 2008-10-22 11:05:23 UTC
  • mfrom: (230 trunk)
  • mto: This revision was merged to the branch mainline in revision 233.
  • Revision ID: martin.albisetti@canonical.com-20081022110523-sb3mjicez8ktsc3x
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
 
3
Code licensed under the BSD License:
 
4
http://developer.yahoo.net/yui/license.txt
 
5
version: 3.0.0pr1
 
6
*/
 
7
YUI.add("event",function(A){A.on=function(C,D,E){if(C.indexOf(":")>-1){var B=C.split(":");switch(B[0]){default:return A.subscribe.apply(A,arguments);}}else{return A.Event.attach.apply(A.Event,arguments);}};A.detach=function(C,D,E){if(A.Lang.isObject(C)&&C.detach){return C.detach();}else{if(C.indexOf(":")>-1){var B=C.split(":");switch(B[0]){default:return A.unsubscribe.apply(A,arguments);}}else{return A.Event.detach.apply(A.Event,arguments);}}};A.before=function(B,C,D){if(A.Lang.isFunction(B)){return A.Do.before.apply(A.Do,arguments);}return A;};A.after=function(B,C,D){if(A.Lang.isFunction(B)){return A.Do.after.apply(A.Do,arguments);}return A;};},"3.0.0",{use:["aop","event-custom","event-target","event-ready","event-dom","event-facade"]});YUI.add("aop",function(C){var A=0,B=1;C.Do={objs:{},before:function(E,G,H,I){var F=E;if(I){var D=[E,I].concat(C.Array(arguments,4,true));F=C.bind.apply(C,D);}return this._inject(A,F,G,H);},after:function(E,G,H,I){var F=E;if(I){var D=[E,I].concat(C.Array(arguments,4,true));F=C.bind.apply(C,D);}return this._inject(B,F,G,H);},_inject:function(D,F,G,I){var J=C.stamp(G);if(!this.objs[J]){this.objs[J]={};}var H=this.objs[J];if(!H[I]){H[I]=new C.Do.Method(G,I);G[I]=function(){return H[I].exec.apply(H[I],arguments);};}var E=J+C.stamp(F)+I;H[I].register(E,F,D);return E;},detach:function(D){delete this.before[D];delete this.after[D];},_unload:function(E,D){}};C.Do.Method=function(D,E){this.obj=D;this.methodName=E;this.method=D[E];this.before={};this.after={};};C.Do.Method.prototype.register=function(E,F,D){if(D){this.after[E]=F;}else{this.before[E]=F;}};C.Do.Method.prototype.exec=function(){var F=C.Array(arguments,0,true),G,E,I,H=this.before,D=this.after;for(G in H){if(H.hasOwnProperty(G)){E=H[G].apply(this.obj,F);if(E&&E.constructor==C.Do.Error){return E.retVal;}else{if(E&&E.constructor==C.Do.AlterArgs){F=E.newArgs;}}}}E=this.method.apply(this.obj,F);for(G in D){if(D.hasOwnProperty(G)){I=D[G].apply(this.obj,F);if(I&&I.constructor==C.Do.Error){return I.retVal;}else{if(I&&I.constructor==C.Do.AlterReturn){E=I.newRetVal;}}}}return E;};C.Do.Error=function(E,D){this.msg=E;this.retVal=D;};C.Do.AlterArgs=function(E,D){this.msg=E;this.newArgs=D;};C.Do.AlterReturn=function(E,D){this.msg=E;this.newRetVal=D;};},"3.0.0");YUI.add("event-custom",function(D){var B="_event:onsub",C="after",A=["broadcast","bubbles","context","configured","currentTarget","defaultFn","details","emitFacade","fireOnce","host","preventable","preventedFn","queuable","silent","stoppedFn","target","type"];D.EventHandle=function(E,F){this.evt=E;this.sub=F;};D.EventHandle.prototype={detach:function(){this.evt._delete(this.sub);}};D.CustomEvent=function(E,F){F=F||{};this.id=D.stamp(this);this.type=E;this.context=D;this.broadcast=0;this.queuable=false;this.subscribers={};this.afters={};this.fired=false;this.fireOnce=false;this.stopped=0;this.prevented=0;this.host=null;this.defaultFn=null;this.stoppedFn=null;this.preventedFn=null;this.preventable=true;this.bubbles=true;this.emitFacade=false;this.applyConfig(F,true);if(E!==B){this.subscribeEvent=new D.CustomEvent(B,{context:this,silent:true});}};D.CustomEvent.prototype={_YUI_EVENT:true,applyConfig:function(F,E){if(F){D.mix(this,F,E,A);}},_subscribe:function(H,J,F,E){if(!H){D.fail("Invalid callback for CE: "+this.type);}var I=this.subscribeEvent;if(I){I.fire.apply(I,F);}var G=new D.Subscriber(H,J,F,E);if(this.fireOnce&&this.fired){D.later(0,this,this._notify,G);}if(E==C){this.afters[G.id]=G;}else{this.subscribers[G.id]=G;}return new D.EventHandle(this,G);},subscribe:function(E,F){return this._subscribe(E,F,D.Array(arguments,2,true));},after:function(E,F){return this._subscribe(E,F,D.Array(arguments,2,true),C);},unsubscribe:function(H,J){if(H&&H.detach){return H.detach();}if(!H){return this.unsubscribeAll();}var I=false,F=this.subscribers;for(var E in F){if(F.hasOwnProperty(E)){var G=F[E];if(G&&G.contains(H,J)){this._delete(G);I=true;}}}return I;},_getFacade:function(F){var E=this._facade;if(!E){E=new D.Event.Facade(this,this.currentTarget);}var G=F&&F[0];if(D.Lang.isObject(G,true)&&!G._yuifacade){D.mix(E,G,true);}E.details=this.details;E.target=this.target;E.currentTarget=this.currentTarget;E.stopped=0;E.prevented=0;this._facade=E;return this._facade;},_notify:function(H,G,E){var F;if(this.emitFacade){if(!E){E=this._getFacade(G);G[0]=E;}}F=H.notify(this.context,G);if(false===F||this.stopped>1){return false;}return true;},log:function(H,E){var G=D.Env._eventstack,F=G&&G.silent;if(!this.silent){}},fire:function(){var N=D.Env._eventstack;if(N){if(this.queuable&&this.type!=N.next.type){N.queue.push([this,arguments]);return true;}}else{D.Env._eventstack={id:this.id,next:this,silent:this.silent,logging:(this.type==="yui:log"),stopped:0,prevented:0,queue:[]};N=D.Env._eventstack;}var L=true;if(this.fireOnce&&this.fired){}else{var G=D.merge(this.subscribers),O,M=D.Array(arguments,0,true),H;this.stopped=0;this.prevented=0;this.target=this.target||this.host;this.currentTarget=this.host||this.currentTarget;this.fired=true;this.details=M.slice();var K=false;N.lastLogState=N.logging;var I=null;if(this.emitFacade){I=this._getFacade(M);M[0]=I;}for(H in G){if(G.hasOwnProperty(H)){if(!K){N.logging=(N.logging||(this.type==="yui:log"));K=true;}if(this.stopped==2){break;}O=G[H];if(O&&O.fn){L=this._notify(O,M,I);if(false===L){this.stopped=2;}}}}N.logging=(N.lastLogState);if(this.bubbles&&this.host&&!this.stopped){N.stopped=0;N.prevented=0;L=this.host.bubble(this);this.stopped=Math.max(this.stopped,N.stopped);this.prevented=Math.max(this.prevented,N.prevented);}if(this.defaultFn&&!this.prevented){this.defaultFn.apply(this.host||this,M);}if(!this.prevented&&this.stopped<2){G=D.merge(this.afters);for(H in G){if(G.hasOwnProperty(H)){if(!K){N.logging=(N.logging||(this.type==="yui:log"));K=true;}if(this.stopped==2){break;}O=G[H];if(O&&O.fn){L=this._notify(O,M,I);if(false===L){this.stopped=2;}}}}}}if(N.id===this.id){var J=N.queue;while(J.length){var E=J.pop(),F=E[0];N.stopped=0;N.prevented=0;
 
8
N.next=F;L=F.fire.apply(F,E[1]);}D.Env._eventstack=null;}return(L!==false);},unsubscribeAll:function(){var F=this.subscribers,E;for(E in F){if(F.hasOwnProperty(E)){this._delete(F[E]);}}this.subscribers={};return E;},_delete:function(E){if(E){delete E.fn;delete E.obj;delete this.subscribers[E.id];delete this.afters[E.id];}},toString:function(){return this.type;},stopPropagation:function(){this.stopped=1;D.Env._eventstack.stopped=1;if(this.stoppedFn){this.stoppedFn.call(this.host||this,this);}},stopImmediatePropagation:function(){this.stopped=2;D.Env._eventstack.stopped=2;if(this.stoppedFn){this.stoppedFn.call(this.host||this,this);}},preventDefault:function(){if(this.preventable){this.prevented=1;D.Env._eventstack.prevented=1;}if(this.preventedFn){this.preventedFn.call(this.host||this,this);}}};D.Subscriber=function(H,I,G){this.fn=H;this.obj=I;this.id=D.stamp(this);var E=H;if(I){var F=(G)?D.Array(G):[];F.unshift(H,I);E=D.bind.apply(D,F);}this.wrappedFn=E;};D.Subscriber.prototype={notify:function(E,G){var I=this.obj||E,F=true;try{F=this.wrappedFn.apply(I,G);}catch(H){D.fail(this+" failed: "+H.message,H);}return F;},contains:function(E,F){if(F){return((this.fn==E)&&this.obj==F);}else{return(this.fn==E);}},toString:function(){return"Subscriber "+this.id;}};},"3.0.0");YUI.add("event-target",function(C){var A={"yui:log":true};C.EventTarget=function(D){var E=(C.Lang.isObject(D))?D:{};this._yuievt={events:{},targets:{},config:E,defaults:{context:this,host:this,emitFacade:E.emitFacade||false,bubbles:("bubbles" in E)?E.bubbles:true}};};var B=C.EventTarget;B.prototype={subscribe:function(G,F,E){var H=this._yuievt.events[G]||this.publish(G),D=C.Array(arguments,1,true);return H.subscribe.apply(H,D);},unsubscribe:function(I,H,G){if(C.Lang.isObject(I)&&I.detach){return I.detach();}var D=this._yuievt.events;if(I){var J=D[I];if(J){return J.unsubscribe(H,G);}}else{var E=true;for(var F in D){if(C.Object.owns(D,F)){E=E&&D[F].unsubscribe(H,G);}}return E;}return false;},unsubscribeAll:function(D){return this.unsubscribe(D);},publish:function(E,F){var D=this._yuievt.events,G=D[E];if(G){G.applyConfig(F,true);}else{var H=F||{};C.mix(H,this._yuievt.defaults);G=new C.CustomEvent(E,H);D[E]=G;if(H.onSubscribeCallback){G.subscribeEvent.subscribe(H.onSubscribeCallback);}}return D[E];},addTarget:function(D){this._yuievt.targets[C.stamp(D)]=D;this._yuievt.hasTargets=true;},removeTarget:function(D){delete this._yuievt.targets[C.stamp(D)];},fire:function(G){var I=C.Lang.isString(G),F=(I)?G:(G&&G.type);var H=this.getEvent(F);if(!H){if(this._yuievt.hasTargets){H=this.publish(F);H.details=C.Array(arguments,(I)?1:0,true);return this.bubble(H);}return true;}var D=C.Array(arguments,(I)?1:0,true);var E=H.fire.apply(H,D);H.target=null;return E;},getEvent:function(D){var E=this._yuievt.events;return(E&&D in E)?E[D]:null;},bubble:function(E){var J=this._yuievt.targets,F=true;if(!E.stopped&&J){for(var H in J){if(J.hasOwnProperty(H)){var G=J[H],I=E.type,K=G.getEvent(I),D=E.target||this;if(!K){K=G.publish(I,E);K.context=(E.host===E.context)?G:E.context;K.host=G;K.defaultFn=null;K.preventedFn=null;K.stoppedFn=null;}K.target=D;K.currentTarget=G;F=F&&K.fire.apply(K,E.details);if(K.stopped){break;}}}}return F;},after:function(F,E){var G=this._yuievt.events[F]||this.publish(F),D=C.Array(arguments,1,true);return G.after.apply(G,D);}};C.mix(C,B.prototype,false,false,{bubbles:false});B.call(C);},"3.0.0");(function(){var E=YUI.Env,G=YUI.config,F=G.doc,B=G.pollInterval||20;if(!E._ready){E.windowLoaded=false;E._ready=function(){if(!E.DOMReady){E.DOMReady=true;if(F.removeEventListener){F.removeEventListener("DOMContentLoaded",A,false);}}};var A=function(C){YUI.Env._ready();};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-ready",function(D){if(D===YUI){return ;}D.publish("event:ready",{fireOnce:true});var C=function(){D.fire("event:ready");};if(E.DOMReady){C();}else{D.before(C,E,"_ready");}},"3.0.0");})();(function(){var C=function(G,F,E,D){if(G.addEventListener){G.addEventListener(F,E,!!D);}else{if(G.attachEvent){G.attachEvent("on"+F,E);}}},A=function(G,F,E,D){if(G.removeEventListener){G.removeEventListener(F,E,!!D);}else{if(G.detachEvent){G.detachEvent("on"+F,E);}}},B=function(){YUI.Env.windowLoaded=true;A(window,"load",B);};C(window,"load",B);YUI.add("event-dom",function(F){F.Event=function(){var H=false;var I=0;var G=[];var J={};var E=null;var K={};return{POLL_RETRYS:2000,POLL_INTERVAL:20,lastError:null,_interval:null,_dri:null,DOMReady:false,startInterval:function(){if(!this._interval){this._interval=setInterval(F.bind(this._tryPreloadAttach,this),this.POLL_INTERVAL);}},onAvailable:function(R,N,Q,P,O){var L=F.Array(R);for(var M=0;M<L.length;M=M+1){G.push({id:L[M],fn:N,obj:Q,override:P,checkReady:O});}I=this.POLL_RETRYS;setTimeout(F.bind(this._tryPreloadAttach,this),0);},onContentReady:function(O,L,N,M){this.onAvailable(O,L,N,M,true);},onDOMReady:function(M){var L=F.Array(arguments,0,true);L.unshift("event:ready");F.on.apply(F,L);},addListener:function(M,P,Q,T){var c=F.Array(arguments,1,true),S=c[3],U=F.Event,d=F.Array(arguments,0,true);if(!Q||!Q.call){return false;}if(this._isValidCollection(M)){var L=[],Z,Y,X,R=function(g,f){var a=c.slice();a.unshift(g);Z=U.addListener.apply(U,a);L.push(Z);};F.each(M,R,U);return L;}else{if(F.Lang.isString(M)){var W=F.all(M);var V=W.size();if(V){if(V>1){d[0]=W;return U.addListener.apply(U,d);}else{M=W.item(0);}}else{this.onAvailable(M,function(){F.Event.addListener.apply(F.Event,d);});return true;}}}if(!M){return false;}var N=F.stamp(M),e="event:"+N+P,b=J[e];if(!b){b=F.publish(e,{silent:true,bubbles:false});b.el=M;b.type=P;b.fn=function(a){b.fire(F.Event.getEvent(a,M));};if(M==F.config.win&&P=="load"){b.fireOnce=true;E=e;if(YUI.Env.windowLoaded){b.fire();}}J[e]=b;K[N]=K[N]||{};K[N][e]=b;this.nativeAdd(M,P,b.fn,false);}c=F.Array(arguments,2,true);
 
9
var O=T||F.get(M);c[1]=O;return b.subscribe.apply(b,c);},removeListener:function(N,Q,R){if(N&&N.detach){return N.detach();}var O,P,T;if(typeof N=="string"){N=F.get(N);}else{if(this._isValidCollection(N)){var S=true;for(O=0,P=N.length;O<P;++O){S=(this.removeListener(N[O],Q,R)&&S);}return S;}}if(!R||!R.call){return this.purgeElement(N,false,Q);}var L="event:"+F.stamp(N)+Q,M=J[L];if(M){return M.unsubscribe(R);}else{return false;}},getEvent:function(N,L){var M=N||window.event;if(!M){var O=this.getEvent.caller;while(O){M=O.arguments[0];if(M&&Event==M.constructor){break;}O=O.caller;}}return new F.Event.Facade(M,L,J["event:"+F.stamp(L)+N.type]);},generateId:function(L){var M=L.id;if(!M){M=F.stamp(L);L.id=M;}return M;},_isValidCollection:function(M){try{return(M&&typeof M!=="string"&&(M.each||M.length)&&!M.tagName&&!M.alert&&(M.item||typeof M[0]!=="undefined"));}catch(L){return false;}},_load:function(L){if(!H){H=true;if(F.fire){F.fire("event:ready");}F.Event._tryPreloadAttach();}},_tryPreloadAttach:function(){if(this.locked){return ;}if(F.UA.ie&&!YUI.Env.DOMReady){this.startInterval();return ;}this.locked=true;var Q=!H;if(!Q){Q=(I>0);}var P=[];var R=function(T,U){var S;if(U.override){if(U.override===true){S=U.obj;}else{S=U.override;}}else{S=F.get(T);}U.fn.call(S,U.obj);};var M,L,O,N;for(M=0,L=G.length;M<L;++M){O=G[M];if(O&&!O.checkReady){N=F.get(O.id);if(N){R(N,O);G[M]=null;}else{P.push(O);}}}for(M=0,L=G.length;M<L;++M){O=G[M];if(O&&O.checkReady){N=F.get(O.id);if(N){if(H||N.get("nextSibling")){R(N,O);G[M]=null;}}else{P.push(O);}}}I=(P.length===0)?0:I-1;if(Q){this.startInterval();}else{clearInterval(this._interval);this._interval=null;}this.locked=false;return ;},purgeElement:function(Q,R,P){var N=(F.Lang.isString(Q))?F.get(Q):Q,S=F.stamp(N);var M=this.getListeners(N,P),O,L;if(M){for(O=0,L=M.length;O<L;++O){M[O].unsubscribeAll();}}if(R&&N&&N.childNodes){for(O=0,L=N.childNodes.length;O<L;++O){this.purgeElement(N.childNodes[O],R,P);}}},getListeners:function(Q,P){var O=[],R=F.stamp(Q),N=(P)?"event:"+P:null,L=K[R];if(N){if(L[N]){O.push(L[N]);}}else{for(var M in L){O.push(L[M]);}}return(O.length)?O:null;},_unload:function(O){var N=F.Event,M,L;for(M in J){L=J[M];L.unsubscribeAll();N.nativeRemove(L.el,L.type,L.fn);delete J[M];}N.nativeRemove(window,"unload",N._unload);},nativeAdd:C,nativeRemove:A};}();var D=F.Event;if(F.UA.ie&&F.on){F.on("event:ready",D._tryPreloadAttach,D,true);}D.Custom=F.CustomEvent;D.Subscriber=F.Subscriber;D.Target=F.EventTarget;D.attach=function(K,J,I,L,H){var E=F.Array(arguments,0,true),G=E.splice(2,1);E.unshift(G[0]);return D.addListener.apply(D,E);};D.detach=function(I,H,G,J,E){return D.removeListener(G,I,H,J,E);};D.attach("load",D._load,window,D);D.nativeAdd(window,"unload",D._unload);D._tryPreloadAttach();},"3.0.0");})();YUI.add("event-facade",function(E){var C={"altKey":1,"cancelBubble":1,"ctrlKey":1,"clientX":1,"clientY":1,"detail":1,"keyCode":1,"metaKey":1,"shiftKey":1,"type":1,"x":1,"y":1};var B=E.UA,A={63232:38,63233:40,63234:37,63235:39,63276:33,63277:34,25:9},D=function(G){if(!G){return null;}try{if(B.webkit&&3==G.nodeType){G=G.parentNode;}}catch(F){}return E.Node.get(G);};E.Event.Facade=function(P,H,G,F){var L=P,J=H,M=E.config.doc,Q=M.body,R=L.pageX,O=L.pageY,I=(P._YUI_EVENT);for(var K in C){if(C.hasOwnProperty(K)){this[K]=L[K];}}if(!R&&0!==R){R=L.clientX||0;O=L.clientY||0;if(B.ie){R+=Math.max(M.documentElement.scrollLeft,Q.scrollLeft);O+=Math.max(M.documentElement.scrollTop,Q.scrollTop);}}this._yuifacade=true;this.pageX=R;this.pageY=O;var N=L.keyCode||L.charCode||0;if(B.webkit&&(N in A)){N=A[N];}this.keyCode=N;this.charCode=N;this.button=L.which||L.button;this.which=this.button;this.details=F;this.time=L.time||new Date().getTime();this.target=(I)?L.target:D(L.target||L.srcElement);this.currentTarget=(I)?J:D(J);var S=L.relatedTarget;if(!S){if(L.type=="mouseout"){S=L.toElement;}else{if(L.type=="mouseover"){S=L.fromElement;}}}this.relatedTarget=(I)?S:D(S);this.stopPropagation=function(){if(L.stopPropagation){L.stopPropagation();}else{L.cancelBubble=true;}if(G){G.stopPropagation();}};this.stopImmediatePropagation=function(){if(L.stopImmediatePropagation){L.stopImmediatePropagation();}else{this.stopPropagation();}if(G){G.stopImmediatePropagation();}};this.preventDefault=function(){if(L.preventDefault){L.preventDefault();}else{L.returnValue=false;}if(G){G.preventDefault();}};this.halt=function(T){if(T){this.stopImmediatePropagation();}else{this.stopPropagation();}this.preventDefault();};};},"3.0.0");
 
 
b'\\ No newline at end of file'