From 809e9adfb9d0b2e06463f22d54fc189e81f3d704 Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Mon, 21 Jan 2019 13:42:58 +0800 Subject: [PATCH] build --- dist/bscroll.esm.js | 8 ++++---- dist/bscroll.js | 8 ++++---- dist/bscroll.min.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/bscroll.esm.js b/dist/bscroll.esm.js index 2d3989b5..7cdc3649 100644 --- a/dist/bscroll.esm.js +++ b/dist/bscroll.esm.js @@ -1,5 +1,5 @@ /*! - * better-normal-scroll v1.14.0 + * better-normal-scroll v1.14.1 * (c) 2016-2019 ustbhuangyi * Released under the MIT License. */ @@ -2082,8 +2082,8 @@ function wheelMixin(BScroll) { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; if (this.options.wheel) { - this.y = -index * this.itemHeight; - this.scrollTo(0, this.y); + var y = -index * this.itemHeight; + this.scrollTo(0, y); } }; @@ -3391,6 +3391,6 @@ mouseWheelMixin(BScroll); zoomMixin(BScroll); infiniteMixin(BScroll); -BScroll.Version = '1.14.0'; +BScroll.Version = '1.14.1'; export default BScroll; diff --git a/dist/bscroll.js b/dist/bscroll.js index 6f279193..7b8c8a19 100644 --- a/dist/bscroll.js +++ b/dist/bscroll.js @@ -1,5 +1,5 @@ /*! - * better-normal-scroll v1.14.0 + * better-normal-scroll v1.14.1 * (c) 2016-2019 ustbhuangyi * Released under the MIT License. */ @@ -2088,8 +2088,8 @@ function wheelMixin(BScroll) { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; if (this.options.wheel) { - this.y = -index * this.itemHeight; - this.scrollTo(0, this.y); + var y = -index * this.itemHeight; + this.scrollTo(0, y); } }; @@ -3397,7 +3397,7 @@ mouseWheelMixin(BScroll); zoomMixin(BScroll); infiniteMixin(BScroll); -BScroll.Version = '1.14.0'; +BScroll.Version = '1.14.1'; return BScroll; diff --git a/dist/bscroll.min.js b/dist/bscroll.min.js index bf4b063e..42d9fbeb 100644 --- a/dist/bscroll.min.js +++ b/dist/bscroll.min.js @@ -1,6 +1,6 @@ /*! - * better-normal-scroll v1.14.0 + * better-normal-scroll v1.14.1 * (c) 2016-2019 ustbhuangyi * Released under the MIT License. */ -!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.BScroll=i()}(this,function(){"use strict";function o(t,i){for(;i+1this.maxPosY){this.transitionTime(500);var e=Math.max(this.indicatorHeight-3*(t-this.maxPosY),8);this.indicatorStyle.height=e+"px",t=this.maxPosY+this.indicatorHeight-e}else this.indicatorStyle.height=this.indicatorHeight+"px";this.y=t,this.scroller.options.useTransform?this.indicatorStyle[_.transform]="translateY("+t+"px)"+this.scroller.translateZ:this.indicatorStyle.top=t+"px"}else{var s=Math.round(this.sizeRatioX*this.scroller.x);if(s<0){this.transitionTime(500);var o=Math.max(this.indicatorWidth+3*s,8);this.indicatorStyle.width=o+"px",s=0}else if(s>this.maxPosX){this.transitionTime(500);var n=Math.max(this.indicatorWidth-3*(s-this.maxPosX),8);this.indicatorStyle.width=n+"px",s=this.maxPosX+this.indicatorWidth-n}else this.indicatorStyle.width=this.indicatorWidth+"px";this.x=s,this.scroller.options.useTransform?this.indicatorStyle[_.transform]="translateX("+s+"px)"+this.scroller.translateZ:this.indicatorStyle.left=s+"px"}},L.prototype.transitionTime=function(){var t=0this.maxPosX&&(t=this.maxPosX),i<0?i=0:i>this.maxPosY&&(i=this.maxPosY),t=Math.round(t/this.sizeRatioX),i=Math.round(i/this.sizeRatioY),this.scroller.scrollTo(t,i),this.scroller.trigger("scroll",{x:this.scroller.x,y:this.scroller.y})},L.prototype._shouldShow=function(){return"vertical"===this.direction&&this.scroller.hasVerticalScroll||"horizontal"===this.direction&&this.scroller.hasHorizontalScroll?!(this.wrapper.style.display=""):!(this.wrapper.style.display="none")},L.prototype._calculate=function(){if("vertical"===this.direction){var t=this.wrapper.clientHeight;this.indicatorHeight=Math.max(Math.round(t*t/(this.scroller.scrollerHeight||t||1)),8),this.indicatorStyle.height=this.indicatorHeight+"px",this.maxPosY=t-this.indicatorHeight,this.sizeRatioY=this.maxPosY/this.scroller.maxScrollY}else{var i=this.wrapper.clientWidth;this.indicatorWidth=Math.max(Math.round(i*i/(this.scroller.scrollerWidth||i||1)),8),this.indicatorStyle.width=this.indicatorWidth+"px",this.maxPosX=i-this.indicatorWidth,this.sizeRatioX=this.maxPosX/this.scroller.maxScrollX}},L.prototype._addDOMEvents=function(){var t=p;this._handleDOMEvents(t)},L.prototype._removeDOMEvents=function(){var t=u;this._handleDOMEvents(t),this._handleMoveEvents(t)},L.prototype._handleMoveEvents=function(t){this.scroller.options.disableTouch||t(window,"touchmove",this),this.scroller.options.disableMouse||t(window,"mousemove",this)},L.prototype._handleDOMEvents=function(t){this.scroller.options.disableTouch||(t(this.indicator,"touchstart",this),t(window,"touchend",this)),this.scroller.options.disableMouse||(t(this.indicator,"mousedown",this),t(window,"mouseup",this))};var R,F,U,N,B,q,V,Z,j,G;function $(t){if(t&&t.classList)return t.classList.contains("tombstone")}function J(t,i){var e=this;this.options=i,C("function"==typeof this.options.createTombstone,"Infinite scroll need createTombstone Function to create tombstone"),C("function"==typeof this.options.fetch,"Infinite scroll need fetch Function to fetch new data."),C("function"==typeof this.options.render,"Infinite scroll need render Function to render each item."),this.firstAttachedItem=0,this.lastAttachedItem=0,this.anchorScrollTop=0,this.anchorItem={index:0,offset:0},this.tombstoneHeight=0,this.tombstoneWidth=0,this.tombstones=[],this.tombstonesAnimationHandlers=[],this.items=[],this.loadedItems=0,this.requestInProgress=!1,this.hasMore=!0,this.scroller=t,this.wrapperEl=this.scroller.wrapper,this.scrollerEl=this.scroller.scroller,this.scroller.on("scroll",function(){e.onScroll()}),this.scroller.on("resize",function(){e.onResize()}),this.scroller.on("destroy",function(){e.destroy()}),this._onResizeHandler=setTimeout(function(){e.onResize()})}function K(t,i){this.wrapper="string"==typeof t?document.querySelector(t):t,this.wrapper||A("Can not resolve the wrapper DOM."),this.scroller=this.wrapper.children[0],this.scroller||A("The wrapper need at least one child element to be scroller."),this.scrollerStyle=this.scroller.style,this._init(i)}return J.prototype.destroy=function(){var i=this;clearTimeout(this._onResizeHandler),this.tombstonesAnimationHandlers.forEach(function(t){clearTimeout(t)}),this.tombstonesAnimationHandlers=null,this.items.forEach(function(t){t.node&&(i.scrollerEl.removeChild(t.node),t.node=null)}),this.scroller.infiniteScroller=null,this.scroller=null,this.wrapperEl=null,this.scrollerEl=null,this.items=null,this.tombstones=null},J.prototype.onScroll=function(){var t=-this.scroller.y,i=t-this.anchorScrollTop;this.anchorItem=0===t?{index:0,offset:0}:this._calculateAnchoredItem(this.anchorItem,i),this.anchorScrollTop=t;var e=this._calculateAnchoredItem(this.anchorItem,this.scroller.wrapperHeight),s=this.anchorItem.index,o=e.index;i<0?(s-=30,o+=10):(s-=10,o+=30),this.fill(s,o),this.maybeRequestContent()},J.prototype.onResize=function(){var t=this.options.createTombstone();t.style.position="absolute",this.scrollerEl.appendChild(t),t.style.display="",this.tombstoneHeight=t.offsetHeight,this.tombstoneWidth=t.offsetWidth,this.scrollerEl.removeChild(t);for(var i=0;ithis.firstAttachedItem;)i-=this.items[e-1].height||this.tombstoneHeight,e--;return i},J.prototype._setupAnimations=function(e,t){var s=this;for(var i in e){var o=e[i];this.items[i].node.style[_.transform]="translateY("+(this.anchorScrollTop+o[1])+"px) scale("+this.tombstoneWidth/this.items[i].width+", "+this.tombstoneHeight/this.items[i].height+")",this.items[i].node.offsetTop,o[0].offsetTop,this.items[i].node.style[_.transition]=g+"transform 200ms"}for(var n=this.firstAttachedItem;n=this.items.length||!this.items[e].height)&&(s=Math.floor(Math.max(i,0)/this.tombstoneHeight))}return{index:e+=s,offset:i-=s*this.tombstoneHeight}},(R=K).prototype._init=function(t){this._handleOptions(t),this._events={},this.x=0,this.y=0,this.directionX=0,this.directionY=0,this.setScale(1),this._addDOMEvents(),this._initExtFeatures(),this._watchTransition(),this.options.observeDOM&&this._initDOMObserver(),this.options.autoBlur&&this._handleAutoBlur(),this.refresh(),this.options.snap||this.scrollTo(this.options.startX,this.options.startY),this.enable()},R.prototype.setScale=function(t){this.lastScale=c(this.scale)?t:this.scale,this.scale=t},R.prototype._handleOptions=function(t){this.options=a({},D,t),this.translateZ=this.options.HWCompositing&&x?" translateZ(0)":"",this.options.useTransition=this.options.useTransition&&b,this.options.useTransform=this.options.useTransform&&S,this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault,this.options.scrollX="horizontal"!==this.options.eventPassthrough&&this.options.scrollX,this.options.scrollY="vertical"!==this.options.eventPassthrough&&this.options.scrollY,this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough,this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold,!0===this.options.tap&&(this.options.tap="tap")},R.prototype._addDOMEvents=function(){var t=p;this._handleDOMEvents(t)},R.prototype._removeDOMEvents=function(){var t=u;this._handleDOMEvents(t)},R.prototype._handleDOMEvents=function(t){var i=this.options.bindToWrapper?this.wrapper:window;t(window,"orientationchange",this),t(window,"resize",this),this.options.click&&t(this.wrapper,"click",this,!0),this.options.disableMouse||(t(this.wrapper,"mousedown",this),t(i,"mousemove",this),t(i,"mousecancel",this),t(i,"mouseup",this)),T&&!this.options.disableTouch&&(t(this.wrapper,"touchstart",this),t(i,"touchmove",this),t(i,"touchcancel",this),t(i,"touchend",this)),t(this.scroller,_.transitionEnd,this)},R.prototype._initExtFeatures=function(){this.options.snap&&this._initSnap(),this.options.scrollbar&&this._initScrollbar(),this.options.pullUpLoad&&this._initPullUp(),this.options.pullDownRefresh&&this._initPullDown(),this.options.wheel&&this._initWheel(),this.options.mouseWheel&&this._initMouseWheel(),this.options.zoom&&this._initZoom(),this.options.infinity&&this._initInfinite()},R.prototype._watchTransition=function(){if("function"==typeof Object.defineProperty){var o=this,n=!1,t=this.options.useTransition?"isInTransition":"isAnimating";Object.defineProperty(this,t,{get:function(){return n},set:function(t){n=t;for(var i=o.scroller.children.length?o.scroller.children:[o.scroller],e=n&&!o.pulling?"none":"auto",s=0;sthis.minScrollX||this.xthis.minScrollY||this.ythis.options.momentumLimitTime&&nn+this.options.directionLockThreshold?this.directionLocked="h":n>=o+this.options.directionLockThreshold?this.directionLocked="v":this.directionLocked="n"),"h"===this.directionLocked){if("vertical"===this.options.eventPassthrough)t.preventDefault();else if("horizontal"===this.options.eventPassthrough)return void(this.initiated=!1);s=0}else if("v"===this.directionLocked){if("horizontal"===this.options.eventPassthrough)t.preventDefault();else if("vertical"===this.options.eventPassthrough)return void(this.initiated=!1);e=0}e=this.hasHorizontalScroll?e:0,s=this.hasVerticalScroll?s:0,this.movingDirectionX=0this.minScrollX||hthis.minScrollX&&p||hthis.minScrollX?this.minScrollX:this.maxScrollX),(a>this.minScrollY||athis.minScrollY&&l||athis.minScrollY?this.minScrollY:this.maxScrollY),this.moved||(this.moved=!0,this.trigger("scrollStart")),this._translate(h,a),r-this.startTime>this.options.momentumLimitTime&&(this.startTime=r,this.startX=this.x,this.startY=this.y,1===this.options.probeType&&this.trigger("scroll",{x:this.x,y:this.y})),1document.documentElement.clientWidth-this.options.momentumLimitDistance||gdocument.documentElement.clientHeight-this.options.momentumLimitDistance)&&this._end(t)}}},F.prototype._end=function(t){if(this.enabled&&!this.destroyed&&Y[t.type]===this.initiated){this.initiated=!1,this.options.preventDefault&&!M(t.target,this.options.preventDefaultException)&&t.preventDefault(),this.options.stopPropagation&&t.stopPropagation(),this.trigger("touchEnd",{x:this.x,y:this.y}),this.isInTransition=!1;var i=Math.round(this.x),e=Math.round(this.y),s=i-this.absStartX,o=e-this.absStartY;if(this.directionX=0this.options.momentumLimitDistance||r>this.options.momentumLimitDistance)){var l=!1,c=!1,p=!1,d=!1,u=this.options.bounce;!1!==u&&(l=void 0===u.top||u.top,c=void 0===u.bottom||u.bottom,p=void 0===u.left||u.left,d=void 0===u.right||u.right);var m=-1===this.directionX&&p||1===this.directionX&&d?this.wrapperWidth:0,f=-1===this.directionY&&l||1===this.directionY&&c?this.wrapperHeight:0,g=this.hasHorizontalScroll?H(this.x,this.startX,n,this.maxScrollX,this.minScrollX,m,this.options):{destination:i,duration:0},v=this.hasVerticalScroll?H(this.y,this.startY,n,this.maxScrollY,this.minScrollY,f,this.options):{destination:e,duration:0};i=g.destination,e=v.destination,a=Math.max(g.duration,v.duration),this.isInTransition=!0}else this.options.wheel&&(e=Math.round(e/this.itemHeight)*this.itemHeight,a=this.options.wheel.adjustTime||400);var y=I.swipe;if(this.options.snap){var x=this._nearestSnap(i,e);this.currentPage=x,a=this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(i-x.x),1e3),Math.min(Math.abs(e-x.y),1e3)),300),i=x.x,e=x.y,this.directionX=0,this.directionY=0,y=this.options.snap.easing||I.bounce}if(i!==this.x||e!==this.y)return(i>this.minScrollX||ithis.minScrollY||ethis.minScrollY?this.selectedIndex=0:ithis.minScrollX?this.minScrollX:n.leftthis.minScrollY?this.minScrollY:n.topthis.minScrollX?e=this.minScrollX:sthis.minScrollY?o=this.minScrollY:nm.maxScrollX&&a++;else for(o=Math.round(t/2),n=Math.round(i/2);e>-m.scrollerWidth;){for(m.pages[r]=[],s=h=0;s>-m.scrollerHeight;)m.pages[r][h]={x:Math.max(e,m.maxScrollX),y:Math.max(s,m.maxScrollY),width:t,height:i,cx:e-o,cy:s-n},s-=i,h++;e-=t,r++}m._checkSnapLoop();var p=f._loopX?1:0,d=f._loopY?1:0;m._goToPage(m.currentPage.pageX||p,m.currentPage.pageY||d,0);var u=f.threshold;m.snapThresholdY=u%1==0?m.snapThresholdX=u:(m.snapThresholdX=Math.round(m.pages[m.currentPage.pageX][m.currentPage.pageY].width*u),Math.round(m.pages[m.currentPage.pageX][m.currentPage.pageY].height*u))}}),this.on("scrollEnd",function(){f.loop&&(f._loopX?(0===m.currentPage.pageX&&m._goToPage(m.pages.length-2,m.currentPage.pageY,0),m.currentPage.pageX===m.pages.length-1&&m._goToPage(1,m.currentPage.pageY,0)):(0===m.currentPage.pageY&&m._goToPage(m.currentPage.pageX,m.pages[0].length-2,0),m.currentPage.pageY===m.pages[0].length-1&&m._goToPage(m.currentPage.pageX,1,0)))}),!1!==f.listenFlick&&this.on("flick",function(){var t=f.speed||Math.max(Math.max(Math.min(Math.abs(m.x-m.startX),1e3),Math.min(Math.abs(m.y-m.startY),1e3)),300);m._goToPage(m.currentPage.pageX+m.directionX,m.currentPage.pageY+m.directionY,t)}),this.on("destroy",function(){if(f.loop){var t=m.scroller.children;2this.minScrollX?t=this.minScrollX:tthis.minScrollY?i=this.minScrollY:i=this.pages[e][0].cx){t=this.pages[e][0].x;break}s=this.pages[e].length;for(var o=0;o=this.pages[0][o].cy){i=this.pages[0][o].y;break}return e===this.currentPage.pageX&&((e+=this.directionX)<0?e=0:e>=this.pages.length&&(e=this.pages.length-1),t=this.pages[e][0].x),o===this.currentPage.pageY&&((o+=this.directionY)<0?o=0:o>=this.pages[0].length&&(o=this.pages[0].length-1),i=this.pages[0][o].y),{x:t,y:i,pageX:e,pageY:o}},N.prototype._goToPage=function(t){var i=1=this.pages.length?t=this.pages.length-1:t<0&&(t=0),this.pages[t])){i>=this.pages[t].length?i=this.pages[t].length-1:i<0&&(i=0);var n=this.pages[t][i].x,r=this.pages[t][i].y;e=void 0===e?o.speed||Math.max(Math.max(Math.min(Math.abs(n-this.x),1e3),Math.min(Math.abs(r-this.y),1e3)),300):e,this.currentPage={x:n,y:r,pageX:t,pageY:i},this.scrollTo(n,r,e,s)}},N.prototype.goToPage=function(t,i,e,s){var o=this.options.snap;if(o&&this.pages&&this.pages.length){if(o.loop){var n=void 0;o._loopX?((n=this.pages.length-2)<=t?t=n-1:t<0&&(t=0),t+=1):((n=this.pages[0].length-2)<=i?i=n-1:i<0&&(i=0),i+=1)}this._goToPage(t,i,e,s)}},N.prototype.next=function(t,i){if(this.options.snap){var e=this.currentPage.pageX,s=this.currentPage.pageY;++e>=this.pages.length&&this.hasVerticalScroll&&(e=0,s++),this._goToPage(e,s,t,i)}},N.prototype.prev=function(t,i){if(this.options.snap){var e=this.currentPage.pageX,s=this.currentPage.pageY;--e<0&&this.hasVerticalScroll&&(e=0,s--),this._goToPage(e,s,t,i)}},N.prototype.getCurrentPage=function(){var t=this.options.snap;return t?t.loop?t._loopX?a({},this.currentPage,{pageX:this.currentPage.pageX-1}):a({},this.currentPage,{pageY:this.currentPage.pageY-1}):this.currentPage:null},(B=K).prototype.wheelTo=function(){var t=0this.minScrollX?d=this.minScrollX:dthis.minScrollY?u=this.minScrollY:uthis.minScrollX?n=this.minScrollX:nthis.minScrollY?r=this.minScrollY:rn?n:this.scalethis.maxPosY){this.transitionTime(500);var e=Math.max(this.indicatorHeight-3*(t-this.maxPosY),8);this.indicatorStyle.height=e+"px",t=this.maxPosY+this.indicatorHeight-e}else this.indicatorStyle.height=this.indicatorHeight+"px";this.y=t,this.scroller.options.useTransform?this.indicatorStyle[_.transform]="translateY("+t+"px)"+this.scroller.translateZ:this.indicatorStyle.top=t+"px"}else{var s=Math.round(this.sizeRatioX*this.scroller.x);if(s<0){this.transitionTime(500);var o=Math.max(this.indicatorWidth+3*s,8);this.indicatorStyle.width=o+"px",s=0}else if(s>this.maxPosX){this.transitionTime(500);var n=Math.max(this.indicatorWidth-3*(s-this.maxPosX),8);this.indicatorStyle.width=n+"px",s=this.maxPosX+this.indicatorWidth-n}else this.indicatorStyle.width=this.indicatorWidth+"px";this.x=s,this.scroller.options.useTransform?this.indicatorStyle[_.transform]="translateX("+s+"px)"+this.scroller.translateZ:this.indicatorStyle.left=s+"px"}},L.prototype.transitionTime=function(){var t=0this.maxPosX&&(t=this.maxPosX),i<0?i=0:i>this.maxPosY&&(i=this.maxPosY),t=Math.round(t/this.sizeRatioX),i=Math.round(i/this.sizeRatioY),this.scroller.scrollTo(t,i),this.scroller.trigger("scroll",{x:this.scroller.x,y:this.scroller.y})},L.prototype._shouldShow=function(){return"vertical"===this.direction&&this.scroller.hasVerticalScroll||"horizontal"===this.direction&&this.scroller.hasHorizontalScroll?!(this.wrapper.style.display=""):!(this.wrapper.style.display="none")},L.prototype._calculate=function(){if("vertical"===this.direction){var t=this.wrapper.clientHeight;this.indicatorHeight=Math.max(Math.round(t*t/(this.scroller.scrollerHeight||t||1)),8),this.indicatorStyle.height=this.indicatorHeight+"px",this.maxPosY=t-this.indicatorHeight,this.sizeRatioY=this.maxPosY/this.scroller.maxScrollY}else{var i=this.wrapper.clientWidth;this.indicatorWidth=Math.max(Math.round(i*i/(this.scroller.scrollerWidth||i||1)),8),this.indicatorStyle.width=this.indicatorWidth+"px",this.maxPosX=i-this.indicatorWidth,this.sizeRatioX=this.maxPosX/this.scroller.maxScrollX}},L.prototype._addDOMEvents=function(){var t=p;this._handleDOMEvents(t)},L.prototype._removeDOMEvents=function(){var t=u;this._handleDOMEvents(t),this._handleMoveEvents(t)},L.prototype._handleMoveEvents=function(t){this.scroller.options.disableTouch||t(window,"touchmove",this),this.scroller.options.disableMouse||t(window,"mousemove",this)},L.prototype._handleDOMEvents=function(t){this.scroller.options.disableTouch||(t(this.indicator,"touchstart",this),t(window,"touchend",this)),this.scroller.options.disableMouse||(t(this.indicator,"mousedown",this),t(window,"mouseup",this))};var R,F,U,N,B,q,V,Z,j,G;function $(t){if(t&&t.classList)return t.classList.contains("tombstone")}function J(t,i){var e=this;this.options=i,C("function"==typeof this.options.createTombstone,"Infinite scroll need createTombstone Function to create tombstone"),C("function"==typeof this.options.fetch,"Infinite scroll need fetch Function to fetch new data."),C("function"==typeof this.options.render,"Infinite scroll need render Function to render each item."),this.firstAttachedItem=0,this.lastAttachedItem=0,this.anchorScrollTop=0,this.anchorItem={index:0,offset:0},this.tombstoneHeight=0,this.tombstoneWidth=0,this.tombstones=[],this.tombstonesAnimationHandlers=[],this.items=[],this.loadedItems=0,this.requestInProgress=!1,this.hasMore=!0,this.scroller=t,this.wrapperEl=this.scroller.wrapper,this.scrollerEl=this.scroller.scroller,this.scroller.on("scroll",function(){e.onScroll()}),this.scroller.on("resize",function(){e.onResize()}),this.scroller.on("destroy",function(){e.destroy()}),this._onResizeHandler=setTimeout(function(){e.onResize()})}function K(t,i){this.wrapper="string"==typeof t?document.querySelector(t):t,this.wrapper||A("Can not resolve the wrapper DOM."),this.scroller=this.wrapper.children[0],this.scroller||A("The wrapper need at least one child element to be scroller."),this.scrollerStyle=this.scroller.style,this._init(i)}return J.prototype.destroy=function(){var i=this;clearTimeout(this._onResizeHandler),this.tombstonesAnimationHandlers.forEach(function(t){clearTimeout(t)}),this.tombstonesAnimationHandlers=null,this.items.forEach(function(t){t.node&&(i.scrollerEl.removeChild(t.node),t.node=null)}),this.scroller.infiniteScroller=null,this.scroller=null,this.wrapperEl=null,this.scrollerEl=null,this.items=null,this.tombstones=null},J.prototype.onScroll=function(){var t=-this.scroller.y,i=t-this.anchorScrollTop;this.anchorItem=0===t?{index:0,offset:0}:this._calculateAnchoredItem(this.anchorItem,i),this.anchorScrollTop=t;var e=this._calculateAnchoredItem(this.anchorItem,this.scroller.wrapperHeight),s=this.anchorItem.index,o=e.index;i<0?(s-=30,o+=10):(s-=10,o+=30),this.fill(s,o),this.maybeRequestContent()},J.prototype.onResize=function(){var t=this.options.createTombstone();t.style.position="absolute",this.scrollerEl.appendChild(t),t.style.display="",this.tombstoneHeight=t.offsetHeight,this.tombstoneWidth=t.offsetWidth,this.scrollerEl.removeChild(t);for(var i=0;ithis.firstAttachedItem;)i-=this.items[e-1].height||this.tombstoneHeight,e--;return i},J.prototype._setupAnimations=function(e,t){var s=this;for(var i in e){var o=e[i];this.items[i].node.style[_.transform]="translateY("+(this.anchorScrollTop+o[1])+"px) scale("+this.tombstoneWidth/this.items[i].width+", "+this.tombstoneHeight/this.items[i].height+")",this.items[i].node.offsetTop,o[0].offsetTop,this.items[i].node.style[_.transition]=g+"transform 200ms"}for(var n=this.firstAttachedItem;n=this.items.length||!this.items[e].height)&&(s=Math.floor(Math.max(i,0)/this.tombstoneHeight))}return{index:e+=s,offset:i-=s*this.tombstoneHeight}},(R=K).prototype._init=function(t){this._handleOptions(t),this._events={},this.x=0,this.y=0,this.directionX=0,this.directionY=0,this.setScale(1),this._addDOMEvents(),this._initExtFeatures(),this._watchTransition(),this.options.observeDOM&&this._initDOMObserver(),this.options.autoBlur&&this._handleAutoBlur(),this.refresh(),this.options.snap||this.scrollTo(this.options.startX,this.options.startY),this.enable()},R.prototype.setScale=function(t){this.lastScale=c(this.scale)?t:this.scale,this.scale=t},R.prototype._handleOptions=function(t){this.options=a({},D,t),this.translateZ=this.options.HWCompositing&&x?" translateZ(0)":"",this.options.useTransition=this.options.useTransition&&b,this.options.useTransform=this.options.useTransform&&S,this.options.preventDefault=!this.options.eventPassthrough&&this.options.preventDefault,this.options.scrollX="horizontal"!==this.options.eventPassthrough&&this.options.scrollX,this.options.scrollY="vertical"!==this.options.eventPassthrough&&this.options.scrollY,this.options.freeScroll=this.options.freeScroll&&!this.options.eventPassthrough,this.options.directionLockThreshold=this.options.eventPassthrough?0:this.options.directionLockThreshold,!0===this.options.tap&&(this.options.tap="tap")},R.prototype._addDOMEvents=function(){var t=p;this._handleDOMEvents(t)},R.prototype._removeDOMEvents=function(){var t=u;this._handleDOMEvents(t)},R.prototype._handleDOMEvents=function(t){var i=this.options.bindToWrapper?this.wrapper:window;t(window,"orientationchange",this),t(window,"resize",this),this.options.click&&t(this.wrapper,"click",this,!0),this.options.disableMouse||(t(this.wrapper,"mousedown",this),t(i,"mousemove",this),t(i,"mousecancel",this),t(i,"mouseup",this)),T&&!this.options.disableTouch&&(t(this.wrapper,"touchstart",this),t(i,"touchmove",this),t(i,"touchcancel",this),t(i,"touchend",this)),t(this.scroller,_.transitionEnd,this)},R.prototype._initExtFeatures=function(){this.options.snap&&this._initSnap(),this.options.scrollbar&&this._initScrollbar(),this.options.pullUpLoad&&this._initPullUp(),this.options.pullDownRefresh&&this._initPullDown(),this.options.wheel&&this._initWheel(),this.options.mouseWheel&&this._initMouseWheel(),this.options.zoom&&this._initZoom(),this.options.infinity&&this._initInfinite()},R.prototype._watchTransition=function(){if("function"==typeof Object.defineProperty){var o=this,n=!1,t=this.options.useTransition?"isInTransition":"isAnimating";Object.defineProperty(this,t,{get:function(){return n},set:function(t){n=t;for(var i=o.scroller.children.length?o.scroller.children:[o.scroller],e=n&&!o.pulling?"none":"auto",s=0;sthis.minScrollX||this.xthis.minScrollY||this.ythis.options.momentumLimitTime&&nn+this.options.directionLockThreshold?this.directionLocked="h":n>=o+this.options.directionLockThreshold?this.directionLocked="v":this.directionLocked="n"),"h"===this.directionLocked){if("vertical"===this.options.eventPassthrough)t.preventDefault();else if("horizontal"===this.options.eventPassthrough)return void(this.initiated=!1);s=0}else if("v"===this.directionLocked){if("horizontal"===this.options.eventPassthrough)t.preventDefault();else if("vertical"===this.options.eventPassthrough)return void(this.initiated=!1);e=0}e=this.hasHorizontalScroll?e:0,s=this.hasVerticalScroll?s:0,this.movingDirectionX=0this.minScrollX||hthis.minScrollX&&p||hthis.minScrollX?this.minScrollX:this.maxScrollX),(a>this.minScrollY||athis.minScrollY&&l||athis.minScrollY?this.minScrollY:this.maxScrollY),this.moved||(this.moved=!0,this.trigger("scrollStart")),this._translate(h,a),r-this.startTime>this.options.momentumLimitTime&&(this.startTime=r,this.startX=this.x,this.startY=this.y,1===this.options.probeType&&this.trigger("scroll",{x:this.x,y:this.y})),1document.documentElement.clientWidth-this.options.momentumLimitDistance||gdocument.documentElement.clientHeight-this.options.momentumLimitDistance)&&this._end(t)}}},F.prototype._end=function(t){if(this.enabled&&!this.destroyed&&Y[t.type]===this.initiated){this.initiated=!1,this.options.preventDefault&&!M(t.target,this.options.preventDefaultException)&&t.preventDefault(),this.options.stopPropagation&&t.stopPropagation(),this.trigger("touchEnd",{x:this.x,y:this.y}),this.isInTransition=!1;var i=Math.round(this.x),e=Math.round(this.y),s=i-this.absStartX,o=e-this.absStartY;if(this.directionX=0this.options.momentumLimitDistance||r>this.options.momentumLimitDistance)){var l=!1,c=!1,p=!1,d=!1,u=this.options.bounce;!1!==u&&(l=void 0===u.top||u.top,c=void 0===u.bottom||u.bottom,p=void 0===u.left||u.left,d=void 0===u.right||u.right);var m=-1===this.directionX&&p||1===this.directionX&&d?this.wrapperWidth:0,f=-1===this.directionY&&l||1===this.directionY&&c?this.wrapperHeight:0,g=this.hasHorizontalScroll?H(this.x,this.startX,n,this.maxScrollX,this.minScrollX,m,this.options):{destination:i,duration:0},v=this.hasVerticalScroll?H(this.y,this.startY,n,this.maxScrollY,this.minScrollY,f,this.options):{destination:e,duration:0};i=g.destination,e=v.destination,a=Math.max(g.duration,v.duration),this.isInTransition=!0}else this.options.wheel&&(e=Math.round(e/this.itemHeight)*this.itemHeight,a=this.options.wheel.adjustTime||400);var y=I.swipe;if(this.options.snap){var x=this._nearestSnap(i,e);this.currentPage=x,a=this.options.snapSpeed||Math.max(Math.max(Math.min(Math.abs(i-x.x),1e3),Math.min(Math.abs(e-x.y),1e3)),300),i=x.x,e=x.y,this.directionX=0,this.directionY=0,y=this.options.snap.easing||I.bounce}if(i!==this.x||e!==this.y)return(i>this.minScrollX||ithis.minScrollY||ethis.minScrollY?this.selectedIndex=0:ithis.minScrollX?this.minScrollX:n.leftthis.minScrollY?this.minScrollY:n.topthis.minScrollX?e=this.minScrollX:sthis.minScrollY?o=this.minScrollY:nm.maxScrollX&&a++;else for(o=Math.round(t/2),n=Math.round(i/2);e>-m.scrollerWidth;){for(m.pages[r]=[],s=h=0;s>-m.scrollerHeight;)m.pages[r][h]={x:Math.max(e,m.maxScrollX),y:Math.max(s,m.maxScrollY),width:t,height:i,cx:e-o,cy:s-n},s-=i,h++;e-=t,r++}m._checkSnapLoop();var p=f._loopX?1:0,d=f._loopY?1:0;m._goToPage(m.currentPage.pageX||p,m.currentPage.pageY||d,0);var u=f.threshold;m.snapThresholdY=u%1==0?m.snapThresholdX=u:(m.snapThresholdX=Math.round(m.pages[m.currentPage.pageX][m.currentPage.pageY].width*u),Math.round(m.pages[m.currentPage.pageX][m.currentPage.pageY].height*u))}}),this.on("scrollEnd",function(){f.loop&&(f._loopX?(0===m.currentPage.pageX&&m._goToPage(m.pages.length-2,m.currentPage.pageY,0),m.currentPage.pageX===m.pages.length-1&&m._goToPage(1,m.currentPage.pageY,0)):(0===m.currentPage.pageY&&m._goToPage(m.currentPage.pageX,m.pages[0].length-2,0),m.currentPage.pageY===m.pages[0].length-1&&m._goToPage(m.currentPage.pageX,1,0)))}),!1!==f.listenFlick&&this.on("flick",function(){var t=f.speed||Math.max(Math.max(Math.min(Math.abs(m.x-m.startX),1e3),Math.min(Math.abs(m.y-m.startY),1e3)),300);m._goToPage(m.currentPage.pageX+m.directionX,m.currentPage.pageY+m.directionY,t)}),this.on("destroy",function(){if(f.loop){var t=m.scroller.children;2this.minScrollX?t=this.minScrollX:tthis.minScrollY?i=this.minScrollY:i=this.pages[e][0].cx){t=this.pages[e][0].x;break}s=this.pages[e].length;for(var o=0;o=this.pages[0][o].cy){i=this.pages[0][o].y;break}return e===this.currentPage.pageX&&((e+=this.directionX)<0?e=0:e>=this.pages.length&&(e=this.pages.length-1),t=this.pages[e][0].x),o===this.currentPage.pageY&&((o+=this.directionY)<0?o=0:o>=this.pages[0].length&&(o=this.pages[0].length-1),i=this.pages[0][o].y),{x:t,y:i,pageX:e,pageY:o}},N.prototype._goToPage=function(t){var i=1=this.pages.length?t=this.pages.length-1:t<0&&(t=0),this.pages[t])){i>=this.pages[t].length?i=this.pages[t].length-1:i<0&&(i=0);var n=this.pages[t][i].x,r=this.pages[t][i].y;e=void 0===e?o.speed||Math.max(Math.max(Math.min(Math.abs(n-this.x),1e3),Math.min(Math.abs(r-this.y),1e3)),300):e,this.currentPage={x:n,y:r,pageX:t,pageY:i},this.scrollTo(n,r,e,s)}},N.prototype.goToPage=function(t,i,e,s){var o=this.options.snap;if(o&&this.pages&&this.pages.length){if(o.loop){var n=void 0;o._loopX?((n=this.pages.length-2)<=t?t=n-1:t<0&&(t=0),t+=1):((n=this.pages[0].length-2)<=i?i=n-1:i<0&&(i=0),i+=1)}this._goToPage(t,i,e,s)}},N.prototype.next=function(t,i){if(this.options.snap){var e=this.currentPage.pageX,s=this.currentPage.pageY;++e>=this.pages.length&&this.hasVerticalScroll&&(e=0,s++),this._goToPage(e,s,t,i)}},N.prototype.prev=function(t,i){if(this.options.snap){var e=this.currentPage.pageX,s=this.currentPage.pageY;--e<0&&this.hasVerticalScroll&&(e=0,s--),this._goToPage(e,s,t,i)}},N.prototype.getCurrentPage=function(){var t=this.options.snap;return t?t.loop?t._loopX?a({},this.currentPage,{pageX:this.currentPage.pageX-1}):a({},this.currentPage,{pageY:this.currentPage.pageY-1}):this.currentPage:null},(B=K).prototype.wheelTo=function(){var t=0this.minScrollX?d=this.minScrollX:dthis.minScrollY?u=this.minScrollY:uthis.minScrollX?n=this.minScrollX:nthis.minScrollY?r=this.minScrollY:rn?n:this.scale