~bac/juju-gui/trunkcopy

« back to all changes in this revision

Viewing changes to lib/yui/build/scrollview-paginator/scrollview-paginator-min.js

  • Committer: kapil.foss at gmail
  • Date: 2012-07-13 18:45:59 UTC
  • Revision ID: kapil.foss@gmail.com-20120713184559-2xl7be17egsrz0c9
reshape

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.5.1 (build 22)
3
 
Copyright 2012 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add("scrollview-paginator",function(a){var b=(a.ScrollView)?a.ScrollView.UI_SRC:"ui",c="index",j="prevIndex",g="scrollX",f="scrollY",d="total",h="boundingBox",i="contentBox",e=3;function k(){k.superclass.constructor.apply(this,arguments);}k.NAME="pluginScrollViewPaginator";k.NS="pages";k.ATTRS={selector:{value:null},index:{value:0},prevIndex:{value:0},total:{value:0}};a.extend(k,a.Plugin.Base,{optimizeMemory:false,_pageOffsets:null,_pageNodes:null,initializer:function(m){var n=this,l=m.optimizeMemory||l;n._host=n.get("host");n.beforeHostMethod("_flickFrame",n._flickFrame);n.afterHostMethod("_uiDimensionsChange",n._calcOffsets);n.afterHostEvent("scrollEnd",n._scrollEnded);n.afterHostEvent("render",n._afterRender);n.after("indexChange",n._afterIndexChange);n.optimizeMemory=l;n._pageNodes=new a.NodeList();},_calcOffsets:function(){var v=this._host,o=v.get(i),t=v.get(h),q=v._scrollsVertical,w=(q)?v._scrollHeight:v._scrollWidth,u=this.get("selector"),r=this.optimizeMemory,s=this.get(c),l,n,m;l=u?o.all(u):o.get("children");this._pageNodes=l;this.set(d,l.size());this._pageOffsets=l.get((q)?"offsetTop":"offsetLeft");if(r){this.set(j,s);v._maxScrollX=this._pageOffsets[e-1];o.empty(true);for(var p=0;p<e;p++){m=l.item(s+p);o.append(m);}}},_getTargetOffset:function(o){var n=this.get(j),p=this.get(c),r=this.get(d),m=(n<p)?true:false,s=this._pageOffsets,q=this.optimizeMemory,l,t;if(q){if(m){if(o>1){t=2;}else{t=1;}}else{if(p==(r-2)){t=1;}else{t=0;}}}else{t=o;}l=s[t];return l;},_flickFrame:function(){var o=this._host,n=o._currentVelocity,p=n<0,l=this.get(c),m=this.get(d);if(n){if(p&&l<m-1){this.next();}else{if(!p&&l>0){this.prev();}}}return this._prevent;},_afterRender:function(m){var l=this._host;l.get("boundingBox").addClass(l.getClassName("paged"));},_scrollEnded:function(q){var p=this._host,l=this.get(c),n=this.get(d),o=k.SNAP_TO_CURRENT,m=this.optimizeMemory;if(q.onGestureMoveEnd&&!p._flicking){if(p._scrolledHalfway){if(p._scrolledForward&&l<n-1){this.next();}else{if(l>0){this.prev();}else{this.snapToCurrent(o.duration,o.easing);}}}else{this.snapToCurrent(o.duration,o.easing);}}if(!q.onGestureMoveEnd){if(m){this._manageDOM();}this.set(j,l);}},_manageDOM:function(){var t,s,r,v=this._host,n=v.get(i),o=this.get(c),l=this.get(j),p=this.get(d),u=(l<o)?true:false,m=n.get("children"),q=this._pageNodes,w;if(q&&q.size()>0){if(u){t=q.item(o+1);s=n.append;}else{t=q.item(o-1);s=n.prepend;}if(m.indexOf(t)===-1){s.call(n,t);}m=n.get("children");}if(m.size()>e){r=(u)?n.one("li:first-of-type"):n.one("li:last-of-type");r.remove();w=(o==p?2:1);v.set("scrollX",this._pageOffsets[w]);}},_afterIndexChange:function(l){if(l.src!==b){this._uiIndex(l.newVal);}},_uiIndex:function(l){this.scrollTo(l,350,"ease-out");},next:function(){var l=this.get(c);if(l<this.get(d)-1){this.set(c,l+1);}},prev:function(){var l=this.get(c);if(l>0){this.set(c,l-1);}},scrollTo:function(m,p,r){var o=this._host,l=o._scrollsVertical,n=(l)?f:g,q=this._getTargetOffset(m);o.set(n,q,{duration:p,easing:r});},snapToCurrent:function(n,o){var m=this._host,l=m._scrollsVertical;m._killTimer();m.set((l)?f:g,this._getTargetOffset(this.get(c)),{duration:n,easing:o});},_prevent:new a.Do.Prevent()});k.SNAP_TO_CURRENT={duration:300,easing:"ease-out"};a.namespace("Plugin").ScrollViewPaginator=k;},"3.5.1",{requires:["plugin"]});
 
 
b'\\ No newline at end of file'