summaryrefslogtreecommitdiffstats
path: root/js/yui/progressbar
diff options
context:
space:
mode:
authorDavid Lawrence <dlawrence@mozilla.com>2011-04-23 14:03:15 +0200
committerDavid Lawrence <dlawrence@mozilla.com>2011-04-23 14:03:15 +0200
commit4c08043332e39576eed0868c22e6089eafa6aabf (patch)
tree5a8ad25f26a345feadedfe82782a763da051564e /js/yui/progressbar
parent8bb0ca1f5c922f8ea2fe64a59b1e1811dfaca65a (diff)
downloadbugzilla-4c08043332e39576eed0868c22e6089eafa6aabf.tar.gz
bugzilla-4c08043332e39576eed0868c22e6089eafa6aabf.tar.xz
Bug 649879 - Update to YUI 2.9.0
r/a=mkanat
Diffstat (limited to 'js/yui/progressbar')
-rw-r--r--js/yui/progressbar/progressbar-min.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/js/yui/progressbar/progressbar-min.js b/js/yui/progressbar/progressbar-min.js
index a46831e45..e3e8c6246 100644
--- a/js/yui/progressbar/progressbar-min.js
+++ b/js/yui/progressbar/progressbar-min.js
@@ -1,8 +1,8 @@
/*
-Copyright (c) 2010, Yahoo! Inc. All rights reserved.
+Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
-version: 2.8.2r1
+version: 2.9.0
*/
-(function(){var B=YAHOO.util.Dom,H=YAHOO.lang,X="yui-pb",Z=X+"-mask",W=X+"-bar",V=X+"-anim",M=X+"-tl",K=X+"-tr",J=X+"-bl",F=X+"-br",G="width",S="height",L="minValue",U="maxValue",I="value",A="anim",T="direction",D="ltr",P="rtl",d="ttb",O="btt",E="barEl",C="maskEl",R="ariaTextTemplate",Y="start",c="progress",Q="complete";var N=function(b){N.superclass.constructor.call(this,document.createElement("div"),b);this._init(b);};YAHOO.widget.ProgressBar=N;N.MARKUP=['<div class="',W,'"></div><div class="',Z,'"><div class="',M,'"></div><div class="',K,'"></div><div class="',J,'"></div><div class="',F,'"></div></div>'].join("");H.extend(N,YAHOO.util.Element,{_init:function(b){},initAttributes:function(f){N.superclass.initAttributes.call(this,f);this.set("innerHTML",N.MARKUP);this.addClass(X);var e,b=["id",G,S,"class","style"];while((e=b.pop())){if(e in f){this.set(e,f[e]);}}this.setAttributeConfig(E,{readOnly:true,value:this.getElementsByClassName(W)[0]});this.setAttributeConfig(C,{readOnly:true,value:this.getElementsByClassName(Z)[0]});this.setAttributeConfig(T,{value:D,validator:function(g){if(this._rendered){return false;}switch(g){case D:case P:case d:case O:return true;default:return false;}},method:function(g){this._barSizeFunction=this._barSizeFunctions[this.get(A)?1:0][g];}});this.setAttributeConfig(U,{value:100,validator:H.isNumber,method:function(g){this.get("element").setAttribute("aria-valuemax",g);if(this.get(I)>g){this.set(I,g);}}});this.setAttributeConfig(L,{value:0,validator:H.isNumber,method:function(g){this.get("element").setAttribute("aria-valuemin",g);if(this.get(I)<g){this.set(I,g);}}});this.setAttributeConfig(G,{getter:function(){return this.getStyle(G);},method:this._widthChange});this.setAttributeConfig(S,{getter:function(){return this.getStyle(S);},method:this._heightChange});this.setAttributeConfig(R,{value:"{value}"});this.setAttributeConfig(I,{value:0,validator:function(g){return H.isNumber(g)&&g>=this.get(L)&&g<=this.get(U);},method:this._valueChange});this.setAttributeConfig(A,{validator:function(g){return !!YAHOO.util.Anim;},setter:this._animSetter});},render:function(e,f){if(this._rendered){return;}this._rendered=true;var g=this.get(T);this.addClass(X);this.addClass(X+"-"+g);var b=this.get("element");b.tabIndex=0;b.setAttribute("role","progressbar");b.setAttribute("aria-valuemin",this.get(L));b.setAttribute("aria-valuemax",this.get(U));this.appendTo(e,f);this._barSizeFunction=this._barSizeFunctions[0][g];this.redraw();this._previousValue=this.get(I);this._fixEdges();if(this.get(A)){this._barSizeFunction=this._barSizeFunctions[1][g];}this.on("minValueChange",this.redraw);this.on("maxValueChange",this.redraw);return this;},redraw:function(){this._recalculateConstants();this._valueChange(this.get(I));},destroy:function(){this.set(A,false);this.unsubscribeAll();var b=this.get("element");if(b.parentNode){b.parentNode.removeChild(b);}},_previousValue:0,_barSpace:100,_barFactor:1,_rendered:false,_barSizeFunction:null,_heightChange:function(b){if(H.isNumber(b)){b+="px";}this.setStyle(S,b);this._fixEdges();this.redraw();},_widthChange:function(b){if(H.isNumber(b)){b+="px";}this.setStyle(G,b);this._fixEdges();this.redraw();},_fixEdges:function(){if(!this._rendered||YAHOO.env.ua.ie||YAHOO.env.ua.gecko){return;}var g=this.get(C),i=B.getElementsByClassName(M,undefined,g)[0],f=B.getElementsByClassName(K,undefined,g)[0],h=B.getElementsByClassName(J,undefined,g)[0],e=B.getElementsByClassName(F,undefined,g)[0],b=(parseInt(B.getStyle(g,S),10)-parseInt(B.getStyle(i,S),10))+"px";B.setStyle(h,S,b);B.setStyle(e,S,b);b=(parseInt(B.getStyle(g,G),10)-parseInt(B.getStyle(i,G),10))+"px";B.setStyle(f,G,b);B.setStyle(e,G,b);},_recalculateConstants:function(){var b=this.get(E);switch(this.get(T)){case D:case P:this._barSpace=parseInt(this.get(G),10)-(parseInt(B.getStyle(b,"marginLeft"),10)||0)-(parseInt(B.getStyle(b,"marginRight"),10)||0);break;case d:case O:this._barSpace=parseInt(this.get(S),10)-(parseInt(B.getStyle(b,"marginTop"),10)||0)-(parseInt(B.getStyle(b,"marginBottom"),10)||0);break;}this._barFactor=this._barSpace/(this.get(U)-(this.get(L)||0))||1;},_animSetter:function(g){var f,b=this.get(E);if(g){if(g instanceof YAHOO.util.Anim){f=g;}else{f=new YAHOO.util.Anim(b);}f.onTween.subscribe(this._animOnTween,this,true);f.onComplete.subscribe(this._animComplete,this,true);var h=f.setAttribute,e=this;switch(this.get(T)){case O:f.setAttribute=function(i,k,j){k=Math.round(k);h.call(this,i,k,j);B.setStyle(b,"top",(e._barSpace-k)+"px");};break;case P:f.setAttribute=function(i,k,j){k=Math.round(k);h.call(this,i,k,j);B.setStyle(b,"left",(e._barSpace-k)+"px");};break;}}else{f=this.get(A);if(f){f.onTween.unsubscribeAll();f.onComplete.unsubscribeAll();}f=null;}this._barSizeFunction=this._barSizeFunctions[f?1:0][this.get(T)];return f;},_animComplete:function(){var b=this.get(I);this._previousValue=b;this.fireEvent(c,b);this.fireEvent(Q,b);B.removeClass(this.get(E),V);},_animOnTween:function(b,e){var f=Math.floor(this._tweenFactor*e[0].currentFrame+this._previousValue);this.fireEvent(c,f);},_valueChange:function(g){var f=this.get(A),b=Math.floor((g-this.get(L))*this._barFactor),e=this.get(E);this._setAriaText(g);if(this._rendered){if(f){f.stop();if(f.isAnimated()){f._onComplete.fire();}}this.fireEvent(Y,this._previousValue);this._barSizeFunction(g,b,e,f);}},_setAriaText:function(e){var b=this.get("element"),f=H.substitute(this.get(R),{value:e,minValue:this.get(L),maxValue:this.get(U)});b.setAttribute("aria-valuenow",e);b.setAttribute("aria-valuetext",f);}});var a=[{},{}];N.prototype._barSizeFunctions=a;a[0][D]=function(g,b,e,f){B.setStyle(e,G,b+"px");this.fireEvent(c,g);this.fireEvent(Q,g);};a[0][P]=function(g,b,e,f){B.setStyle(e,G,b+"px");B.setStyle(e,"left",(this._barSpace-b)+"px");this.fireEvent(c,g);this.fireEvent(Q,g);};a[0][d]=function(g,b,e,f){B.setStyle(e,S,b+"px");this.fireEvent(c,g);this.fireEvent(Q,g);};a[0][O]=function(g,b,e,f){B.setStyle(e,S,b+"px");B.setStyle(e,"top",(this._barSpace-b)+"px");
-this.fireEvent(c,g);this.fireEvent(Q,g);};a[1][D]=function(g,b,e,f){B.addClass(e,V);this._tweenFactor=(g-this._previousValue)/f.totalFrames/f.duration;f.attributes={width:{to:b}};f.animate();};a[1][P]=a[1][D];a[1][d]=function(g,b,e,f){B.addClass(e,V);this._tweenFactor=(g-this._previousValue)/f.totalFrames/f.duration;f.attributes={height:{to:b}};f.animate();};a[1][O]=a[1][d];})();YAHOO.register("progressbar",YAHOO.widget.ProgressBar,{version:"2.8.2r1",build:"7"}); \ No newline at end of file
+(function(){var c=YAHOO.util.Dom,i=YAHOO.lang,B="yui-pb",D=B+"-mask",A=B+"-bar",z=B+"-anim",q=B+"-tl",l=B+"-tr",k=B+"-bl",g=B+"-br",h="width",w="height",m="minValue",y="maxValue",j="value",a="anim",x="direction",e="ltr",t="rtl",G="ttb",s="btt",f="barEl",d="maskEl",v="ariaTextTemplate",n="animAcceleration",p="background-position",o="px",C="start",F="progress",u="complete";var r=function(b){r.superclass.constructor.call(this,document.createElement("div"),b);this._init(b);};YAHOO.widget.ProgressBar=r;r.MARKUP=['<div class="',A,'"></div><div class="',D,'"><div class="',q,'"></div><div class="',l,'"></div><div class="',k,'"></div><div class="',g,'"></div></div>'].join("");i.extend(r,YAHOO.util.Element,{_init:function(b){},initAttributes:function(I){r.superclass.initAttributes.call(this,I);this.set("innerHTML",r.MARKUP);this.addClass(B);var H,b=["id",h,w,"class","style"];while((H=b.pop())){if(H in I){this.set(H,I[H]);}}this.setAttributeConfig(f,{readOnly:true,value:this.getElementsByClassName(A)[0]});this.setAttributeConfig(d,{readOnly:true,value:this.getElementsByClassName(D)[0]});this.setAttributeConfig(x,{value:e,validator:function(J){if(this._rendered){return false;}switch(J){case e:case t:case G:case s:return true;default:return false;}}});this.setAttributeConfig(y,{value:100,validator:i.isNumber,method:function(J){this.get("element").setAttribute("aria-valuemax",J);if(this.get(j)>J){this.set(j,J);}}});this.setAttributeConfig(m,{value:0,validator:i.isNumber,method:function(J){this.get("element").setAttribute("aria-valuemin",J);if(this.get(j)<J){this.set(j,J);}}});this.setAttributeConfig(h,{getter:function(){return this.getStyle(h);},method:this._widthChange});this.setAttributeConfig(w,{getter:function(){return this.getStyle(w);},method:this._heightChange});this.setAttributeConfig(v,{value:"{value}"});this.setAttributeConfig(j,{value:0,validator:function(J){return i.isNumber(J)&&J>=this.get(m)&&J<=this.get(y);},method:this._valueChange});this.setAttributeConfig(a,{validator:function(J){return !!YAHOO.util.Anim;},setter:this._animSetter});this.setAttributeConfig(n,{value:null,validator:function(J){return i.isNumber(J)||i.isNull(J);},method:function(J){this._fixAnim(this.get(a),J);}});},render:function(H,I){if(this._rendered){return;}this._rendered=true;var J=this.get(x);this.addClass(B);this.addClass(B+"-"+J);var b=this.get("element");b.tabIndex=0;b.setAttribute("role","progressbar");b.setAttribute("aria-valuemin",this.get(m));b.setAttribute("aria-valuemax",this.get(y));this.appendTo(H,I);this.redraw(false);this._previousValue=this.get(j);this._fixEdges();this.on("minValueChange",this.redraw);this.on("maxValueChange",this.redraw);return this;},redraw:function(b){this._recalculateConstants();this._valueChange(this.get(j),b);},destroy:function(){this.set(a,false);this.unsubscribeAll();var b=this.get("element");if(b.parentNode){b.parentNode.removeChild(b);}},_previousValue:0,_barSpace:100,_barFactor:1,_rendered:false,_heightChange:function(b){if(i.isNumber(b)){b+=o;}this.setStyle(w,b);this._fixEdges();this.redraw(false);},_widthChange:function(b){if(i.isNumber(b)){b+=o;}this.setStyle(h,b);this._fixEdges();this.redraw(false);},_fixEdges:function(){if(!this._rendered||YAHOO.env.ua.ie||YAHOO.env.ua.gecko){return;}var J=this.get(d),L=c.getElementsByClassName(q,undefined,J)[0],I=c.getElementsByClassName(l,undefined,J)[0],K=c.getElementsByClassName(k,undefined,J)[0],H=c.getElementsByClassName(g,undefined,J)[0],b=(parseInt(c.getStyle(J,w),10)-parseInt(c.getStyle(L,w),10))+o;c.setStyle(K,w,b);c.setStyle(H,w,b);b=(parseInt(c.getStyle(J,h),10)-parseInt(c.getStyle(L,h),10))+o;c.setStyle(I,h,b);c.setStyle(H,h,b);},_recalculateConstants:function(){var b=this.get(f);switch(this.get(x)){case e:case t:this._barSpace=parseInt(this.get(h),10)-(parseInt(c.getStyle(b,"marginLeft"),10)||0)-(parseInt(c.getStyle(b,"marginRight"),10)||0);break;case G:case s:this._barSpace=parseInt(this.get(w),10)-(parseInt(c.getStyle(b,"marginTop"),10)||0)-(parseInt(c.getStyle(b,"marginBottom"),10)||0);break;}this._barFactor=this._barSpace/(this.get(y)-(this.get(m)||0))||1;},_animSetter:function(I){var H,b=this.get(f);if(I){if(I instanceof YAHOO.util.Anim){H=I;}else{H=new YAHOO.util.Anim(b);}H.onTween.subscribe(this._animOnTween,this,true);H.onComplete.subscribe(this._animComplete,this,true);this._fixAnim(H,this.get(n));}else{H=this.get(a);if(H){H.onTween.unsubscribeAll();H.onComplete.unsubscribeAll();}H=null;}return H;},_fixAnim:function(I,H){if(I){if(!this._oldSetAttribute){this._oldSetAttribute=I.setAttribute;}var b=this;switch(this.get(x)){case e:I.setAttribute=function(J,L,K){L=Math.round(L);b._oldSetAttribute.call(this,J,L,K);if(J==h){b._oldSetAttribute.call(this,p,-L*H,o);}};break;case t:I.setAttribute=function(J,M,K){M=Math.round(M);b._oldSetAttribute.call(this,J,M,K);if(J==h){var L=b._barSpace-M;b._oldSetAttribute.call(this,"left",L,o);b._oldSetAttribute.call(this,p,-L+M*H,o);}};break;case G:I.setAttribute=function(J,L,K){L=Math.round(L);b._oldSetAttribute.call(this,J,L,K);if(J==w){b._oldSetAttribute.call(this,p,"center "+(-L*H),o);}};break;case s:I.setAttribute=function(J,M,K){M=Math.round(M);b._oldSetAttribute.call(this,J,M,K);if(J==w){var L=b._barSpace-M;b._oldSetAttribute.call(this,"top",L,o);b._oldSetAttribute.call(this,p,"center "+(M*H-L),o);}};break;}}},_animComplete:function(){var b=this.get(j);this._previousValue=b;this.fireEvent(F,b);this.fireEvent(u,b);c.removeClass(this.get(f),z);},_animOnTween:function(b,H){var I=Math.floor(this._tweenFactor*H[0].currentFrame+this._previousValue);this.fireEvent(F,I);},_valueChange:function(J,H){var I=this.get(a),b=Math.floor((J-this.get(m))*this._barFactor);this._setAriaText(J);if(this._rendered){if(I){I.stop();if(I.isAnimated()){I._onComplete.fire();}}this.fireEvent(C,this._previousValue);r._barSizeFunctions[((H!==false)&&I)?1:0][this.get(x)].call(this,J,b,this.get(f),I);}},_setAriaText:function(H){var b=this.get("element"),I=i.substitute(this.get(v),{value:H,minValue:this.get(m),maxValue:this.get(y)});
+b.setAttribute("aria-valuenow",H);b.setAttribute("aria-valuetext",I);}});var E=[{},{}];r._barSizeFunctions=E;E[0][e]=function(J,b,H,I){c.setStyle(H,h,b+o);this.fireEvent(F,J);this.fireEvent(u,J);};E[0][t]=function(J,b,H,I){c.setStyle(H,h,b+o);c.setStyle(H,"left",(this._barSpace-b)+o);this.fireEvent(F,J);this.fireEvent(u,J);};E[0][G]=function(J,b,H,I){c.setStyle(H,w,b+o);this.fireEvent(F,J);this.fireEvent(u,J);};E[0][s]=function(J,b,H,I){c.setStyle(H,w,b+o);c.setStyle(H,"top",(this._barSpace-b)+o);this.fireEvent(F,J);this.fireEvent(u,J);};E[1][e]=function(J,b,H,I){c.addClass(H,z);this._tweenFactor=(J-this._previousValue)/I.totalFrames/I.duration;I.attributes={width:{to:b}};I.animate();};E[1][t]=E[1][e];E[1][G]=function(J,b,H,I){c.addClass(H,z);this._tweenFactor=(J-this._previousValue)/I.totalFrames/I.duration;I.attributes={height:{to:b}};I.animate();};E[1][s]=E[1][G];})();YAHOO.register("progressbar",YAHOO.widget.ProgressBar,{version:"2.9.0",build:"2800"}); \ No newline at end of file