scrollview-paginator-min.js revision 1c2f34370636e83c77e9613a2b89d95e8cf5107c
YUI.add("scrollview-paginator",function(D){var B=0.5,C=D.ScrollView.UI_SRC;function A(){A.superclass.constructor.apply(this,arguments);}A.NAME="pluginScrollViewPaginator";A.NS="pages";A.ATTRS={selector:{value:null},index:{value:0},total:{value:0}};D.extend(A,D.Plugin.Base,{initializer:function(){var E;E=this._host=this.get("host");this.afterHostMethod("_uiDimensionsChange",this._calculatePageOffsets);this.beforeHostMethod("_flickFrame",this._flickFrame);this.afterHostEvent("scrollEnd",this._scrollEnded);this.afterHostEvent("render",this._afterRender);this.after("indexChange",this._afterIndexChange);if(E.get("bounce")!==0){this._originalHostBounce=E.get("bounce");E.set("bounce",B);}},destructor:function(){var E=this._host;if(E.get("bounce")!==0){E.set("bounce",this._originalHostBounce);}},_calculatePageOffsets:function(){var H=this._host,F=H.get("contentBox"),I=this.get("selector"),E,G=[];E=I?F.all(I):F.get("children");E.each(function(K,J){G.push(K.get("offsetLeft"));},this);G.push(H._scrollWidth-H.get("width"));this._minPoints=G;this.set("total",E.size());},_flickFrame:function(){var H=this._host,G=H._currentVelocity,I=G<0,E=this.get("index"),F=this.get("total");if(G){if(I&&E<F-1){this.set("index",E+1);}else{if(!I&&E>0){this.set("index",E-1);}}}return this._prevent;},_afterRender:function(F){var E=this._host;E.get("boundingBox").addClass(E.getClassName("paged"));},_scrollEnded:function(H){var G=this._host,E=this.get("index"),F=this.get("total");if(H.onGestureMoveEnd&&!G._flicking){if(G._scrolledHalfway){if(G._scrolledForward&&E<F-1){this.set("index",E+1);}else{if(E>0){this.set("index",E-1);}else{this.snapToCurrent();}}}else{this.snapToCurrent();}}G._flicking=false;},_afterIndexChange:function(E){if(E.src!==C){this._uiIndex(E.newVal);}},_uiIndex:function(E){this.scrollTo(E,350,"ease-out");},next:function(F){var E=this.get("index");if(E<this.get("total")-1){this.set("index",E+1);}},prev:function(F){var E=this.get("index");if(E>0){this.set("index",E-1);}},scrollTo:function(F,H,I){var G=this._host,E=G.get("scrollX");if(G._scrollsHorizontal){E=this._minPoints[F];G.set("scrollX",E,{duration:H,easing:I});}},snapToCurrent:function(){this._host._killTimer();this._host.set("scrollX",this._minPoints[this.get("index")],{duration:300,easing:"ease-out"});},_prevent:new D.Do.Prevent()});D.namespace("Plugin").ScrollViewPaginator=A;},"@VERSION@",{skinnable:true,requires:["plugin"]});