scrollable.js 20.4 KB
//>>built
define("dojo/_base/kernel dojo/_base/connect dojo/_base/event dojo/_base/lang dojo/_base/window dojo/dom-class dojo/dom-construct dojo/dom-style dojo/dom-geometry dojo/touch dijit/registry dijit/form/_TextBoxMixin ./sniff ./_css3 ./_maskUtils ./common dojo/_base/declare dojo/has!dojo-bidi?dojox/mobile/bidi/Scrollable".split(" "),function(t,q,u,w,g,m,v,k,x,y,A,B,h,f,z,C,D,E){var n=w.getObject("dojox.mobile",!0);h.add("translate3d",function(){if(h("css3-animations")){var a=g.doc.createElement("div");
a.style[f.name("transform")]="translate3d(0px,1px,0px)";g.doc.documentElement.appendChild(a);var b=g.doc.defaultView.getComputedStyle(a,"")[f.name("transform",!0)],b=b&&0===b.indexOf("matrix");g.doc.documentElement.removeChild(a);return b}});var r=function(){};w.extend(r,{fixedHeaderHeight:0,fixedFooterHeight:0,isLocalFooter:!1,scrollBar:!0,scrollDir:"v",weight:.6,fadeScrollBar:!0,disableFlashScrollBar:!1,threshold:4,constraint:!0,touchNode:null,propagatable:!0,dirLock:!1,height:"",scrollType:0,_parentPadBorderExtentsBottom:0,
_moved:!1,init:function(a){if(a)for(var b in a)a.hasOwnProperty(b)&&(this[b]="domNode"!=b&&"containerNode"!=b||"string"!=typeof a[b]?a[b]:g.doc.getElementById(a[b]));C._setTouchAction(this.domNode,"none");this.touchNode=this.touchNode||this.containerNode;this._v=-1!=this.scrollDir.indexOf("v");this._h=-1!=this.scrollDir.indexOf("h");this._f="f"==this.scrollDir;this._ch=[];this._ch.push(q.connect(this.touchNode,y.press,this,"onTouchStart"));if(h("css3-animations"))if(this._useTopLeft=this.scrollType?
2===this.scrollType:!1,this._useTopLeft||(this._useTransformTransition=this.scrollType?3===this.scrollType:6<=h("ios")||0||0),this._useTopLeft)this._ch.push(q.connect(this.containerNode,f.name("transitionEnd"),this,"onFlickAnimationEnd"));else{if(this._useTransformTransition)this._ch.push(q.connect(this.containerNode,f.name("transitionEnd"),this,"onFlickAnimationEnd"));else for(this._ch.push(q.connect(this.containerNode,f.name("animationEnd"),this,"onFlickAnimationEnd")),this._ch.push(q.connect(this.containerNode,
f.name("animationStart"),this,"onFlickAnimationStart")),a=0;3>a;a++)this.setKeyframes(null,null,a);h("translate3d")&&k.set(this.containerNode,f.name("transform"),"translate3d(0,0,0)")}this._speed={x:0,y:0};this._appFooterHeight=0;this.isTopLevel()&&!this.noResize&&this.resize();var c=this;setTimeout(function(){c.flashScrollBar()},600);g.global.addEventListener&&(this._onScroll=function(a){if(c.domNode&&"none"!==c.domNode.style.display){a=c.domNode.scrollTop;var b=c.domNode.scrollLeft,d;if(0<a||0<
b)d=c.getPos(),c.domNode.scrollLeft=0,c.domNode.scrollTop=0,c.scrollTo({x:d.x-b,y:d.y-a})}},g.global.addEventListener("scroll",this._onScroll,!0));!this.disableTouchScroll&&this.domNode.addEventListener&&(this._onFocusScroll=function(a){if(c.domNode&&"none"!==c.domNode.style.display){a=g.doc.activeElement;var b,d;a&&(b=a.getBoundingClientRect(),d=c.domNode.getBoundingClientRect(),b.height<c.getDim().d.h&&(b.top<d.top+c.fixedHeaderHeight?c.scrollIntoView(a,!0):b.top+b.height>d.top+d.height-c.fixedFooterHeight&&
c.scrollIntoView(a,!1)))}},this.domNode.addEventListener("focus",this._onFocusScroll,!0))},isTopLevel:function(){return!0},cleanup:function(){if(this._ch){for(var a=0;a<this._ch.length;a++)q.disconnect(this._ch[a]);this._ch=null}this._onScroll&&g.global.removeEventListener&&(g.global.removeEventListener("scroll",this._onScroll,!0),this._onScroll=null);this._onFocusScroll&&this.domNode.removeEventListener&&(this.domNode.removeEventListener("focus",this._onFocusScroll,!0),this._onFocusScroll=null)},
findDisp:function(a){if(!a.parentNode)return null;if(1===a.nodeType&&m.contains(a,"mblSwapView")&&"none"!==a.style.display)return a;for(var b=a.parentNode.childNodes,c=0;c<b.length;c++){var d=b[c];if(1===d.nodeType&&m.contains(d,"mblView")&&"none"!==d.style.display)return d}return a},getScreenSize:function(){return{h:g.global.innerHeight||g.doc.documentElement.clientHeight||g.doc.documentElement.offsetHeight,w:g.global.innerWidth||g.doc.documentElement.clientWidth||g.doc.documentElement.offsetWidth}},
resize:function(a){this._appFooterHeight=this._fixedAppFooter?this._fixedAppFooter.offsetHeight:0;this.isLocalHeader&&(this.containerNode.style.marginTop=this.fixedHeaderHeight+"px");var b=0;for(a=this.domNode;a&&"BODY"!=a.tagName;a=a.offsetParent){a=this.findDisp(a);if(!a)break;b+=a.offsetTop+x.getBorderExtents(a).h}var c;a=this.getScreenSize().h;b=a-b-this._appFooterHeight;if("inherit"===this.height)this.domNode.offsetParent&&(c=x.getContentBox(this.domNode.offsetParent).h-x.getBorderExtents(this.domNode).h+
"px");else if("auto"===this.height){if(c=this.domNode.offsetParent){this.domNode.style.height="0px";c=c.getBoundingClientRect();var b=this.domNode.getBoundingClientRect(),d=c.bottom-this._appFooterHeight-this._parentPadBorderExtentsBottom,b=b.bottom>=d?a-(b.top-c.top)-this._appFooterHeight-this._parentPadBorderExtentsBottom:d-b.bottom}a=Math.max(this.domNode.scrollHeight,this.containerNode.scrollHeight);c=(a?Math.min(a,b):b)+"px"}else this.height&&(c=this.height);c||(c=b+"px");"-"!==c.charAt(0)&&
"default"!==c&&(this.domNode.style.height=c);if(!this._conn)this.onTouchEnd()},onFlickAnimationStart:function(a){a&&u.stop(a)},onFlickAnimationEnd:function(a){h("ios")&&this._keepInputCaretInActiveElement();if(a){var b=a.animationName;if(b&&-1===b.indexOf("scrollableViewScroll2")){-1!==b.indexOf("scrollableViewScroll0")?this._scrollBarNodeV&&m.remove(this._scrollBarNodeV,"mblScrollableScrollTo0"):-1!==b.indexOf("scrollableViewScroll1")?this._scrollBarNodeH&&m.remove(this._scrollBarNodeH,"mblScrollableScrollTo1"):
(this._scrollBarNodeV&&(this._scrollBarNodeV.className=""),this._scrollBarNodeH&&(this._scrollBarNodeH.className=""));return}if(this._useTransformTransition||this._useTopLeft)if(b=a.target,b===this._scrollBarV||b===this._scrollBarH){a="mblScrollableScrollTo"+(b===this._scrollBarV?"0":"1");m.contains(b,a)?m.remove(b,a):b.className="";return}a.srcElement&&u.stop(a)}this.stopAnimation();if(this._bounce){var c=this,d=c._bounce;setTimeout(function(){c.slideTo(d,.3,"ease-out")},0);c._bounce=void 0}else this.hideScrollBar(),
this.removeCover()},isFormElement:function(a){a&&1!==a.nodeType&&(a=a.parentNode);if(!a||1!==a.nodeType)return!1;a=a.tagName;return"SELECT"===a||"INPUT"===a||"TEXTAREA"===a||"BUTTON"===a},onTouchStart:function(a){this.disableTouchScroll||this._conn&&500>(new Date).getTime()-this.startTime||(this._conn||(this._conn=[],this._conn.push(q.connect(g.doc,y.move,this,"onTouchMove")),this._conn.push(q.connect(g.doc,y.release,this,"onTouchEnd"))),this._aborted=!1,m.contains(this.containerNode,"mblScrollableScrollTo2")?
this.abort():(this._scrollBarNodeV&&(this._scrollBarNodeV.className=""),this._scrollBarNodeH&&(this._scrollBarNodeH.className="")),this.touchStartX=a.touches?a.touches[0].pageX:a.clientX,this.touchStartY=a.touches?a.touches[0].pageY:a.clientY,this.startTime=(new Date).getTime(),this.startPos=this.getPos(),this._dim=this.getDim(),this._time=[0],this._posX=[this.touchStartX],this._posY=[this.touchStartY],this._moved=this._locked=!1,this._preventDefaultInNextTouchMove=!0,this.isFormElement(a.target)||
(this.propagatable?a.preventDefault():u.stop(a),this._preventDefaultInNextTouchMove=!1))},onTouchMove:function(a){if(!this._locked){if(this._preventDefaultInNextTouchMove){this._preventDefaultInNextTouchMove=!1;var b=A.getEnclosingWidget((a.targetTouches&&1===a.targetTouches.length?a.targetTouches[0]:a).target);b&&b.isInstanceOf(B)&&(this.propagatable?a.preventDefault():u.stop(a))}b=a.touches?a.touches[0].pageX:a.clientX;a=a.touches?a.touches[0].pageY:a.clientY;var c=b-this.touchStartX,d=a-this.touchStartY,
e={x:this.startPos.x+c,y:this.startPos.y+d},f=this._dim,c=Math.abs(c),d=Math.abs(d);if(1==this._time.length){if(this.dirLock&&(this._v&&!this._h&&c>=this.threshold&&c>=d||(this._h||this._f)&&!this._v&&d>=this.threshold&&d>=c)){this._locked=!0;return}if(this._v&&this._h){if(d<this.threshold&&c<this.threshold)return}else if(this._v&&d<this.threshold||(this._h||this._f)&&c<this.threshold)return;this._moved=!0;this.addCover();this.showScrollBar()}c=this.weight;this._v&&this.constraint&&(0<e.y?e.y=Math.round(e.y*
c):e.y<-f.o.h&&(e.y=f.c.h<f.d.h?Math.round(e.y*c):-f.o.h-Math.round((-f.o.h-e.y)*c)));(this._h||this._f)&&this.constraint&&(0<e.x?e.x=Math.round(e.x*c):e.x<-f.o.w&&(e.x=f.c.w<f.d.w?Math.round(e.x*c):-f.o.w-Math.round((-f.o.w-e.x)*c)));this.scrollTo(e);e=this._time.length;if(2<=e){this._moved=!0;var l,h;this._v&&!this._h?(l=this._posY[e-1]-this._posY[e-2],h=a-this._posY[e-1]):!this._v&&this._h&&(l=this._posX[e-1]-this._posX[e-2],h=b-this._posX[e-1]);0>l*h&&(this._time=[this._time[e-1]],this._posX=
[this._posX[e-1]],this._posY=[this._posY[e-1]],e=1)}10==e&&(this._time.shift(),this._posX.shift(),this._posY.shift());this._time.push((new Date).getTime()-this.startTime);this._posX.push(b);this._posY.push(a)}},_keepInputCaretInActiveElement:function(){var a=g.doc.activeElement,b;!a||"INPUT"!=a.tagName&&"TEXTAREA"!=a.tagName||(b=a.value,a.value="number"==a.type||"week"==a.type?b?a.value+1:"week"==a.type?"2013-W10":1:a.value+" ",a.value=b)},onTouchEnd:function(a){if(!this._locked){var b=this._speed=
{x:0,y:0},c=this._dim,d=this.getPos(),e={};if(a){if(!this._conn)return;for(b=0;b<this._conn.length;b++)q.disconnect(this._conn[b]);this._conn=null;b=!1;this._aborted||this._moved||(b=!0);if(b){this.hideScrollBar();this.removeCover();if(h("touch")&&h("clicks-prevented")&&!this.isFormElement(a.target)){var f=a.target;1!=f.nodeType&&(f=f.parentNode);setTimeout(function(){n._sendClick(f,a)})}return}b=this._speed=this.getSpeed()}else{if(0==d.x&&0==d.y)return;c=this.getDim()}this._v&&(e.y=d.y+b.y);if(this._h||
this._f)e.x=d.x+b.x;if(!1!==this.adjustDestination(e,d,c)){if(this.constraint){if("v"==this.scrollDir&&c.c.h<c.d.h){this.slideTo({y:0},.3,"ease-out");return}if("h"==this.scrollDir&&c.c.w<c.d.w){this.slideTo({x:0},.3,"ease-out");return}if(this._v&&this._h&&c.c.h<c.d.h&&c.c.w<c.d.w){this.slideTo({x:0,y:0},.3,"ease-out");return}}var l,g="ease-out",p={};this._v&&this.constraint&&(0<e.y?0<d.y?(l=.3,e.y=0):(e.y=Math.min(e.y,20),g="linear",p.y=0):-b.y>c.o.h- -d.y&&(d.y<-c.o.h?(l=.3,e.y=c.c.h<=c.d.h?0:-c.o.h):
(e.y=Math.max(e.y,-c.o.h-20),g="linear",p.y=-c.o.h)));(this._h||this._f)&&this.constraint&&(0<e.x?0<d.x?(l=.3,e.x=0):(e.x=Math.min(e.x,20),g="linear",p.x=0):-b.x>c.o.w- -d.x&&(d.x<-c.o.w?(l=.3,e.x=c.c.w<=c.d.w?0:-c.o.w):(e.x=Math.max(e.x,-c.o.w-20),g="linear",p.x=-c.o.w)));this._bounce=void 0!==p.x||void 0!==p.y?p:void 0;if(void 0===l){var k,m;this._v&&this._h?(m=Math.sqrt(b.x*b.x+b.y*b.y),k=Math.sqrt(Math.pow(e.y-d.y,2)+Math.pow(e.x-d.x,2))):this._v?(m=b.y,k=e.y-d.y):this._h&&(m=b.x,k=e.x-d.x);if(0===
k&&!a)return;l=0!==m?Math.abs(k/m):.01}this.slideTo(e,l,g)}}},adjustDestination:function(a,b,c){return!0},abort:function(){this._aborted=!0;this.scrollTo(this.getPos());this.stopAnimation()},stopAnimation:function(){m.remove(this.containerNode,"mblScrollableScrollTo2");this.containerNode.className=this.containerNode.className.replace(/mblScrollableScrollTo2-[^ ]+/,"");this._scrollBarV&&(this._scrollBarV.className="");this._scrollBarH&&(this._scrollBarH.className="");if(this._useTransformTransition||
this._useTopLeft)this.containerNode.style[f.name("transition")]="",this._scrollBarV&&(this._scrollBarV.style[f.name("transition")]=""),this._scrollBarH&&(this._scrollBarH.style[f.name("transition")]="")},scrollIntoView:function(a,b,c){if(this._v){for(var d=this.containerNode,e=this.getDim().d.h,f=0,l=a;l!==d;l=l.offsetParent){if(!l||"BODY"===l.tagName)return;f+=l.offsetTop}a=b?Math.max(e-d.offsetHeight,-f):Math.min(0,e-f-a.offsetHeight);c&&"number"===typeof c?this.slideTo({y:a},c,"ease-out"):this.scrollTo({y:a})}},
getSpeed:function(){var a=0,b=0,c=this._time.length;if(2<=c&&500>(new Date).getTime()-this.startTime-this._time[c-1])var a=this._posX[c-(3<c?2:1)]-this._posX[0<=c-6?c-6:0],d=this._time[c-(3<c?2:1)]-this._time[0<=c-6?c-6:0],b=this.calcSpeed(this._posY[c-(3<c?2:1)]-this._posY[0<=c-6?c-6:0],d),a=this.calcSpeed(a,d);return{x:a,y:b}},calcSpeed:function(a,b){return 4*Math.round(a/b*100)},scrollTo:function(a,b,c){var d,e;e=!0;!this._aborted&&this._conn&&(this._dim||(this._dim=this.getDim()),d=0<a.y?a.y:
0,e=0>this._dim.o.h+a.y?-1*(this._dim.o.h+a.y):0,d={bubbles:!1,cancelable:!1,x:a.x,y:a.y,beforeTop:0<d,beforeTopHeight:d,afterBottom:0<e,afterBottomHeight:e},e=this.onBeforeScroll(d));if(e){c=(c||this.containerNode).style;if(h("css3-animations"))if(this._useTopLeft){if(c[f.name("transition")]="",this._v&&(c.top=a.y+"px"),this._h||this._f)c.left=a.x+"px"}else this._useTransformTransition&&(c[f.name("transition")]=""),c[f.name("transform")]=this.makeTranslateStr(a);else if(this._v&&(c.top=a.y+"px"),
this._h||this._f)c.left=a.x+"px";h("ios")&&this._keepInputCaretInActiveElement();b||this.scrollScrollBarTo(this.calcScrollBarPos(a));if(d)this.onAfterScroll(d)}},onBeforeScroll:function(a){return!0},onAfterScroll:function(a){},slideTo:function(a,b,c){this._runSlideAnimation(this.getPos(),a,b,c,this.containerNode,2);this.slideScrollBarTo(a,b,c)},makeTranslateStr:function(a){var b=this._v&&"number"==typeof a.y?a.y+"px":"0px";a=(this._h||this._f)&&"number"==typeof a.x?a.x+"px":"0px";return h("translate3d")?
"translate3d("+a+","+b+",0px)":"translate("+a+","+b+")"},getPos:function(){if(h("css3-animations")){var a=g.doc.defaultView.getComputedStyle(this.containerNode,"");if(this._useTopLeft)return{x:parseInt(a.left)||0,y:parseInt(a.top)||0};var b=a[f.name("transform")];return b&&0===b.indexOf("matrix")?(a=b.split(/[,\s\)]+/),b=0===b.indexOf("matrix3d")?12:4,{y:a[b+1]-0,x:a[b]-0}):{x:0,y:0}}return{y:parseInt(this.containerNode.style.top)||0,x:this.containerNode.offsetLeft}},getDim:function(){var a={};a.c=
{h:this.containerNode.offsetHeight,w:this.containerNode.offsetWidth};a.v={h:this.domNode.offsetHeight+this._appFooterHeight,w:this.domNode.offsetWidth};a.d={h:a.v.h-this.fixedHeaderHeight-this.fixedFooterHeight-this._appFooterHeight,w:a.v.w};a.o={h:a.c.h-a.v.h+this.fixedHeaderHeight+this.fixedFooterHeight+this._appFooterHeight,w:a.c.w-a.v.w};return a},showScrollBar:function(){if(this.scrollBar){var a=this._dim;"v"==this.scrollDir&&a.c.h<=a.d.h||"h"==this.scrollDir&&a.c.w<=a.d.w||this._v&&this._h&&
a.c.h<=a.d.h&&a.c.w<=a.d.w||(a=function(a,c){var b=a["_scrollBarNode"+c];if(!b){var b=v.create("div",null,a.domNode),e={position:"absolute",overflow:"hidden"};"V"==c?(e.right="2px",e.width="5px"):(e.bottom=(a.isLocalFooter?a.fixedFooterHeight:0)+2+"px",e.height="5px");k.set(b,e);b.className="mblScrollBarWrapper";a["_scrollBarWrapper"+c]=b;b=v.create("div",null,b);k.set(b,f.add({opacity:.6,position:"absolute",backgroundColor:"#606060",fontSize:"1px",MozBorderRadius:"2px",zIndex:2147483647},{borderRadius:"2px",
transformOrigin:"0 0"}));k.set(b,"V"==c?{width:"5px"}:{height:"5px"});a["_scrollBarNode"+c]=b}return b},this._v&&!this._scrollBarV&&(this._scrollBarV=a(this,"V")),this._h&&!this._scrollBarH&&(this._scrollBarH=a(this,"H")),this.resetScrollBar())}},hideScrollBar:function(){if(this.fadeScrollBar&&h("css3-animations")&&!n._fadeRule){var a=v.create("style",null,g.doc.getElementsByTagName("head")[0]);a.textContent=".mblScrollableFadeScrollBar{  "+f.name("animation-duration",!0)+": 1s;  "+f.name("animation-name",
!0)+": scrollableViewFadeScrollBar;}@"+f.name("keyframes",!0)+" scrollableViewFadeScrollBar{  from { opacity: 0.6; }  to { opacity: 0; }}";n._fadeRule=a.sheet.cssRules[1]}this.scrollBar&&(a=function(a,c){k.set(a,f.add({opacity:0},{animationDuration:""}));a.className="mblScrollableFadeScrollBar"},this._scrollBarV&&(a(this._scrollBarV,this),this._scrollBarV=null),this._scrollBarH&&(a(this._scrollBarH,this),this._scrollBarH=null))},calcScrollBarPos:function(a){var b={},c=this._dim,d=function(a,b,c,d,
f){c=Math.round((d-b-8)/(d-f)*c);c<-b+5&&(c=-b+5);c>a-5&&(c=a-5);return c};"number"==typeof a.y&&this._scrollBarV&&(b.y=d(this._scrollBarWrapperV.offsetHeight,this._scrollBarV.offsetHeight,a.y,c.d.h,c.c.h));"number"==typeof a.x&&this._scrollBarH&&(b.x=d(this._scrollBarWrapperH.offsetWidth,this._scrollBarH.offsetWidth,a.x,c.d.w,c.c.w));return b},scrollScrollBarTo:function(a){this.scrollBar&&(this._v&&this._scrollBarV&&"number"==typeof a.y&&(h("css3-animations")?this._useTopLeft?k.set(this._scrollBarV,
f.add({top:a.y+"px"},{transition:""})):(this._useTransformTransition&&(this._scrollBarV.style[f.name("transition")]=""),this._scrollBarV.style[f.name("transform")]=this.makeTranslateStr({y:a.y})):this._scrollBarV.style.top=a.y+"px"),this._h&&this._scrollBarH&&"number"==typeof a.x&&(h("css3-animations")?this._useTopLeft?k.set(this._scrollBarH,f.add({left:a.x+"px"},{transition:""})):(this._useTransformTransition&&(this._scrollBarH.style[f.name("transition")]=""),this._scrollBarH.style[f.name("transform")]=
this.makeTranslateStr({x:a.x})):this._scrollBarH.style.left=a.x+"px"))},slideScrollBarTo:function(a,b,c){if(this.scrollBar){var d=this.calcScrollBarPos(this.getPos());a=this.calcScrollBarPos(a);this._v&&this._scrollBarV&&this._runSlideAnimation({y:d.y},{y:a.y},b,c,this._scrollBarV,0);this._h&&this._scrollBarH&&this._runSlideAnimation({x:d.x},{x:a.x},b,c,this._scrollBarH,1)}},_runSlideAnimation:function(a,b,c,d,e,g){if(h("css3-animations"))if(!this._useTopLeft)if(this._useTransformTransition)if(void 0===
b.x&&(b.x=a.x),void 0===b.y&&(b.y=a.y),b.x!==a.x||b.y!==a.y){this.onFlickAnimationStart();k.set(e,f.add({},{transitionProperty:f.name("transform"),transitionDuration:c+"s",transitionTimingFunction:d}));var l=this.makeTranslateStr(b);setTimeout(function(){k.set(e,f.add({},{transform:l}))},0);m.add(e,"mblScrollableScrollTo"+g)}else this.hideScrollBar(),this.removeCover();else{var n=this.findDisp(this.domNode)===this.domNode;a=this.setKeyframes(a,b,g,n);k.set(e,f.add({},{animationDuration:c+"s",animationTimingFunction:d}));
m.add(e,a);m.add(e,"mblScrollableScrollTo"+g);2==g?this.scrollTo(b,!0,e):this.scrollScrollBarTo(b)}else{if(void 0!==b.x||void 0!==b.y)this.onFlickAnimationStart(),k.set(e,f.add({},{transitionProperty:void 0!==b.x&&void 0!==b.y?"top, left":void 0!==b.y?"top":"left",transitionDuration:c+"s",transitionTimingFunction:d})),setTimeout(function(){var a={};void 0!==b.x&&(a.left=b.x+"px");void 0!==b.y&&(a.top=b.y+"px");k.set(e,a)},0),m.add(e,"mblScrollableScrollTo"+g)}else if(t.fx&&t.fx.easing&&c){var p=this;
t.fx.slideTo({node:e,duration:1E3*c,left:b.x,top:b.y,easing:"ease-out"==d?t.fx.easing.quadOut:t.fx.easing.linear,onBegin:function(){if(2==g)p.onFlickAnimationStart()},onEnd:function(){if(2==g)p.onFlickAnimationEnd()}}).play()}else 2==g?(this.onFlickAnimationStart(),this.scrollTo(b,!1,e),this.onFlickAnimationEnd()):this.scrollScrollBarTo(b)},resetScrollBar:function(){var a=function(a,b,e,f,g,h){if(b){var c={};c[h?"top":"left"]=g+4+"px";g=0>=e-8?1:e-8;c[h?"height":"width"]=g+"px";k.set(a,c);a=Math.round(e*
e/f);a=Math.min(Math.max(a-8,5),g);b.style[h?"height":"width"]=a+"px";k.set(b,{opacity:.6})}},b=this.getDim();a(this._scrollBarWrapperV,this._scrollBarV,b.d.h,b.c.h,this.fixedHeaderHeight,!0);a(this._scrollBarWrapperH,this._scrollBarH,b.d.w,b.c.w,0);this.createMask()},createMask:function(){h("mask-image")&&(this._scrollBarWrapperV&&z.createRoundMask(this._scrollBarWrapperV,0,0,0,0,5,this._scrollBarWrapperV.offsetHeight,2,2,.5),this._scrollBarWrapperH&&z.createRoundMask(this._scrollBarWrapperH,0,0,
0,0,this._scrollBarWrapperH.offsetWidth,5,2,2,.5))},flashScrollBar:function(){if(!this.disableFlashScrollBar&&this.domNode&&(this._dim=this.getDim(),!(0>=this._dim.d.h))){this.showScrollBar();var a=this;setTimeout(function(){a.hideScrollBar()},300)}},addCover:function(){h("touch")},removeCover:function(){!h("touch")&&n._cover&&(n._cover.style.display="none",this.setSelectable(n._cover,!0),this.setSelectable(this.domNode,!0))},setKeyframes:function(a,b,c,d){n._rule||(n._rule=[]);c+=d?"-in":"-out";
n._rule[c]||(d=v.create("style",null,g.doc.getElementsByTagName("head")[0]),d.textContent=".mblScrollableScrollTo"+c+"{"+f.name("animation-name",!0)+": scrollableViewScroll"+c+";}@"+f.name("keyframes",!0)+" scrollableViewScroll"+c+"{}",n._rule[c]=d.sheet.cssRules[1]);if(d=n._rule[c])a&&(d.deleteRule(h("webkit")?"from":0),(d.insertRule||d.appendRule).call(d,"from { "+f.name("transform",!0)+": "+this.makeTranslateStr(a)+"; }")),b&&(void 0===b.x&&(b.x=a.x),void 0===b.y&&(b.y=a.y),d.deleteRule(h("webkit")?
"to":1),(d.insertRule||d.appendRule).call(d,"to { "+f.name("transform",!0)+": "+this.makeTranslateStr(b)+"; }"));return"mblScrollableScrollTo"+c},setSelectable:function(a,b){a.style.KhtmlUserSelect=b?"auto":"none";a.style.MozUserSelect=b?"":"none";a.onselectstart=b?null:function(){return!1};if(h("ie")){a.unselectable=b?"":"on";a=a.getElementsByTagName("*");for(var c=0;c<a.length;c++)a[c].unselectable=b?"":"on"}}});r=h("dojo-bidi")?D("dojox.mobile.Scrollable",[r,E]):r;w.setObject("dojox.mobile.scrollable",
r);return r});