widget-min.js revision c1d524cd9449102e425e6bbf86cbb3b327cadf77
a9a4fee30864f00049b02201b1af50ada7f769e3Allen RabinovichYUI.add("widget-base",function(B){var G=B.Lang,U=B.Node,E=B.ClassNameManager,b=E.getClassName,s,V=B.cached(function(L){return L.substring(0,1).toUpperCase()+L.substring(1);}),l="content",w="visible",r="hidden",d="disabled",h="focused",D="width",f="height",t="boundingBox",a="contentBox",K="parentNode",O="ownerDocument",m="offsetHeight",c="auto",J="srcNode",p="body",o="tabIndex",T="id",I="render",q="rendered",P="destroyed",A="strings",Q="<div></div>",e="Change",R="loading",k="_uiSet",j="",n=function(){},M=/(\w+):(\w+)/,Z="$2",X=true,u=false,W,N={},F=[w,d,f,D,h],i=B.UA.webkit,S=B.UA.ie,v="contentUpdate",g={},H={};function C(Y){this._strs={};this._cssPrefix=this.constructor.CSS_PREFIX||b(this.constructor.NAME.toLowerCase());C.superclass.constructor.apply(this,arguments);var x=this.get(I),L;if(x){if(x!==X){L=x;}this.render(L);}}C.NAME="widget";W=C.UI_SRC="ui";C.ATTRS=N;N[T]={valueFn:"_guid",writeOnce:X};N[q]={value:u,readOnly:X};N[t]={value:null,setter:"_setBB",writeOnce:X};N[a]={value:null,setter:"_setCB",writeOnce:X};N[o]={value:null,validator:"_validTabIndex"};N[h]={value:u,readOnly:X};N[d]={value:u};N[w]={value:X};N[f]={value:j};N[D]={value:j};N[A]={value:{},setter:"_strSetter",getter:"_strGetter"};N[I]={value:u,writeOnce:X};C.CSS_PREFIX=b(C.NAME.toLowerCase());C.getClassName=function(){return b.apply(E,[C.CSS_PREFIX].concat(B.Array(arguments),true));};s=C.getClassName;C.getByNode=function(L){var x,Y=s();L=U.one(L);if(L){L=L.ancestor("."+Y,true);if(L){x=H[B.stamp(L,X)];}}return x||null;};B.extend(C,B.Base,{getClassName:function(){return b.apply(E,[this._cssPrefix].concat(B.Array(arguments),true));},initializer:function(L){H[B.stamp(this.get(t))]=this;this.publish(v,{preventable:u});if(this._applyParser){this._applyParser(L);}},destructor:function(){var L=this.get(t),x=B.stamp(L,X),Y=B.stamp(this,X);if(x in H){delete H[x];}B.each(g,function(y){if(y.instances[Y]){delete y.instances[Y];if(B.Object.size(y.instances)===0){y.handle.detach();}}});this._unbindUI(L);L.remove(X);},render:function(L){if(!this.get(P)&&!this.get(q)){this.publish(I,{queuable:u,fireOnce:X,defaultFn:this._defRenderFn});this.fire(I,{parentNode:(L)?U.one(L):null});}return this;},_defRenderFn:function(L){if(L.target===this){this._renderUI(L.parentNode);this._bindUI();this._syncUI();this.renderer();this._set(q,X);this._removeLoadingClassNames();}},renderer:function(){this.renderUI();this.bindUI();this.syncUI();},bindUI:n,renderUI:n,syncUI:n,hide:function(){return this.set(w,u);},show:function(){return this.set(w,X);},focus:function(){return this._set(h,X);},blur:function(){return this._set(h,u);},enable:function(){return this.set(d,u);},disable:function(){return this.set(d,X);},_uiSizeCB:function(x){var z=this.get(t),Y=this.get(a),L=s("tmp","forcesize"),y=this._bbs,AA=S&&S<7;if(y){Y.toggleClass(s(l,"expanded"),x);}else{if(x){if(AA){z.addClass(L);}Y.set(m,z.get(m));if(AA){z.removeClass(L);}}else{Y.setStyle(f,j);}}},_renderBox:function(L){var Y=this.get(a),x=this.get(t),z=this.get(J),y=(z&&z.get(O))||x.get(O)||Y.get(O);if(z&&!z.compareTo(Y)&&!Y.inDoc(y)){z.replace(Y);}if(!x.compareTo(Y.get(K))&&!x.compareTo(Y)){if(Y.inDoc(y)){Y.replace(x);}x.appendChild(Y);}if(L){L.appendChild(x);}else{if(!x.inDoc(y)){U.one(p).insert(x,0);}}this._bbs=!(S&&S<8&&y.compatMode!="BackCompat");},_setBB:function(L){return this._setBox(this.get(T),L,this.BOUNDING_TEMPLATE);},_setCB:function(L){return(this.CONTENT_TEMPLATE===null)?this.get(t):this._setBox(null,L,this.CONTENT_TEMPLATE);},_setBox:function(x,Y,L){Y=U.one(Y)||U.create(L);if(!Y.get(T)){Y.set(T,x||B.guid());}return Y;},_renderUI:function(L){this._renderBoxClassNames();this._renderBox(L);},_renderBoxClassNames:function(){var y=this._getClasses(),L,Y=this.get(t),x;Y.addClass(s());for(x=y.length-3;x>=0;x--){L=y[x];Y.addClass(L.CSS_PREFIX||b(L.NAME.toLowerCase()));}this.get(a).addClass(this.getClassName(l));},_removeLoadingClassNames:function(){var L=this.get(t);L.removeClass(s(R));L.removeClass(this.getClassName(R));},_bindUI:function(){this._bindAttrUI(this._BIND_UI_ATTRS);this._bindDOM();},_unbindUI:function(L){this._unbindAttrUI(this._BIND_UI_ATTRS);this._unbindDOM(L);},_bindDOM:function(){var L=this.get(t).get(O);this._hDocFocus=L.on("focus",this._onDocFocus,this);if(i){this._hDocMouseDown=L.on("mousedown",this._onDocMouseDown,this);}},_unbindDOM:function(L){this._hDocFocus.detach();if(i){this._hDocMouseDown.detach();}},_syncUI:function(){this._syncAttrUI(this._SYNC_UI_ATTRS);},_uiSetHeight:function(L){this._uiSetDim(f,L);this._uiSizeCB((L!==j&&L!==c));},_uiSetWidth:function(L){this._uiSetDim(D,L);},_uiSetDim:function(L,Y){this.get(t).setStyle(L,G.isNumber(Y)?Y+this.DEF_UNIT:Y);},_uiSetVisible:function(L){this.get(t).toggleClass(this.getClassName(r),!L);},_uiSetDisabled:function(L){this.get(t).toggleClass(this.getClassName(d),L);},_uiSetFocused:function(x,Y){var L=this.get(t);L.toggleClass(this.getClassName(h),x);if(Y!==W){if(x){L.focus();}else{L.blur();}}},_uiSetTabIndex:function(Y){var L=this.get(t);if(G.isNumber(Y)){L.set(o,Y);}else{L.removeAttribute(o);}},_onDocMouseDown:function(L){if(this._hasDOMFocus){this._onDocFocus(L);}},_onDocFocus:function(Y){var L=this.get(t).contains(Y.target);this._hasDOMFocus=L;this._set(h,L,{src:W});},toString:function(){return this.constructor.NAME+"["+this.get(T)+"]";},DEF_UNIT:"px",CONTENT_TEMPLATE:Q,BOUNDING_TEMPLATE:Q,_guid:function(){return B.guid();},_validTabIndex:function(L){return(G.isNumber(L)||G.isNull(L));},_bindAttrUI:function(L){this._doBindAttrUI(L,X);},_unbindAttrUI:function(L){this._doBindAttrUI(L,u);},_syncAttrUI:function(x){var y,Y=x.length,L;for(y=0;y<Y;y++){L=x[y];this[k+V(L)](this.get(L));}},_doBindAttrUI:function(x,z){var y,L=x.length,Y=(z)?"after":"detach";for(y=0;y<L;y++){this[Y](x[y]+e,this._setAttrUI);}},_setAttrUI:function(L){this[k+V(L.attrName)](L.newVal,L.src);},_strSetter:function(L){return B.merge(this.get(A),L);},getString:function(L){return this.get(A)[L];},getStrings:function(){return this.get(A);},_BIND_UI_ATTRS:F,_SYNC_UI_ATTRS:F.concat(o),UI_EVENTS:B.Node.DOM_EVENTS,_getUIEventNode:function(){return this.get(t);
a9a4fee30864f00049b02201b1af50ada7f769e3Allen Rabinovich},_createUIEvent:function(x){var AA=this._getUIEventNode(),L=AA.get(K),Y=(B.stamp(L)+x),z=g[Y],y;if(!z){y=L.delegate(x,function(AB){var AC=C.getByNode(this);AC.fire(AB.type,{domEvent:AB});},"."+s());g[Y]=z={instances:{},handle:y};}z.instances[B.stamp(this)]=1;},_getUIEvent:function(Y){if(G.isString(Y)){var x=Y.replace(M,Z),L;if(this.UI_EVENTS[x]){L=x;}return L;}},_initUIEvent:function(Y){var x=this._getUIEvent(Y),L=this._uiEvtsInitQueue||{};if(x&&!L[x]){this.after(I,function(){this._createUIEvent(x);delete this._uiEvtsInitQueue[x];});this._uiEvtsInitQueue=L[x]=1;}},on:function(L){this._initUIEvent(L);return C.superclass.on.apply(this,arguments);},after:function(L){this._initUIEvent(L);return C.superclass.after.apply(this,arguments);},publish:function(Y,L){var x=this._getUIEvent(Y);if(x&&L&&L.defaultFn){this._initUIEvent(x);}return C.superclass.publish.apply(this,arguments);}});B.Widget=C;},"@VERSION@",{requires:["attribute","event-focus","base","node","classnamemanager"]});YUI.add("widget-htmlparser",function(F){var E=F.Widget,C=F.Node,D=F.Lang,A="srcNode",B="contentBox";E.HTML_PARSER={};E._buildCfg={aggregates:["HTML_PARSER"]};E.ATTRS[A]={value:null,setter:C.one,getter:"_getSrcNode",writeOnce:true};F.mix(E.prototype,{_getSrcNode:function(G){return G||this.get(B);},_applyParsedConfig:function(I,G,H){return(H)?F.aggregate(G,H,false):G;},_applyParser:function(G){var I=this,J=I.get(A),H=I._getHtmlParser(),L,K;if(H&&J){F.Object.each(H,function(N,M,O){K=null;if(D.isFunction(N)){K=N.call(I,J);}else{if(D.isArray(N)){K=J.all(N[0]);}else{K=J.one(N);}}if(K!==null&&K!==undefined){L=L||{};L[M]=K;}});}G=I._applyParsedConfig(J,G,L);},_getHtmlParser:function(){var H=this._getClasses(),J={},G,I;for(G=H.length-1;G>=0;G--){I=H[G].HTML_PARSER;if(I){F.mix(J,I,true);}}return J;}});},"@VERSION@",{requires:["widget-base"]});YUI.add("widget-i18n",function(F){var C=true,G="locale",E="initValue",B="-",A="",D=F.Widget;D.ATTRS[G]={value:"en"};F.mix(D.prototype,{_setStrings:function(I,H){var J=this._strs;H=H.toLowerCase();if(!J[H]){J[H]={};}F.aggregate(J[H],I,C);return J[H];},_getStrings:function(H){return this._strs[H.toLowerCase()];},getStrings:function(P){P=(P||this.get(G)).toLowerCase();var N=this.getDefaultLocale().toLowerCase(),I=this._getStrings(N),O=(I)?F.merge(I):{},L=P.split(B),M,K,J,H;if(P!==N||L.length>1){H=A;for(K=0,J=L.length;K<J;++K){H+=L[K];M=this._getStrings(H);if(M){F.aggregate(O,M,C);}H+=B;}}return O;},getString:function(J,I){I=(I||this.get(G)).toLowerCase();var K=(this.getDefaultLocale()).toLowerCase(),L=this._getStrings(K)||{},M=L[J],H=I.lastIndexOf(B);if(I!==K||H!=-1){do{L=this._getStrings(I);if(L&&J in L){M=L[J];break;}H=I.lastIndexOf(B);if(H!=-1){I=I.substring(0,H);}}while(H!=-1);}return M;},getDefaultLocale:function(){return this._state.get(G,E);},_strSetter:function(H){return this._setStrings(H,this.get(G));},_strGetter:function(H){return this._getStrings(this.get(G));}},true);},"@VERSION@",{requires:["widget-base"]});YUI.add("widget",function(A){},"@VERSION@",{use:["widget-base","widget-htmlparser","widget-i18n"]});