~bjornt/lazr-js/prefetch-yui-3.5

« back to all changes in this revision

Viewing changes to src-js/lazrjs/yui/transition/transition-native-min.js

  • Committer: Launchpad Patch Queue Manager
  • Date: 2011-01-14 23:32:29 UTC
  • mfrom: (197.1.7 yui-3.3.0)
  • Revision ID: launchpad@pqm.canonical.com-20110114233229-r6i4cazdiiw18o7p
Upgrade to YUI 3.3.0 [r=mars]

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3
3
Code licensed under the BSD License:
4
4
http://developer.yahoo.com/yui/license.html
5
 
version: 3.2.0
6
 
build: 2676
 
5
version: 3.3.0
 
6
build: 3167
7
7
*/
8
 
YUI.add("transition-native",function(B){var I="-webkit-transition",G="WebkitTransition",C="-webkit-transition-property",F="-webkit-transition-duration",A="-webkit-transition-timing-function",D="-webkit-transition-delay",J="webkitTransitionEnd",K="WebkitTransform",H={},E=function(){this.init.apply(this,arguments);};E._toCamel=function(L){L=L.replace(/-([a-z])/gi,function(N,M){return M.toUpperCase();});return L;};E._toHyphen=function(L){L=L.replace(/([A-Z]?)([a-z]+)([A-Z]?)/g,function(P,O,N,M){var Q="";if(O){Q+="-"+O.toLowerCase();}Q+=N;if(M){Q+="-"+M.toLowerCase();}return Q;});return L;};E._reKeywords=/^(?:node|duration|iterations|easing|delay)$/;E.useNative=false;if(I in B.config.doc.documentElement.style){E.useNative=true;E.supported=true;}B.Node.DOM_EVENTS[J]=1;E.NAME="transition";E.DEFAULT_EASING="ease";E.DEFAULT_DURATION=0.5;E.DEFAULT_DELAY=0;E._nodeAttrs={};E.prototype={constructor:E,init:function(M,L){var N=this;if(!N._running){N._node=M;N._config=L;M._transition=N;N._duration=("duration" in L)?L.duration:N.constructor.DEFAULT_DURATION;N._delay=("delay" in L)?L.delay:N.constructor.DEFAULT_DELAY;N._easing=L.easing||N.constructor.DEFAULT_EASING;N._count=0;N._running=false;N.initAttrs(L);}return N;},addProperty:function(S,N){var Q=this,P=this._node,O=B.stamp(P),M=E._nodeAttrs[O],L,R;if(!M){M=E._nodeAttrs[O]={};}L=M[S];if(N&&N.value!==undefined){R=N.value;}else{if(N!==undefined){R=N;N=H;}}if(typeof R==="function"){R=R.call(P,P);}if(L&&L.transition&&L.transition!==Q){L.transition._count--;}Q._count++;M[S]={value:R,duration:((typeof N.duration!=="undefined")?N.duration:Q._duration)||0.0001,delay:(typeof N.delay!=="undefined")?N.delay:Q._delay,easing:N.easing||Q._easing,transition:Q};},removeProperty:function(N){var M=this,L=E._nodeAttrs[B.stamp(M._node)];if(L&&L[N]){delete L[N];M._count--;}},initAttrs:function(M){var L;if(M.transform&&!M[K]){M[K]=M.transform;delete M.transform;}for(L in M){if(M.hasOwnProperty(L)&&!E._reKeywords.test(L)){this.addProperty(L,M[L]);}}},run:function(M){var L=this;if(!L._running){L._running=true;L._node.fire("transition:start",{type:"transition:start",config:L._config});L._start();L._callback=M;}return L;},_start:function(){this._runNative();},_prepDur:function(L){L=parseFloat(L);return L+"s";},_runNative:function(O){var T=this,P=T._node,W=B.stamp(P),U=P._node,M=U.style,R=getComputedStyle(U),a=E._nodeAttrs[W],N="",b=R[C],Z=C+": ",S=F+": ",Y=A+": ",V=D+": ",Q,X,L;if(b!=="all"){Z+=b+",";S+=R[F]+",";Y+=R[A]+",";V+=R[D]+",";}for(L in a){Q=E._toHyphen(L);X=a[L];if(a.hasOwnProperty(L)&&X.transition===T){if(L in U.style){S+=T._prepDur(X.duration)+",";V+=T._prepDur(X.delay)+",";Y+=(X.easing)+",";Z+=Q+",";N+=Q+": "+X.value+"; ";}else{this.removeProperty(L);}}}Z=Z.replace(/,$/,";");S=S.replace(/,$/,";");Y=Y.replace(/,$/,";");V=V.replace(/,$/,";");if(!P._hasTransitionEnd){T._detach=P.on(J,T._onNativeEnd);P._hasTransitionEnd=true;}M.cssText+=Z+S+Y+V+N;},_end:function(L){var O=this,M=O._node,P=O._callback,N={type:"transition:end",config:O._config,elapsedTime:L};O._running=false;if(P){O._callback=null;setTimeout(function(){P.call(M,N);},1);}M.fire("transition:end",N);},_endNative:function(L){var M=this._node,N=M.getComputedStyle(C);if(typeof N==="string"){N=N.replace(new RegExp("(?:^|,\\s)"+L+",?"),",");N=N.replace(/^,|,$/,"");M.setStyle(G,N);}},_onNativeEnd:function(Q){var N=this,P=B.stamp(N),L=Q._event,M=E._toCamel(L.propertyName),T=L.elapsedTime,S=E._nodeAttrs[P],R=S[M],O=(R)?R.transition:null;if(O){O.removeProperty(M);O._endNative(M);N.fire("transition:propertyEnd",{type:"propertyEnd",propertyName:M,elapsedTime:T});if(O._count<=0){O._end(T);}}},destroy:function(){var L=this;if(L._detach){L._detach.detach();}L._node=null;}};B.Transition=E;B.TransitionNative=E;B.Node.prototype.transition=function(L,N){var M=this._transition;if(M&&!M._running){M.init(this,L);}else{M=new E(this,L);}M.run(N);return this;};B.NodeList.prototype.transition=function(L,M){this.each(function(N){N.transition(L,M);});return this;};},"3.2.0",{requires:["node-base"]});
 
 
b'\\ No newline at end of file'
 
8
YUI.add("transition-native",function(b){var j="-webkit-transition",m="WebkitTransition",h="WebkitTransitionProperty",c="-webkit-transition-property",g="-webkit-transition-duration",a="-webkit-transition-timing-function",d="-webkit-transition-delay",k="webkitTransitionEnd",e="onwebkittransitionend",l="WebkitTransform",i={},f=function(){this.init.apply(this,arguments);};f.fx={};f.toggles={};f._hasEnd={};f._toCamel=function(o){o=o.replace(/-([a-z])/gi,function(q,p){return p.toUpperCase();});return o;};f._toHyphen=function(o){o=o.replace(/([A-Z]?)([a-z]+)([A-Z]?)/g,function(s,r,q,p){var t="";if(r){t+="-"+r.toLowerCase();}t+=q;if(p){t+="-"+p.toLowerCase();}return t;});return o;};f._reKeywords=/^(?:node|duration|iterations|easing|delay|on|onstart|onend)$/i;f.useNative=false;if(j in b.config.doc.documentElement.style){f.useNative=true;f.supported=true;}b.Node.DOM_EVENTS[k]=1;f.NAME="transition";f.DEFAULT_EASING="ease";f.DEFAULT_DURATION=0.5;f.DEFAULT_DELAY=0;f._nodeAttrs={};f.prototype={constructor:f,init:function(p,o){var q=this;q._node=p;if(!q._running&&o){q._config=o;p._transition=q;q._duration=("duration" in o)?o.duration:q.constructor.DEFAULT_DURATION;q._delay=("delay" in o)?o.delay:q.constructor.DEFAULT_DELAY;q._easing=o.easing||q.constructor.DEFAULT_EASING;q._count=0;q._running=false;}return q;},addProperty:function(p,r){var u=this,s=this._node,w=b.stamp(s),v=b.one(s),z=f._nodeAttrs[w],t,y,o,x,q;if(!z){z=f._nodeAttrs[w]={};}x=z[p];if(r&&r.value!==undefined){q=r.value;}else{if(r!==undefined){q=r;r=i;}}if(typeof q==="function"){q=q.call(v,v);}if(x&&x.transition){if(x.transition!==u){x.transition._count--;}}u._count++;o=((typeof r.duration!="undefined")?r.duration:u._duration)||0.0001;z[p]={value:q,duration:o,delay:(typeof r.delay!="undefined")?r.delay:u._delay,easing:r.easing||u._easing,transition:u};t=b.DOM.getComputedStyle(s,p);y=(typeof q==="string")?t:parseFloat(t);if(f.useNative&&y===q){setTimeout(function(){u._onNativeEnd.call(s,{propertyName:p,elapsedTime:o});},o*1000);}},removeProperty:function(q){var p=this,o=f._nodeAttrs[b.stamp(p._node)];if(o&&o[q]){delete o[q];p._count--;}},initAttrs:function(p){var o,q=this._node;if(p.transform&&!p[l]){p[l]=p.transform;delete p.transform;}for(o in p){if(p.hasOwnProperty(o)&&!f._reKeywords.test(o)){this.addProperty(o,p[o]);if(q.style[o]===""){b.DOM.setStyle(q,o,b.DOM.getComputedStyle(q,o));}}}},run:function(s){var r=this,p=r._node,o=r._config,q={type:"transition:start",config:o};if(!r._running){r._running=true;if(o.on&&o.on.start){o.on.start.call(b.one(p),q);}r.initAttrs(r._config);r._callback=s;r._start();}return r;},_start:function(){this._runNative();},_prepDur:function(o){o=parseFloat(o);return o+"s";},_runNative:function(q){var w=this,r=w._node,y=b.stamp(r),p=r.style,u=getComputedStyle(r),C=f._nodeAttrs[y],s="",D=u[c],B=c+": ",v=g+": ",A=a+": ",x=d+": ",t,z,o;if(D!=="all"){B+=D+",";v+=u[g]+",";A+=u[a]+",";x+=u[d]+",";}for(o in C){t=f._toHyphen(o);z=C[o];if(C.hasOwnProperty(o)&&z.transition===w){if(o in r.style){v+=w._prepDur(z.duration)+",";x+=w._prepDur(z.delay)+",";A+=(z.easing)+",";B+=t+",";s+=t+": "+z.value+"; ";}else{this.removeProperty(o);}}}B=B.replace(/,$/,";");v=v.replace(/,$/,";");A=A.replace(/,$/,";");x=x.replace(/,$/,";");if(!f._hasEnd[y]){r.addEventListener(k,w._onNativeEnd,false);f._hasEnd[y]=true;}p.cssText+=B+v+A+x+s;},_end:function(o){var s=this,q=s._node,u=s._callback,p=s._config,r={type:"transition:end",config:p,elapsedTime:o},t=b.one(q);s._running=false;s._callback=null;if(q){if(p.on&&p.on.end){setTimeout(function(){p.on.end.call(t,r);if(u){u.call(t,r);}},1);}else{if(u){setTimeout(function(){u.call(t,r);},1);}}}},_endNative:function(o){var p=this._node,q=p.ownerDocument.defaultView.getComputedStyle(p,"")[c];if(typeof q==="string"){q=q.replace(new RegExp("(?:^|,\\s)"+o+",?"),",");q=q.replace(/^,|,$/,"");p.style[m]=q;}},_onNativeEnd:function(v){var r=this,u=b.stamp(r),o=v,p=f._toCamel(o.propertyName),y=o.elapsedTime,x=f._nodeAttrs[u],w=x[p],s=(w)?w.transition:null,t,q;if(s){s.removeProperty(p);s._endNative(p);q=s._config[p];t={type:"propertyEnd",propertyName:p,elapsedTime:y,config:q};if(q&&q.on&&q.on.end){q.on.end.call(b.one(r),t);}if(s._count<=0){s._end(y);}}},destroy:function(){var o=this;node.removeEventListener(k,o._onNativeEnd,false);o._node=null;}};b.Transition=f;b.TransitionNative=f;b.Node.prototype.transition=function(q,p,u){var o=f._nodeAttrs[b.stamp(this._node)],s=(o)?o.transition||null:null,r,t;if(typeof q==="string"){if(typeof p==="function"){u=p;p=null;}r=f.fx[q];if(p&&typeof p!=="boolean"){p=b.clone(p);for(t in r){if(r.hasOwnProperty(t)){if(!(t in p)){p[t]=r[t];}}}}else{p=r;}}else{u=p;p=q;}if(s&&!s._running){s.init(this,p);}else{s=new f(this._node,p);}s.run(u);return this;};b.Node.prototype.show=function(p,o,q){this._show();if(p&&b.Transition){if(typeof p!=="string"&&!p.push){if(typeof o==="function"){q=o;o=p;}p=this.SHOW_TRANSITION;}this.transition(p,o,q);}return this;};var n=function(p,o,q){return function(){if(o){o.call(p);}if(q){q.apply(p._node,arguments);}};};b.Node.prototype.hide=function(p,o,q){if(p&&b.Transition){if(typeof o==="function"){q=o;o=null;}q=n(this,this._hide,q);if(typeof p!=="string"&&!p.push){if(typeof o==="function"){q=o;o=p;}p=this.HIDE_TRANSITION;}this.transition(p,o,q);}else{this._hide();}return this;};b.NodeList.prototype.transition=function(p,s){var o=this._nodes,q=0,r;while((r=o[q++])){b.one(r).transition(p,s);}return this;};b.Node.prototype.toggleView=function(p,o){var q;this._toggles=this._toggles||[];if(typeof p=="boolean"){o=p;}if(typeof o==="undefined"&&p in this._toggles){o=!this._toggles[p];}o=(o)?1:0;if(o){this._show();}else{q=n(anim,this._hide);}this._toggles[p]=o;this.transition(b.Transition.toggles[p][o],q);};b.NodeList.prototype.toggleView=function(p,s){var o=this._nodes,q=0,r;while((r=o[q++])){b.one(r).toggleView(p,s);}return this;};b.mix(f.fx,{fadeOut:{opacity:0,duration:0.5,easing:"ease-out"},fadeIn:{opacity:1,duration:0.5,easing:"ease-in"},sizeOut:{height:0,width:0,duration:0.75,easing:"ease-out"},sizeIn:{height:function(o){return o.get("scrollHeight")+"px";
 
9
},width:function(o){return o.get("scrollWidth")+"px";},duration:0.5,easing:"ease-in",on:{start:function(){var o=this.getStyle("overflow");if(o!=="hidden"){this.setStyle("overflow","hidden");this._transitionOverflow=o;}},end:function(){if(this._transitionOverflow){this.setStyle("overflow",this._transitionOverflow);}}}}});b.mix(f.toggles,{size:["sizeIn","sizeOut"],fade:["fadeOut","fadeIn"]});},"3.3.0",{requires:["node-base"]});
 
 
b'\\ No newline at end of file'