Alloy UI

aui-calendar  1.0.1

 
Filters
AUI.add("aui-carousel",function(O){var F=O.Lang,K="carousel",T=O.ClassNameManager.getClassName,L=T(K,"item"),E=T(K,"item","active"),S=T(K,"item","transition"),C=T(K,"menu","active"),Q=T(K,"menu","index"),I=T(K,"menu","item"),D=T(K,"menu","next"),H=T(K,"menu","play"),P=T(K,"menu","pause"),B=T(K,"menu","prev"),M=['<li><a class="',I,Q,'">'].join(" "),J=['<li><a class="',I,D,'">'].join(" "),N=['<li><a class="',I,H,'">'].join(" "),G=['<li><a class="',I,B,'">'].join(" ");var R=O.Component.create({NAME:K,ATTRS:{activeIndex:{value:0,setter:function(A){A=(A==="rand")?this._createIndexRandom():Math.max(Math.min(A,this.nodeSelection.size()),-1);return A;}},animationTime:{value:0.5},intervalTime:{value:0.75},itemSelector:{value:">*"},playing:{value:true}},prototype:{animation:null,nodeSelection:null,nodeMenu:null,initializer:function(){var A=this;A.animation=new O.Anim({duration:A.get("animationTime"),to:{opacity:1}});},renderUI:function(){var A=this;A._updateNodeSelection();A._renderMenu();},bindUI:function(){var A=this;A.after({activeIndexChange:A._afterActiveIndexChange,animationTimeChange:A._afterAnimationTimeChange,itemSelectorChange:A._afterItemSelectorChange,intervalTimeChange:A._afterIntervalTimeChange,playingChange:A._afterPlayingChange});A._bindMenu();if(A.get("playing")===true){A._afterPlayingChange({prevVal:false,newVal:true});}},syncUI:function(){var A=this;A._uiSetActiveIndex(A.get("activeIndex"));},item:function(A){this.set("activeIndex",A);},next:function(){this._updateIndexNext();},pause:function(){this.set("playing",false);},play:function(){this.set("playing",true);},prev:function(){this._updateIndexPrev();},_afterActiveIndexChange:function(A){this._uiSetActiveIndex(A.newVal,{prevVal:A.prevVal,animate:A.animate});},_afterAnimationTimeChange:function(A){this.animation.set("duration",A.newVal);},_afterItemSelectorChange:function(A){this._updateNodeSelection();},_afterIntervalTimeChange:function(U){var A=this;A._clearIntervalRotationTask();A._createIntervalRotationTask();},_afterPlayingChange:function(U){var A=this;var V=A.nodeMenu.get("children").item(0).get("children").item(0);if(U.newVal){A._createIntervalRotationTask();V.removeClass(H).addClass(P);}else{A._clearIntervalRotationTask();V.removeClass(P).addClass(H);}},_bindMenu:function(){var A=this,V=A.nodeMenu,U=V.get("children");U.each(function(X,W,Y){if(W>1&&W!==Y.size()-1){X.on("click",A._onMenuItemClick,A);}});U.item(0).on("click",A._onMenuPlayClick,A);U.item(1).on("click",A._updateIndexPrev,A);U.item(U.size()-1).on("click",A._updateIndexNext,A);},_clearIntervalRotationTask:function(){clearInterval(this._intervalRotationTask);},_createIndexRandom:function(){return Math.ceil(Math.random()*this.nodeSelection.size())-1;},_createIntervalRotationTask:function(){var A=this;A._clearIntervalRotationTask();A._intervalRotationTask=setInterval(function(){A._updateIndexNext({animate:true});},A.get("intervalTime")*1000);},_onAnimationEnd:function(V,W,U,A,X){if(U){U.removeClass(S);}W.setStyle("opacity","1");},_onAnimationStart:function(V,W,U,A,X){W.addClass(E);A.addClass(C);if(U){U.removeClass(E).addClass(S);}if(X){X.removeClass(C);}},_onMenuItemClick:function(U){U.preventDefault();var A=this;A.set("activeIndex",A.nodeMenu.all("li").indexOf(U.currentTarget)-2);},_onMenuPlayClick:function(A){this.set("playing",!this.get("playing"));},_renderMenu:function(){var U=this,V=O.Node.create("<menu>"),A;A=O.Node.create(N);V.appendChild(A);A=O.Node.create(G);V.appendChild(A);U.nodeSelection.each(function(X,W,Y){A=O.Node.create([M,""].join(W));V.appendChild(A);});A=O.Node.create(J);V.appendChild(A);U.get("contentBox").appendChild(V);U.nodeMenu=V;},_uiSetActiveIndex:function(V,Y){var a=2;var b=this;var Z=b.nodeSelection.item(V);var X=null;var W=null;var U=b.nodeMenu.get("children").item(V+a).get("children").item(0);var c=null;var A=null;b.animation.set("node",Z);if(Y&&!F.isUndefined(Y.prevVal)){W=b.nodeMenu.get("children").item(Y.prevVal+a).get("children").item(0);X=b.nodeSelection.item(Y.prevVal);X.removeClass(E).addClass(S);b.animation.stop();}Z.setStyle("opacity","0");c=b.animation.on("start",function(d){b._onAnimationStart(d,Z,X,U,W);c.detach();});A=b.animation.on("end",function(d){b._onAnimationEnd(d,Z,X,U,W);A.detach();});if(Y&&Y.animate){b.animation.run();}else{b.animation.fire("start");b.animation.fire("end");}},_updateIndexNext:function(U){var A=this;A.set("activeIndex",(A.get("activeIndex")+1)>(A.nodeSelection.size()-1)?0:A.get("activeIndex")+1,U);},_updateIndexPrev:function(U){var A=this;A.set("activeIndex",(A.get("activeIndex")-1)<0?(A.nodeSelection.size()-1):A.get("activeIndex")-1,U);},_updateNodeSelection:function(){var A=this;A.nodeSelection=A.get("contentBox").all(A.get("itemSelector")).addClass(L);},_intervalRotationTask:null}});O.Carousel=R;},"@VERSION@",{skinnable:true,requires:["aui-base","anim"]});