text: /*! JRoll v2.2.1 ~ (c) 2015-2016 Author:BarZu Git:https://git.oschina.net/chenjianlong/JRoll2/ Website:http://www.chjtx.com/JRoll/ */
  ;!function(r,o,l){"use strict";function e(r){var o=a.findScroller(r.target);o?(i.jrollActive=o,o.moving&&(r.preventDefault(),o.moving=!1),o._start(r)):i.jrollActive=null}function t(r){i.jrollActive&&(i.jrollActive.options.preventDefault&&r.preventDefault(),o.activeElement.blur(),i.jrollActive._move(r))}function s(){i.jrollActive&&i.jrollActive._end()}function n(){setTimeout(function(){for(var r in u)u[r].refresh().scrollTo(u[r].x,u[r].y,200)},600)}var i,a,c="2.2.1",p=r.requestAnimationFrame||r.webkitRequestAnimationFrame||function(r){setTimeout(r,17)},d=o.createElement("div").style,u={},m=navigator.userAgent.toLowerCase();a={TSF:"transform"in d?"transform":"-webkit-transform",TSD:"transitionDuration"in d?"transition-duration":"-webkit-transition-duration",TFO:"transformOrigin"in d?"transform-origin":"-webkit-transform-origin",isAndroid:/android/.test(m),isIOS:/iphone|ipad/.test(m),computePosition:function(r,o){for(var l=0,e=0;r;)l+=r.offsetLeft,e+=r.offsetTop,r=r.offsetParent,r===o&&(r=null);return{left:l,top:e}},moveTo:function(r,o,l,e,t){function s(){u-=17,u<=0?(n=o,i=l):(n=parseInt(n+c,10),i=parseInt(i+d,10)),r.style[a.TSF]="translate("+n+"px, "+i+"px) translateZ(0px) scale("+v+")",u>0&&(n!==o||i!==l)?p(s):"function"==typeof t&&t()}var n,i,c,d,u,m,f=0,_=0,v=1;m=/translate\(([\-\d\.]+)px,\s+([\-\d\.]+)px\)\s+translateZ\(0px\)\s+scale\(([\d\.]+)\)/g.exec(r.style[a.TSF]),m&&(f=Number(m[1]),_=Number(m[2]),v=Number(m[3])),u=e||17,c=(o-f)/(u/17),d=(l-_)/(u/17),n=f,i=_,s()},findScroller:function(r,l){var e;if(l||!("TEXTAREA"===r.tagName&&r.scrollHeight>r.offsetHeight))for(;r!==o;){if(e=r.getAttribute("jroll-id"))return u[e];r=r.parentNode}return null}},o.addEventListener("touchstart",e,!1),o.addEventListener("touchmove",t,!1),o.addEventListener("touchend",s,!1),o.addEventListener("touchcancel",s,!1),r.addEventListener("resize",n,!1),r.addEventListener("orientationchange",n,!1),i=function(r,o){this._init(r,o)},i.version=c,i.utils=a,i.jrollMap=u,i.prototype={_init:function(e,t){var s=this;if(s.wrapper="string"==typeof e?o.querySelector(e):e,s.scroller=t&&t.scroller?"string"==typeof t.scroller?o.querySelector(t.scroller):t.scroller:s.wrapper.children[0],s.scroller.jroll)return s.scroller.jroll.refresh(),s.scroller.jroll;s.scroller.jroll=s,s.wrapperOffset=a.computePosition(s.wrapper,o.body),s.id=t&&t.id||s.scroller.getAttribute("jroll-id")||"jroll_"+l.random().toString().substr(2,8),s.scroller.setAttribute("jroll-id",s.id),u[s.id]=s,s.options={scrollX:!1,scrollY:!0,scrollFree:!1,minX:null,maxX:null,minY:null,maxY:null,zoom:!1,zoomMin:1,zoomMax:4,bounce:!0,scrollBarX:!1,scrollBarY:!1,scrollBarFade:!1,preventDefault:!0,momentum:!0,autoStyle:!0};for(var n in t)"scroller"!==n&&(s.options[n]=t[n]);s.options.autoStyle&&("static"===r.getComputedStyle(s.wrapper).position&&(s.wrapper.style.position="relative",s.wrapper.style.top="0",s.wrapper.style.left="0"),s.wrapper.style.overflow="hidden",s.scroller.style.minHeight="100%"),s.x=0,s.y=0,s.s=null,s.scrollBarX=null,s.scrollBarY=null,s._s={startX:0,startY:0,lastX:0,lastY:0,endX:0,endY:0},s._z={spacing:0,scale:1,startScale:1},s._event={scrollStart:[],scroll:[],scrollEnd:[],zoomStart:[],zoom:[],zoomEnd:[],refresh:[],touchEnd:[]},s.refresh(!0)},enable:function(){var r=this;return r.scroller.setAttribute("jroll-id",r.id),r},disable:function(){var r=this;return r.scroller.removeAttribute("jroll-id"),r},destroy:function(){var r=this;delete u[r.id],delete r.scroller.jroll,r.scrollBarX&&r.wrapper.removeChild(r.scrollBarX),r.scrollBarY&&r.wrapper.removeChild(r.scrollBarY),r.disable(),r.scroller.style[a.tSF]="",r.scroller.style[a.tSD]="",r.prototype=null;for(var o in r)r.hasOwnProperty(o)&&delete r[o]},call:function(r,o){var l=this;return l._s.lockX=!1,l._s.lockY=!1,l.scrollTo(l.x,l.y),i.jrollActive=r,o&&r._start(o),r},refresh:function(r){var o,e,t=this;return t.wrapperWidth=t.wrapper.clientWidth,t.wrapperHeight=t.wrapper.clientHeight,t.scrollerWidth=l.round(t.scroller.offsetWidth*t._z.scale),t.scrollerHeight=l.round(t.scroller.offsetHeight*t._z.scale),t.minScrollX=null===t.options.minX?0:t.options.minX,t.maxScrollX=null===t.options.maxX?t.wrapperWidth-t.scrollerWidth:t.options.maxX,t.minScrollY=null===t.options.minY?0:t.options.minY,t.maxScrollY=null===t.options.maxY?t.wrapperHeight-t.scrollerHeight:t.options.maxY,t.minScrollX<0&&(t.minScrollX=0),t.minScrollY<0&&(t.minScrollY=0),t.maxScrollX>0&&(t.maxScrollX=0),t.maxScrollY>0&&(t.maxScrollY=0),t._s.endX=t.x,t._s.endY=t.y,t.options.scrollBarX?(t.scrollBarX||(o=t._createScrollBar("jroll-xbar","jroll-xbtn",!1),t.scrollBarX=o[0],t.scrollBtnX=o[1]),t.scrollBarScaleX=t.wrapper.clientWidth/t.scrollerWidth,e=l.round(t.scrollBarX.clientWidth*t.scrollBarScaleX),t.scrollBtnX.style.width=(e>8?e:8)+"px",t._runScrollBarX()):t.scrollBarX&&(t.wrapper.removeChild(t.scrollBarX),t.scrollBarX=null),t.options.scrollBarY?(t.scrollBarY||(o=t._createScrollBar("jroll-ybar","jroll-ybtn",!0),t.scrollBarY=o[0],t.scrollBtnY=o[1]),t.scrollBarScaleY=t.wrapper.clientHeight/t.scrollerHeight,e=l.round(t.scrollBarY.clientHeight*t.scrollBarScaleY),t.scrollBtnY.style.height=(e>8?e:8)+"px",t._runScrollBarY()):t.scrollBarY&&(t.wrapper.removeChild(t.scrollBarY),t.scrollBarY=null),r||t._execEvent("refresh"),t},scale:function(r){var o=this,l=parseFloat(r);return isNaN(l)||(o.scroller.style[a.TFO]="0 0",o._z.scale=l,o.refresh()._scrollTo(o.x,o.y),o.scrollTo(o.x,o.y,400)),o},_runScrollBarX:function(){var r=this,o=l.round(-1*r.x*r.scrollBarScaleX);r._scrollTo.call({scroller:r.scrollBtnX,_z:{scale:1}},o,0)},_runScrollBarY:function(){var r=this,o=l.round(-1*r.y*r.scrollBarScaleY);r._scrollTo.call({scroller:r.scrollBtnY,_z:{scale:1}},0,o)},_createScrollBar:function(r,l,e){var t,s,n=this;return t=o.createElement("div"),s=o.createElement("div"),t.className=r,s.className=l,this.options.scrollBarX!==!0&&this.options.scrollBarY!==!0||(e?(t.style.cssText="position:absolute;top:2px;right:2px;bottom:2px;width:6px;overflow:hidden;border-radius:2px;-webkit-transform: scaleX(.5);transform: scaleX(.5);",s.style.cssText="background:rgba(0,0,0,.4);position:absolute;top:0;left:0;right:0;border-radius:2px;"):(t.style.cssText="position:absolute;left:2px;bottom:2px;right:2px;height:6px;overflow:hidden;border-radius:2px;-webkit-transform: scaleY(.5);transform: scaleY(.5);",s.style.cssText="background:rgba(0,0,0,.4);height:100%;position:absolute;left:0;top:0;bottom:0;border-radius:2px;")),n.options.scrollBarFade&&(t.style.opacity=0),t.appendChild(s),n.wrapper.appendChild(t),[t,s]},_fade:function(r,o){var l=this;l.fading&&o>0&&(o-=25,o%100===0&&(r.style.opacity=o/1e3),p(l._fade.bind(l,r,o)))},on:function(r,o){var l=this;switch(r){case"scrollStart":l._event.scrollStart.push(o);break;case"scroll":l._event.scroll.push(o);break;case"scrollEnd":l._event.scrollEnd.push(o);break;case"zoomStart":l._event.zoomStart.push(o);break;case"zoom":l._event.zoom.push(o);break;case"zoomEnd":l._event.zoomEnd.push(o);break;case"refresh":l._event.refresh.push(o);break;case"touchEnd":l._event.touchEnd.push(o)}},_execEvent:function(r,o){for(var l=this,e=l._event[r].length-1;e>=0;e--)l._event[r][e].call(l,o)},_compute:function(r,o,e){var t=this;return r>o?t.options.bounce&&r>o+10?l.round(o+(r-o)/4):o:r<e?t.options.bounce&&r<e-10?l.round(e+(r-e)/4):e:r},_scrollTo:function(r,o){this.scroller.style[a.TSF]="translate("+r+"px, "+o+"px) translateZ(0px) scale("+this._z.scale+")"},scrollTo:function(r,o,l,e,t,s){var n=this;return e?(n.x=r,n.y=o):(n.x=r>=n.minScrollX?n.minScrollX:r<=n.maxScrollX?n.maxScrollX:r,n.y=o>=n.minScrollY?n.minScrollY:o<=n.maxScrollY?n.maxScrollY:o),s||(n._s.endX=n.x,n._s.endY=n.y),l?a.moveTo(n.scroller,n.x,n.y,l,t):(n._scrollTo(n.x,n.y),"function"==typeof t&&t()),n.scrollBtnX&&n._runScrollBarX(),n.scrollBtnY&&n._runScrollBarY(),n},_endAction:function(){var r=this;r._s.endX=r.x,r._s.endY=r.y,r.moving=!1,r.options.scrollBarFade&&!r.fading&&(r.fading=!0,r.scrollBarX&&r._fade(r.scrollBarX,2e3),r.scrollBarY&&r._fade(r.scrollBarY,2e3)),r._execEvent("scrollEnd")},_stepBounce:function(){function r(){o.scrollTo(o.x,o.y,100)}var o=this;o.bouncing=!1,4===o.s?1===o.directionY?(o.scrollTo(o.x,o.minScrollY+20,100,!0,r),o.y=o.minScrollY):(o.scrollTo(o.x,o.maxScrollY-20,100,!0,r),o.y=o.maxScrollY):3===o.s&&(1===o.directionX?(o.scrollTo(o.minScrollX+20,o.y,100,!0,r),o.x=o.minScrollX):(o.scrollTo(o.maxScrollX-20,o.y,100,!0,r),o.x=o.maxScrollX))},_x:function(r){var o=this,l=o.directionX*r;isNaN(l)||(o.x=o.x+l,(o.x>=o.minScrollX||o.x<=o.maxScrollX)&&(o.moving=!1,o.options.bounce&&(o.bouncing=!0)))},_y:function(r){var o=this,l=o.directionY*r;isNaN(l)||(o.y=o.y+l,(o.y>=o.minScrollY||o.y<=o.maxScrollY)&&(o.moving=!1,o.options.bounce&&(o.bouncing=!0)))},_xy:function(r){var o=this,e=l.round(o.cosX*r),t=l.round(o.cosY*r);isNaN(e)||isNaN(t)||(o.x=o.x+e,o.y=o.y+t,(o.x>=o.minScrollX||o.x<=o.maxScrollX)&&(o.y>=o.minScrollY||o.y<=o.maxScrollY)&&(o.moving=!1))},_step:function(r){var o=this,e=Date.now(),t=e-r,s=0;if(o.bouncing&&o._stepBounce(),!o.moving)return void o._endAction();if(t>10){if(o.speed=o.speed-t*(o.speed>1.2?.001:o.speed>.6?8e-4:6e-4),s=l.round(o.speed*t),o.speed<=0||s<=0)return void o._endAction();r=e,o._do(s),o.scrollTo(o.x,o.y,0,!1,null,!0),o._execEvent("scroll")}p(o._step.bind(o,r))},_doScroll:function(o,l){var e,t=this;t.distance=o,t.options.bounce&&(t.x=t._compute(t.x,t.minScrollX,t.maxScrollX),t.y=t._compute(t.y,t.minScrollY,t.maxScrollY)),t.scrollTo(t.x,t.y,0,!!t.options.bounce,null,!0),t._execEvent("scroll",l),l&&l.touches&&(e=l.touches[0].pageY,(e<=10||e>=r.innerHeight-10)&&t._end())},_start:function(r){var o=this,e=r.touches;if((o.options.scrollX||o.options.scrollY||o.options.scrollFree)&&(1===e.length||!o.options.zoom))return o.s=1,o.distance=0,o.lastMoveTime=o.startTime=Date.now(),o._s.lastX=o.startPositionX=o._s.startX=e[0].pageX,o._s.lastY=o.startPositionY=o._s.startY=e[0].pageY,void o._execEvent("scrollStart",r);if(o.s=null,o.options.zoom&&e.length>1){o.s=2,o.scroller.style[a.TFO]="0 0";var t=l.abs(e[0].pageX-e[1].pageX),s=l.abs(e[0].pageY-e[1].pageY);return o._z.spacing=l.sqrt(t*t+s*s),o._z.startScale=o._z.scale,o.originX=l.abs(e[0].pageX+e[1].pageX)/2-o.wrapperOffset.left-o.x,o.originY=l.abs(e[0].pageY+e[1].pageY)/2-o.wrapperOffset.top-o.y,void o._execEvent("zoomStart",r)}},_move:function(r){var o,e,t,s,n,i,a,c,p=this,d=r.touches,u=1,m=1;if(e=d[0].pageX,t=d[0].pageY,s=e-p._s.lastX,n=t-p._s.lastY,p._s.lastX=e,p._s.lastY=t,u=s>=0?1:-1,m=n>=0?1:-1,o=Date.now(),(o-p.lastMoveTime>200||p.directionX!==u||p.directionY!==m)&&(p.startTime=o,p.startPositionX=e,p.startPositionY=t,p.directionX=u,p.directionY=m),p.lastMoveTime=o,i=e-p.startPositionX,a=t-p.startPositionY,1===p.s){if(p.options.scrollBarFade&&(p.fading=!1,p.scrollBarX&&(p.scrollBarX.style.opacity=1),p.scrollBarY&&(p.scrollBarY.style.opacity=1)),!p.options.scrollFree&&p.options.scrollY&&(!p.options.scrollX||l.abs(t-p._s.startY)>=l.abs(e-p._s.startX)))return p._do=p._y,void(p.s=4);if(!p.options.scrollFree&&p.options.scrollX&&(!p.options.scrollY||l.abs(t-p._s.startY)<l.abs(e-p._s.startX)))return p._do=p._x,void(p.s=3);if(p.options.scrollFree)return p._do=p._xy,void(p.s=5)}if(4===p.s)return p.y=t-p._s.startY+p._s.endY,void p._doScroll(a,r);if(3===p.s)return p.x=e-p._s.startX+p._s.endX,void p._doScroll(i,r);if(5===p.s)return p.x=e-p._s.startX+p._s.endX,p.y=t-p._s.startY+p._s.endY,c=l.sqrt(i*i+a*a),p.cosX=i/c,p.cosY=a/c,void p._doScroll(l.sqrt(i*i+a*a),r);if(2===p.s){var f,_=l.abs(d[0].pageX-d[1].pageX),v=l.abs(d[0].pageY-d[1].pageY),x=l.sqrt(_*_+v*v),h=x/p._z.spacing*p._z.startScale;return h<p.options.zoomMin?h=p.options.zoomMin:h>p.options.zoomMax&&(h=p.options.zoomMax),f=h/p._z.startScale,p.x=l.round(p.originX-p.originX*f+p._s.endX),p.y=l.round(p.originY-p.originY*f+p._s.endY),p._z.scale=h,p._scrollTo(p.x,p.y),void p._execEvent("zoom",r)}},_end:function(){var r,o,e=this,t=Date.now(),s=4===e.s,n=3===e.s,a=5===e.s;return i.jrollActive=null,e._execEvent("touchEnd"),s||n||a?(e.duration=t-e.startTime,r=e.y>e.minScrollY||e.y<e.maxScrollY,o=e.x>e.minScrollX||e.x<e.maxScrollX,void(s&&r||n&&o||a&&(r||o)?e.scrollTo(e.x,e.y,300)._endAction():e.options.momentum&&e.duration<200&&e.distance?(e.speed=l.abs(e.distance/e.duration),e.speed=e.speed>2?2:e.speed,e.moving=!0,p(e._step.bind(e,t))):e._endAction())):2===e.s?(e._z.scale>e.options.zoomMax?e._z.scale=e.options.zoomMax:e._z.scale<e.options.zoomMin&&(e._z.scale=e.options.zoomMin),e.refresh(),e.scrollTo(e.x,e.y,400),void e._execEvent("zoomEnd")):void(1!==e.s&&2!==e.s||!e.options.scrollBarFade||e.fading||(e.fading=!0,e.scrollBarX&&e._fade(e.scrollBarX,2e3),e.scrollBarY&&e._fade(e.scrollBarY,2e3)))}},"undefined"!=typeof module&&module.exports&&(module.exports=i),"function"==typeof define&&define(function(){return i}),r.JRoll=i}(window,document,Math);