1// iScroll v5.2.0-snapshot ~ (c) 2008-2017 Matteo Spinelli ~ http://cubiq.org/license 2 3!(function (n, r, d) { 4 var m = 5 n.requestAnimationFrame || 6 n.webkitRequestAnimationFrame || 7 n.mozRequestAnimationFrame || 8 n.oRequestAnimationFrame || 9 n.msRequestAnimationFrame || 10 function (t) { 11 n.setTimeout(t, 1e3 / 60); 12 }, 13 f = (function () { 14 var e = {}, 15 o = r.createElement('div').style, 16 i = (function () { 17 for (var t = ['t', 'webkitT', 'MozT', 'msT', 'OT'], i = 0, s = t.length; i < s; i++) 18 if (t[i] + 'ransform' in o) return t[i].substr(0, t[i].length - 1); 19 return !1; 20 })(); 21 function t(t) { 22 return !1 !== i && ('' === i ? t : i + t.charAt(0).toUpperCase() + t.substr(1)); 23 } 24 (e.getTime = 25 Date.now || 26 function () { 27 return new Date().getTime(); 28 }), 29 (e.extend = function (t, i) { 30 for (var s in i) t[s] = i[s]; 31 }), 32 (e.addEvent = function (t, i, s, e) { 33 t.addEventListener(i, s, !!e); 34 }), 35 (e.removeEvent = function (t, i, s, e) { 36 t.removeEventListener(i, s, !!e); 37 }), 38 (e.prefixPointerEvent = function (t) { 39 return n.MSPointerEvent ? 'MSPointer' + t.charAt(7).toUpperCase() + t.substr(8) : t; 40 }), 41 (e.momentum = function (t, i, s, e, o, n) { 42 var r, 43 h, 44 a = t - i, 45 l = d.abs(a) / s; 46 return ( 47 (h = l / (n = void 0 === n ? 6e-4 : n)), 48 (r = t + ((l * l) / (2 * n)) * (a < 0 ? -1 : 1)) < e 49 ? ((r = o ? e - (o / 2.5) * (l / 8) : e), (h = (a = d.abs(r - t)) / l)) 50 : 0 < r && ((r = o ? (o / 2.5) * (l / 8) : 0), (h = (a = d.abs(t) + r) / l)), 51 { destination: d.round(r), duration: h } 52 ); 53 }); 54 var s = t('transform'); 55 return ( 56 e.extend(e, { 57 hasTransform: !1 !== s, 58 hasPerspective: t('perspective') in o, 59 hasTouch: 'ontouchstart' in n, 60 hasPointer: !(!n.PointerEvent && !n.MSPointerEvent), 61 hasTransition: t('transition') in o, 62 }), 63 (e.isBadAndroid = (function () { 64 var t = n.navigator.appVersion; 65 if (!/Android/.test(t) || /Chrome\/\d/.test(t)) return !1; 66 var i = t.match(/Safari\/(\d+.\d)/); 67 return !(i && 'object' == typeof i && 2 <= i.length) || parseFloat(i[1]) < 535.19; 68 })()), 69 e.extend((e.style = {}), { 70 transform: s, 71 transitionTimingFunction: t('transitionTimingFunction'), 72 transitionDuration: t('transitionDuration'), 73 transitionDelay: t('transitionDelay'), 74 transformOrigin: t('transformOrigin'), 75 touchAction: t('touchAction'), 76 }), 77 (e.hasClass = function (t, i) { 78 return new RegExp('(^|\\s)' + i + '(\\s|$)').test(t.className); 79 }), 80 (e.addClass = function (t, i) { 81 if (!e.hasClass(t, i)) { 82 var s = t.className.split(' '); 83 s.push(i), (t.className = s.join(' ')); 84 } 85 }), 86 (e.removeClass = function (t, i) { 87 if (e.hasClass(t, i)) { 88 var s = new RegExp('(^|\\s)' + i + '(\\s|$)', 'g'); 89 t.className = t.className.replace(s, ' '); 90 } 91 }), 92 (e.offset = function (t) { 93 for (t.offsetLeft, t.offsetTop; (t = t.offsetParent); ) t.offsetLeft, t.offsetTop; 94 return { left: 0, top: 0 }; 95 }), 96 (e.preventDefaultException = function (t, i) { 97 for (var s in i) if (i[s].test(t[s])) return !0; 98 return !1; 99 }), 100 e.extend((e.eventType = {}), { 101 touchstart: 1, 102 touchmove: 1, 103 touchend: 1, 104 mousedown: 2, 105 mousemove: 2, 106 mouseup: 2, 107 pointerdown: 3, 108 pointermove: 3, 109 pointerup: 3, 110 MSPointerDown: 3, 111 MSPointerMove: 3, 112 MSPointerUp: 3, 113 }), 114 e.extend((e.ease = {}), { 115 quadratic: { 116 style: 'cubic-bezier(0.25, 0.46, 0.45, 0.94)', 117 fn: function (t) { 118 return t * (2 - t); 119 }, 120 }, 121 circular: { 122 style: 'cubic-bezier(0.1, 0.57, 0.1, 1)', 123 fn: function (t) {
124 return d.sqrt(1 - --t * t); 125 }, 126 }, 127 back: { 128 style: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)', 129 fn: function (t) { 130 return --t * t * (5 * t + 4) + 1; 131 }, 132 }, 133 bounce: { 134 style: '', 135 fn: function (t) { 136 return (t /= 1) < 1 / 2.75 137 ? 7.5625 * t * t 138 : t < 2 / 2.75 139 ? 7.5625 * (t -= 1.5 / 2.75) * t + 0.75 140 : t < 2.5 / 2.75 141 ? 7.5625 * (t -= 2.25 / 2.75) * t + 0.9375 142 : 7.5625 * (t -= 2.625 / 2.75) * t + 0.984375; 143 }, 144 }, 145 elastic: { 146 style: '', 147 fn: function (t) { 148 return 0 === t 149 ? 0 150 : 1 == t 151 ? 1 152 : 0.4 * d.pow(2, -10 * t) * d.sin(((t - 0.055) * (2 * d.PI)) / 0.22) + 1; 153 }, 154 }, 155 }), 156 (e.tap = function (t, i) { 157 var s = r.createEvent('Event'); 158 s.initEvent(i, !0, !0), (s.pageX = t.pageX), (s.pageY = t.pageY), t.target.dispatchEvent(s); 159 }), 160 (e.click = function (t) { 161 var i, 162 s = t.target; 163 /(SELECT|INPUT|TEXTAREA)/i.test(s.tagName) || 164 ((i = r.createEvent(n.MouseEvent ? 'MouseEvents' : 'Event')).initEvent('click', !0, !0), 165 (i.view = t.view || n), 166 (i.detail = 1), 167 (i.screenX = s.screenX || 0), 168 (i.screenY = s.screenY || 0), 169 (i.clientX = s.clientX || 0), 170 (i.clientY = s.clientY || 0), 171 (i.ctrlKey = !!t.ctrlKey), 172 (i.altKey = !!t.altKey), 173 (i.shiftKey = !!t.shiftKey), 174 (i.metaKey = !!t.metaKey), 175 (i.button = 0), 176 (i.relatedTarget = null), 177 (i._constructed = !0), 178 s.dispatchEvent(i)); 179 }), 180 (e.getTouchAction = function (t, i) { 181 var s = 'none'; 182 return ( 183 'vertical' === t ? (s = 'pan-y') : 'horizontal' === t && (s = 'pan-x'), 184 i && 'none' != s && (s += ' pinch-zoom'), 185 s 186 ); 187 }), 188 (e.getRect = function (t) { 189 if (t instanceof SVGElement) { 190 var i = t.getBoundingClientRect(); 191 return { top: i.top, left: i.left, width: i.width, height: i.height }; 192 } 193 return { top: t.offsetTop, left: t.offsetLeft, width: t.offsetWidth, height: t.offsetHeight }; 194 }), 195 e 196 ); 197 })(); 198 function t(t, i) { 199 for (var s in ((this.wrapper = 'string' == typeof t ? r.querySelector(t) : t), 200 (this.scroller = this.wrapper.children[0]), 201 (this.scrollerStyle = this.scroller.style), 202 (this.options = { 203 zoomMin: 1, 204 zoomMax: 4, 205 startZoom: 1, 206 resizeScrollbars: !0, 207 mouseWheelSpeed: 20, 208 snapThreshold: 0.334, 209 disablePointer: !f.hasPointer, 210 disableTouch: f.hasPointer || !f.hasTouch, 211 disableMouse: f.hasPointer || f.hasTouch, 212 startX: 0, 213 startY: 0, 214 scrollY: !0, 215 directionLockThreshold: 5, 216 momentum: !0, 217 bounce: !0, 218 bounceTime: 600, 219 bounceEasing: '', 220 preventDefault: !0, 221 preventDefaultException: { tagName: /^(INPUT|TEXTAREA|BUTTON|
221SELECT)$/ }, 222 HWCompositing: !0, 223 useTransition: !0, 224 useTransform: !0, 225 bindToWrapper: void 0 === n.onmousedown, 226 }), 227 i)) 228 this.options[s] = i[s]; 229 (this.translateZ = this.options.HWCompositing && f.hasPerspective ? ' translateZ(0)' : ''), 230 (this.options.useTransition = f.hasTransition && this.options.useTransition), 231 (this.options.useTransform = f.hasTransform && this.options.useTransform), 232 (this.options.eventPassthrough = 233 !0 === this.options.eventPassthrough ? 'vertical' : this.options.eventPassthrough), 234 (this.options.preventDefault = !this.options.eventPassthrough && this.options.preventDefault), 235 (this.options.scrollY = 'vertical' != this.options.eventPassthrough && this.options.scrollY), 236 (this.options.scrollX = 'horizontal' != this.options.eventPassthrough && this.options.scrollX), 237 (this.options.freeScroll = this.options.freeScroll && !this.options.eventPassthrough), 238 (this.options.directionLockThreshold = this.options.eventPassthrough 239 ? 0 240 : this.options.directionLockThreshold), 241 (this.options.bounceEasing = 242 'string' == typeof this.options.bounceEasing 243 ? f.ease[this.options.bounceEasing] || f.ease.circular 244 : this.options.bounceEasing), 245 (this.options.resizePolling = void 0 === this.options.resizePolling ? 60 : this.options.resizePolling), 246 !0 === this.options.tap && (this.options.tap = 'tap'), 247 this.options.useTransition || 248 this.options.useTransform || 249 /relative|absolute/i.test(this.scrollerStyle.position) || 250 (this.scrollerStyle.position = 'relative'), 251 'scale' == this.options.shrinkScrollbars && (this.options.useTransition = !1), 252 (this.options.invertWheelDirection = this.options.invertWheelDirection ? -1 : 1), 253 (this.x = 0), 254 (this.y = 0), 255 (this.directionX = 0), 256 (this.directionY = 0), 257 (this._events = {}), 258 (this.scale = d.min(d.max(this.options.startZoom, this.options.zoomMin), this.options.zoomMax)), 259 this._init(), 260 this.refresh(), 261 this.scrollTo(this.options.startX, this.options.startY), 262 this.enable(); 263 } 264 function h(t, i, s) { 265 var e = r.createElement('div'), 266 o = r.createElement('div'); 267 return ( 268 !0 === s && 269 ((e.style.cssText = 'position:absolute;z-index:9999'), 270 (o.style.cssText = 271 '-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px')), 272 (o.className = 'iScrollIndicator'), 273 'h' == t 274 ? (!0 === s && 275 ((e.style.cssText += ';height:7px;left:2px;right:2px;bottom:0'), (o.style.height = '100%')), 276 (e.className = 'iScrollHorizontalScrollbar')) 277 : (!0 === s && 278 ((e.style.cssText += ';width:7px;bottom:2px;top:2px;right:1px'), (o.style.width = '100%')), 279 (e.className = 'iScrollVerticalScrollbar')), 280 (e.style.cssText += ';overflow:hidden'), 281 i || (e.style.pointerEvents = 'none'), 282 e.appendChild(o), 283 e 284 ); 285 } 286 function a(t, i) { 287 for (var s in ((this.wrapper = 'string' == typeof i.el ? r.querySelector(i.el) : i.el), 288 (this.wrapperStyle = this.wrapper.style), 289 (this.indicator = this.wrapper.children[0]), 290 (this.indicatorStyle = this.indicator.style), 291 (this.scroller = t), 292 (this.options = { 293 listenX: !0, 294 listenY: !0, 295 interactive: !1, 296 resize: !0, 297 defaultScrollbars: !1, 298 shrink: !1, 299 fade: !1, 300 speedRatioX: 0, 301 speedRatioY: 0, 302 }), 303 i)) 304 this.options[s] = i[s]; 305 if ( 306 ((this.sizeRatioX = 1), 307 (this.sizeRatioY = 1), 308 (this.maxPosX = 0), 309 (this.maxPosY = 0), 310 this.options.interactive && 311 (this.options.disableTouch || 312 (f.addEvent(this.indicator, 'touchstart', this), f.addEvent(n, 'touchend', this)), 313 this.options.disablePointer || 314 (f.addEvent(this.indicator, f.prefixPointerEvent('pointerdown'), this), 315 f.addEvent(n, f.prefixPointerEvent('pointerup'), this)), 316 this.options.disableMouse || 317 (f.addEvent(this.indicator, 'mousedown', this), f.addEvent(n, 'mouseup', this))), 318 this.options.fade) 319 ) { 320 this.wrapperStyle[f.style.transform] = this.scroller.translateZ; 321 var e = f.style.transitionDuration; 322 if (!e) return; 323 this.wrapperStyle[e] = f.isBadAndroid ? '0.0001ms' : '0ms'; 324 var o = this; 325 f.isBadAndroid && 326 m(function () { 327 '0.0001ms' === o.wrapperStyle[e] && (o.wrapperStyle[e] = '0s'); 328 }), 329 (this.wrapperStyle.opacity = '0'); 330 } 331 } 332 (t.prototype = { 333 version: '5.2.0-snapshot', 334 _init: function () { 335 this._initEvents(), 336 this.options.zoom && this._initZoom(), 337 (this.options.scrollbars || this.options.indicators) && this._initIndicators(), 338 this.options.mouseWheel && this._initWheel(), 339 this.options.snap && this._initSnap(), 340 this.options.keyBindings && this._initKeys(); 341 }, 342 destroy: function () { 343 this._initEvents(!0), 344 clearTimeout(this.resizeTimeout), 345 (this.resizeTimeout = null),
346 this._execEvent('destroy'); 347 }, 348 _transitionEnd: function (t) { 349 t.target == this.scroller && 350 this.isInTransition && 351 (this._transitionTime(), 352 this.resetPosition(this.options.bounceTime) || 353 ((this.isInTransition = !1), this._execEvent('scrollEnd'))); 354 }, 355 _start: function (t) { 356 if ('pointerdown' != t.type || t.isPrimary) { 357 if (1 != f.eventType[t.type]) 358 if (0 !== (t.which ? t.button : t.button < 2 ? 0 : 4 == t.button ? 1 : 2)) return; 359 if (this.enabled && (!this.initiated || f.eventType[t.type] === this.initiated)) { 360 !this.options.preventDefault || 361 f.isBadAndroid || 362 f.preventDefaultException(t.target, this.options.preventDefaultException) || 363 t.preventDefault(); 364 var i, 365 s = t.touches ? t.touches[0] : t; 366 (this.initiated = f.eventType[t.type]), 367 (this.moved = !1), 368 (this.distX = 0), 369 (this.distY = 0), 370 (this.directionX = 0), 371 (this.directionY = 0), 372 (this.directionLocked = 0), 373 (this.startTime = f.getTime()), 374 this.options.useTransition && this.isInTransition 375 ? (this._transitionTime(), 376 (this.isInTransition = !1), 377 (i = this.getComputedPosition()), 378 this._translate(d.round(i.x), d.round(i.y)), 379 this._execEvent('scrollEnd')) 380 : !this.options.useTransition && 381 this.isAnimating && 382 ((this.isAnimating = !1), this._execEvent('scrollEnd')), 383 (this.startX = this.x), 384 (this.startY = this.y), 385 (this.absStartX = this.x), 386 (this.absStartY = this.y), 387 (this.pointX = s.pageX), 388 (this.pointY = s.pageY), 389 this._execEvent('beforeScrollStart'); 390 } 391 } 392 }, 393 _move: function (t) { 394 if (this.enabled && f.eventType[t.type] === this.initiated && ('pointermove' != t.type || t.isPrimary)) { 395 this.options.preventDefault && t.preventDefault(); 396 var i, 397 s, 398 e, 399 o, 400 n = t.touches ? t.touches[0] : t, 401 r = n.pageX - this.pointX, 402 h = n.pageY - this.pointY, 403 a = f.getTime(); 404 if ( 405 ((this.pointX = n.pageX), 406 (this.pointY = n.pageY), 407 (this.distX += r), 408 (this.distY += h), 409 (e = d.abs(this.distX)), 410 (o = d.abs(this.distY)), 411 !(300 < a - this.endTime && e < 10 && o < 10)) 412 ) { 413 if ( 414 (this.directionLocked || 415 this.options.freeScroll || 416 (e > o + this.options.directionLockThreshold 417 ? (this.directionLocked = 'h') 418 : o >= e + this.options.directionLockThreshold 419 ? (this.directionLocked = 'v') 420 : (this.directionLocked = 'n')), 421 'h' == this.directionLocked) 422 ) { 423 if ('vertical' == this.options.eventPassthrough) t.preventDefault(); 424 else if ('horizontal' == this.options.eventPassthrough) return void (this.initiated = !1); 425 h = 0; 426 } else if ('v' == this.directionLocked) { 427 if ('horizontal' == this.options.eventPassthrough) t.preventDefault(); 428 else if ('vertical' == this.options.eventPassthrough) return void (this.initiated = !1); 429 r = 0; 430 } 431 (r = this.hasHorizontalScroll ? r : 0), 432 (h = this.hasVerticalScroll ? h : 0), 433 (i = this.x + r), 434 (s = this.y + h), 435 (0 < i || i < this.maxScrollX) && 436 (i = this.options.bounce ? this.x + r / 3 : 0 < i ? 0 : this.maxScrollX), 437 (0 < s || s < this.maxScrollY) && 438 (s = this.options.bounce ? this.y + h / 3 : 0 < s ? 0 : this.maxScrollY), 439 (this.directionX = 0 < r ? -1 : r < 0 ? 1 : 0), 440 (this.directionY = 0 < h ? -1 : h < 0 ? 1 : 0), 441 this.moved || this._execEvent('scrollStart'), 442 (this.moved = !0), 443 this._translate(i, s), 444 300 < a - this.startTime && 445 ((this.startTime = a), (this.startX = this.x), (this.startY = this.y)); 446 } 447 } 448 }, 449 _end: function (t) { 450 if (this.enabled && f.eventType[t.type] === this.initiated && ('pointerup' != t.type || t.isPrimary)) { 451 this.options.preventDefault && 452 !f.preventDefaultException(t.target, this.options.preventDefaultException) && 453 t.preventDefault(); 454 t.changedTouches && t.changedTouches[0]; 455 var i, 456 s, 457 e = f.getTime() - this.startTime, 458 o = d.round(this.x), 459 n = d.round(this.y), 460 r = d.abs(o - this.startX), 461 h = d.abs(n - this.startY), 462 a = 0, 463 l = ''; 464 if ( 465 ((this.isInTransition = 0), 466 (this.initiated = 0), 467 (this.endTime = f.getTime()), 468 !this.resetPosition(this.options.bounceTime)) 469 ) { 470 if ((this.scrollTo(o, n), !this.moved)) 471 return ( 472 this.options.tap && f.tap(t, this.options.tap), 473 this.options.click && f.click(t), 474 void this._execEvent('scrollCancel') 475 ); 476 if (this._events.flick && e < 200 && r < 100 && h < 100) this._execEvent('flick'); 477 else { 478 if ( 479 (this.options.momentum && 480 e < 300 && 481 ((i = this.hasHorizontalScroll 482 ? f.momentum( 483 this.x, 484 this.startX, 485 e, 486 this.maxScrollX, 487 this.options.bounce ? this.wrapperW
487idth : 0, 488 this.options.deceleration 489 ) 490 : { destination: o, duration: 0 }), 491 (s = this.hasVerticalScroll 492 ? f.momentum( 493 this.y, 494 this.startY, 495 e, 496 this.maxScrollY, 497 this.options.bounce ? this.wrapperHeight : 0, 498 this.options.deceleration 499 ) 500 : { destination: n, duration: 0 }), 501 (o = i.destination), 502 (n = s.destination), 503 (a = d.max(i.duration, s.duration)), 504 (this.isInTransition = 1)), 505 this.options.snap) 506 ) { 507 var c = this._nearestSnap(o, n); 508 (this.currentPage = c), 509 (a = 510 this.options.snapSpeed || 511 d.max(d.max(d.min(d.abs(o - c.x), 1e3), d.min(d.abs(n - c.y), 1e3)), 300)), 512 (o = c.x), 513 (n = c.y), 514 (this.directionX = 0), 515 (this.directionY = 0), 516 (l = this.options.bounceEasing); 517 } 518 if (o != this.x || n != this.y) 519 return ( 520 (0 < o || o < this.maxScrollX || 0 < n || n < this.maxScrollY) && 521 (l = f.ease.quadratic), 522 this.scrollTo(o, n, a, l), 523 void this._execEvent('scrollToPage') 524 ); 525 this._execEvent('scrollEnd'); 526 } 527 } 528 } 529 }, 530 _resize: function () { 531 var t = this; 532 clearTimeout(this.resizeTimeout), 533 (this.resizeTimeout = setTimeout(function () { 534 t.refresh(); 535 }, this.options.resizePolling)); 536 }, 537 resetPosition: function (t) { 538 var i = this.x, 539 s = this.y; 540 return ( 541 (t = t || 0), 542 !this.hasHorizontalScroll || 0 < this.x ? (i = 0) : this.x < this.maxScrollX && (i = this.maxScrollX), 543 !this.hasVerticalScroll || 0 < this.y ? (s = 0) : this.y < this.maxScrollY && (s = this.maxScrollY), 544 (i != this.x || s != this.y) && (this.scrollTo(i, s, t, this.options.bounceEasing), !0) 545 ); 546 }, 547 disable: function () { 548 this.enabled = !1; 549 }, 550 enable: function () { 551 this.enabled = !0; 552 }, 553 setScrollerSize: function (t, i) { 554 (this.scrollerW = t), (this.scrollerH = i); 555 }, 556 setWrapperOffset: function (t, i) { 557 (this.wrapperOffsetLeft = t), (this.wrapperOffsetTop = i); 558 }, 559 refresh: function () { 560 f.getRect(this.wrapper), 561 (this.wrapperWidth = this.wrapper.clientWidth), 562 (this.wrapperHeight = this.wrapper.clientHeight); 563 var t = f.getRect(this.scroller); 564 this.scrollerW && (t.width = this.scrollerW), 565 this.scrollerH && (t.height = this.scrollerH), 566 (this.scrollerWidth = d.round(t.width * this.scale)), 567 (this.scrollerHeight = d.round(t.height * this.scale)), 568 (this.maxScrollX = this.wrapperWidth - this.scrollerWidth), 569 (this.maxScrollY = this.wrapperHeight - this.scrollerHeight), 570 (this.hasHorizontalScroll = this.options.scrollX && this.maxScrollX < 0), 571 (this.hasVerticalScroll = this.options.scrollY && this.maxScrollY < 0), 572 this.hasHorizontalScroll || ((this.maxScrollX = 0), (this.scrollerWidth = this.wrapperW
572idth)), 573 this.hasVerticalScroll || ((this.maxScrollY = 0), (this.scrollerHeight = this.wrapperHeight)), 574 (this.endTime = 0), 575 (this.directionX = 0), 576 (this.directionY = 0), 577 f.hasPointer && 578 !this.options.disablePointer && 579 ((this.wrapper.style[f.style.touchAction] = f.getTouchAction(this.options.eventPassthrough, !0)), 580 this.wrapper.style[f.style.touchAction] || 581 (this.wrapper.style[f.style.touchAction] = f.getTouchAction( 582 this.options.eventPassthrough, 583 !1 584 ))), 585 (this.wrapperOffset = f.offset(this.wrapper)), 586 this.wrapperOffsetLeft && (this.wrapperOffset.left = this.wrapperOffsetLeft), 587 this.wrapperOffsetTop && (this.wrapperOffset.top = this.wrapperOffsetTop), 588 this._execEvent('refresh'), 589 this.resetPosition(); 590 }, 591 on: function (t, i) { 592 this._events[t] || (this._events[t] = []), this._events[t].push(i); 593 }, 594 off: function (t, i) { 595 if (this._events[t]) { 596 var s = this._events[t].indexOf(i); 597 -1 < s && this._events[t].splice(s, 1); 598 } 599 }, 600 _execEvent: function (t) { 601 if (this._events[t]) { 602 var i = 0, 603 s = this._events[t].length; 604 if (s) for (; i < s; i++) this._events[t][i].apply(this, [].slice.call(arguments, 1)); 605 } 606 }, 607 scrollBy: function (t, i, s, e) { 608 (t = this.x + t), (i = this.y + i), (s = s || 0), this.scrollTo(t, i, s, e); 609 }, 610 getScrollerWidth: function () { 611 return void 0 !== this.scrollerW ? this.scrollerW : this.scroller.offsetWidth; 612 }, 613 getScrollerHeight: function () { 614 return void 0 !== this.scrollerH ? this.scrollerH : this.scroller.offsetHeight; 615 }, 616 scrollTo: function (t, i, s, e) { 617 if (0 != this.wrapperWidth && 0 != this.wrapperHeight) { 618 if (s) { 619 if (this.prevDisabled && 0 == t) return void this.goToPage(1, 0, 0); 620 if (this.nextDisabled && t == -(this.scrollerWidth - this.wrapperWidth)) 621 return void this.goToPage(1, 0, 0); 622 } 623 this.options.keepInCenterH &&
624 this.getScrollerWidth() * this.scale < this.wrapperWidth && 625 (t = this.wrapperWidth / 2 - (this.getScrollerWidth() * this.scale) / 2), 626 this.options.keepInCenterV && 627 this.getScrollerHeight() * this.scale < this.wrapperHeight && 628 (i = this.wrapperHeight / 2 - (this.getScrollerHeight() * this.scale) / 2), 629 (e = e || f.ease.circular), 630 (this.isInTransition = this.options.useTransition && 0 < s); 631 var o = this.options.useTransition && e.style; 632 !s || o 633 ? (o && (this._transitionTimingFunction(e.style), this._transitionTime(s)), this._translate(t, i)) 634 : this._animate(t, i, s, e.fn); 635 } 636 }, 637 scrollToElement: function (t, i, s, e, o) { 638 if ((t = t.nodeType ? t : this.scroller.querySelector(t))) { 639 var n = f.offset(t); 640 (n.left -= this.wrapperOffset.left), (n.top -= this.wrapperOffset.top); 641 var r = f.getRect(t), 642 h = f.getRect(this.wrapper); 643 !0 === s && (s = d.round(r.width / 2 - h.width / 2)), 644 !0 === e && (e = d.round(r.height / 2 - h.height / 2)), 645 (n.left -= s || 0), 646 (n.top -= e || 0), 647 (n.left = 0 < n.left ? 0 : n.left < this.maxScrollX ? this.maxScrollX : n.left), 648 (n.top = 0 < n.top ? 0 : n.top < this.maxScrollY ? this.maxScrollY : n.top), 649 (i = null == i || 'auto' === i ? d.max(d.abs(this.x - n.left), d.abs(this.y - n.top)) : i), 650 this.scrollTo(n.left, n.top, i, o); 651 } 652 }, 653 _transitionTime: function (t) { 654 if (this.options.useTransition) { 655 t = t || 0; 656 var i = f.style.transitionDuration; 657 if (i) { 658 if (((this.scrollerStyle[i] = t + 'ms'), !t && f.isBadAndroid)) { 659 this.scrollerStyle[i] = '0.0001ms'; 660 var s = this; 661 m(function () { 662 '0.0001ms' === s.scrollerStyle[i] && (s.scrollerStyle[i] = '0s'); 663 }); 664 } 665 if (this.indicators) 666 for (var e = this.indicators.length; e--; ) this.indicators[e].transitionTime(t); 667 } 668 } 669 }, 670 _transitionTimingFunction: function (t) { 671 if (((this.scrollerStyle[f.style.transitionTimingFunction] = t), this.indicators)) 672 for (var i = this.indicators.length; i--; ) this.indicators[i].transitionTimingFunction(t); 673 }, 674 _translate: function (t, i) { 675 if ( 676 (this.options.useTransform 677 ? (this.scrollerStyle[f.style.transform] = 678 'translate(' + t + 'px,' + i + 'px) scale(' + this.scale + ') ' + this.translateZ) 679 : ((t = d.round(t)), 680 (i = d.round(i)), 681 (this.scrollerStyle.left = t + 'px'), 682 (this.scrollerStyle.top = i + 'px')), 683 (this.x = t), 684 (this.y = i), 685 this.indicators) 686 ) 687 for (var s = this.indicators.length; s--; ) this.indicators[s].updatePosition(); 688 }, 689 _initEvents: function (t) { 690 var i = t ? f.removeEvent : f.addEvent, 691 s = this.options.bindToWrapper ? this.wrapper : n; 692 i(n, 'orientationchange', this), 693 i(n, 'resize', this), 694 this.options.click && i(this.wrapper, 'click', this, !0), 695 this.options.disableMouse || 696 (i(this.wrapper, 'mousedown', this), 697 i(s, 'mousemove', this), 698 i(s, 'mousecancel', this), 699 i(s, 'mouseup', this)), 700 f.hasPointer && 701 !this.options.disablePointer && 702 (i(this.wrapper, f.prefixPointerEvent('pointerdown'), this), 703 i(s, f.prefixPointerEvent('pointermove'), this), 704 i(s, f.prefixPointerEvent('pointercancel'), this), 705 i(s, f.prefixPointerEvent('pointerup'), this)), 706 f.hasTouch && 707 !this.options.disableTouch && 708 (i(this.wrapper, 'touchstart', this), 709 i(s, 'touchmove', this), 710 i(s, 'touchcancel', this), 711 i(s, 'touchend', this)), 712 i(this.scroller, 'transitionend', this), 713 i(this.scroller, 'webkitTransitionEnd', this), 714 i(this.scroller, 'oTransitionEnd', this), 715 i(this.scroller, 'MSTransitionEnd', this); 716 }, 717 getComputedPosition: function () { 718 var t, 719 i, 720 s = n.getComputedStyle(this.scroller, null); 721 return ( 722 (i = this.options.useTransform 723 ? ((t = +((s = s[f.style.transform].split(')')[0].split(', '))[12] || s[4])), +(s[13] || s[5])) 724 : ((t = +s.left.replace(/[^-\d.]/g, '')), +s.top.replace(/[^-\d.]/g, ''))), 725 { x: t, y: i } 726 ); 727 }, 728 _initIndicators: function () { 729 var t, 730 i = this.options.interactiveScrollbars, 731 s = 'string' != typeof this.options.scrollbars, 732 e = [], 733 o = this; 734 (this.indicators = []), 735 this.options.scrollbars && 736 (this.options.scrollY && 737 ((t = { 738 el: h('v', i, this.options.scrollbars), 739 interactive: i, 740 defaultScrollbars: !0, 741 customStyle: s, 742 resize: this.options.resizeScrollbars, 743 shrink: this.options.shrinkScrollbars, 744 fade: this.options.fadeScrollbars, 745 listenX: !1, 746 }), 747 this.wrapper.appendChild(t.el), 748 e.push(t)), 749 this.options.scrollX && 750 ((t = { 751 el: h('h', i, this.options.scrollbars), 752 interactive: i, 753 defaultScrollbars: !0, 754 customStyle: s, 755 resize: this.options.resizeScrollbars, 756 shrink: this.options.shrinkScrollbars, 757 fade: this.options.fadeScrollbars, 758 listenY: !1, 759 }), 760 this.wrapper.appendChild(t.el), 761 e.push(t))), 762 this.options.indicators && (e = e.concat(this.options.indicators)); 763 for (var n = e.length; n--; ) this.indicators.push(new a(this, e[n])); 764 function r(t) { 765 if (o.indicators) for (var i = o.indicators.length; i--; ) t.call(o.indicators[i]); 766 } 767 this.options.fadeScrollbars && 768 (this.on('scrollEnd', function () { 769 r(function () { 770 this.fade(); 771 }); 772 }), 773 this.on('scrollCancel', function () { 774 r(function () { 775 this.fade(); 776 }); 777 }), 778 this.on('scrollStart', function () { 779 r(function () { 780 this.fade(1); 781 }); 782 }), 783 this.on('beforeScrollStart', function () { 784 r(function () { 785 this.fade(1, !0); 786 }); 787 })), 788 this.on('refresh', function () { 789 r(function () { 790 this.refresh(); 791 }); 792 }), 793 this.on('destroy', function () { 794 r(function () { 795 this.destroy(); 796 }), 797 delete this.indicators; 798 }); 799 }, 800 _initZoom: function () { 801 this.scrollerStyle[f.style.transformOrigin] = '0 0'; 802 }, 803 _zoomStart: function (t) { 804 var i = d.abs(t.touches[0].pageX - t.touches[1].pageX), 805 s = d.abs(t.touches[0].pageY - t.touches[1].pageY); 806 (this.touchesDistanceStart = d.sqrt(i * i + s * s)), 807 (this.startScale = this.scale), 808 (this.originX = d.abs(t.touches[0].pageX + t.touches[1].pageX) / 2 + this.wrapperOffset.left - this.x), 809 (this.originY = d.abs(t.touches[0].pageY + t.touches[1].pageY) / 2 + this.wrapperOffset.top - this.y), 810 this._execEvent('zoomStart'); 811 }, 812 _zoom: function (t) { 813 if (this.enabled && f.eventType[t.type] === this.initiated) { 814 this.options.preventDefault && t.preventDefault(); 815 var i, 816 s, 817 e, 818 o = d.abs(t.touches[0].pageX - t.touches[1].pageX), 819 n = d.abs(t.touches[0].pageY - t.touches[1].pageY), 820 r = d.sqrt(o * o + n * n), 821 h = (1 / this.touchesDistanceStart) * r * this.startScale; 822 (this.scaled = !0), 823 h < this.options.zoomMin 824 ? (h = 0.5 * this.options.zoomMin * d.pow(2, h / this.options.zoomMin)) 825 : h > this.options.zoomMax && 826 (h = 2 * this.options.zoomMax * d.pow(0.5, this.options.zoomMax / h)), 827 (i = h / this.startScale), 828 (s = this.originX - this.originX * i + this.startX),
829 (e = this.originY - this.originY * i + this.startY), 830 (this.scale = h), 831 this.scrollTo(s, e, 0); 832 } 833 }, 834 _zoomEnd: function (t) { 835 var i, s, e; 836 this.enabled && 837 f.eventType[t.type] === this.initiated && 838 (this.options.preventDefault && t.preventDefault(), 839 (this.isInTransition = 0), 840 (this.initiated = 0), 841 this.scale > this.options.zoomMax 842 ? (this.scale = this.options.zoomMax) 843 : this.scale < this.options.zoomMin && (this.scale = this.options.zoomMin), 844 this.refresh(), 845 (e = this.scale / this.startScale), 846 (i = this.originX - this.originX * e + this.startX), 847 (s = this.originY - this.originY * e + this.startY), 848 0 < i ? (i = 0) : i < this.maxScrollX && (i = this.maxScrollX), 849 0 < s ? (s = 0) : s < this.maxScrollY && (s = this.maxScrollY), 850 (this.x == i && this.y == s) || this.scrollTo(i, s, this.options.bounceTime), 851 (this.scaled = !1), 852 this._execEvent('zoomEnd')); 853 }, 854 zoom: function (t, i, s, e) { 855 if ( 856 0 != this.wrapperWidth && 857 0 != this.wrapperHeight && 858 (t < this.options.zoomMin 859 ? (t = this.options.zoomMin) 860 : t > this.options.zoomMax && (t = this.options.zoomMax), 861 t != this.scale) 862 ) { 863 var o = t / this.scale, 864 n = this; 865 1 != o && 866 (clearTimeout(this.zoomStartTimeout), 867 (this.zoomStartTimeout = setTimeout(function () { 868 n._execEvent('zoomStart'); 869 }, 0)), 870 clearTimeout(this.wheelTimeout), 871 (this.wheelTimeout = setTimeout(function () { 872 n._execEvent('zoomEnd'); 873 }, Number(e + 100)))), 874 (i = void 0 === i ? this.wrapperWidth / 2 : i), 875 (s = void 0 === s ? this.wrapperHeight / 2 : s), 876 (e = void 0 === e ? 300 : e), 877 (i = i + this.wrapperOffset.left - this.x), 878 (s = s + this.wrapperOffset.top - this.y), 879 (i = i - i * o + this.x), 880 (s = s - s * o + this.y), 881 (this.scale = t), 882 this.refresh(), 883 0 < i ? (i = 0) : i < this.maxScrollX && (i = this.maxScrollX), 884 0 < s ? (s = 0) : s < this.maxScrollY && (s = this.maxScrollY), 885 this.scrollTo(i, s, e); 886 } 887 }, 888 _wheelZoom: function (t) { 889 var i, s; 890 if ('deltaX' in t) i = -t.deltaY / d.abs(t.deltaY); 891 else if ('wheelDeltaX' in t) i = t.wheelDeltaY / d.abs(t.wheelDeltaY); 892 else if ('wheelDelta' in t) i = t.wheelDelta / d.abs(t.wheelDelta); 893 else { 894 if (!('detail' in t)) return; 895 i = -t.detail / d.abs(t.wheelDelta); 896 } 897 (s = this.scale + i / 5), this.zoom(s, t.pageX, t.pageY, 0); 898 }, 899 _initWheel: function () { 900 f.addEvent(this.wrapper, 'wheel', this), 901 f.addEvent(this.wrapper, 'mousewheel', this), 902 f.addEvent(this.wrapper, 'DOMMouseScroll', this), 903 this.on('destroy', function () { 904 clearTimeout(this.wheelTimeout), 905 (this.wheelTimeout = null), 906 f.removeEvent(this.wrapper, 'wheel', this), 907 f.removeEvent(this.wrapper, 'mousewheel', this), 908 f.removeEvent(this.wrapper, 'DOMMouseScroll', this); 909 }); 910 }, 911 _wheel: function (t) { 912 if (this.enabled) { 913 t.preventDefault(); 914 var i, 915 s, 916 e, 917 o, 918 n = this; 919 if ( 920 (void 0 === this.wheelTimeout && n._execEvent('scrollStart'), 921 clearTimeout(this.wheelTimeout), 922 (this.wheelTimeout = setTimeout(function () { 923 n.options.snap || n._execEvent('scrollEnd'), (n.wheelTimeout = void 0); 924 }, 400)), 925 'deltaX' in t) 926 ) 927 s = 928 1 === t.deltaMode 929 ? ((i = -t.deltaX * this.options.mouseWheelSpeed), -t.deltaY * this.options.mouseWheelSpeed) 930 : ((i = -t.deltaX), -t.deltaY); 931 else if ('wheelDeltaX' in t) 932 (i = (t.wheelDeltaX / 120) * this.options.mouseWheelSpeed), 933 (s = (t.wheelDeltaY / 120) * this.options.mouseWheelSpeed); 934 else if ('wheelDelta' in t) i = s = (t.wheelDelta / 120) * this.options.mouseWheelSpeed; 935 else { 936 if (!('detail' in t)) return; 937 i = s = (-t.detail / 3) * this.options.mouseWheelSpeed; 938 } 939 if ( 940 ((i *= this.options.invertWheelDirection), 941 (s *= this.options.invertWheelDirection), 942 this.hasVerticalScroll || ((i = s), (s = 0)), 943 this.options.snap) 944 ) 945 return ( 946 (e = this.currentPage.pageX), 947 (o = this.currentPage.pageY), 948 0 < i ? e-- : i < 0 && e++, 949 0 < s ? o-- : s < 0 && o++, 950 void this.goToPage(e, o) 951 ); 952 (e = this.x + d.round(this.hasHorizontalScroll ? i : 0)), 953 (o = this.y + d.round(this.hasVerticalScroll ? s : 0)), 954 (this.directionX = 0 < i ? -1 : i < 0 ? 1 : 0), 955 (this.directionY = 0 < s ? -1 : s < 0 ? 1 : 0), 956 0 < e ? (e = 0) : e < this.maxScrollX && (e = this.maxScrollX), 957 0 < o ? (o = 0) : o < this.maxScrollY && (o = this.maxScrollY), 958 this.scrollTo(e, o, 0); 959 } 960 }, 961 _initSnap: function () { 962 (this.currentPage = {}), 963 'string' == typeof this.options.snap && 964 (this.options.snap = this.scroller.querySelectorAll(this.options.snap)), 965 this.on('refresh', function () { 966 var t, 967 i, 968 s, 969 e, 970 o, 971 n, 972 r, 973 h = 0, 974 a = 0, 975 l = 0, 976 c = this.options.snapStepX || this.wrapperW
976idth, 977 p = this.options.snapStepY || this.wrapperHeight; 978 if ( 979 ((this.pages = []), 980 this.wrapperWidth && this.wrapperHeight && this.scrollerWidth && this.scrollerHeight) 981 ) { 982 if (!0 === this.options.snap) 983 for (s = d.round(c / 2), e = d.round(p / 2); l > -this.scrollerWidth; ) { 984 for (this.pages[h] = [], o = t = 0; o > -this.scrollerHeight; ) 985 (this.pages[h][t] = { 986 x: d.max(l, this.maxScrollX), 987 y: d.max(o, this.maxScrollY), 988 width: c, 989 height: p, 990 cx: l - s, 991 cy: o - e, 992 }), 993 (o -= p), 994 t++; 995 (l -= c), h++; 996 } 997 else 998 for (t = (n = this.options.snap).length, i = -1; h < t; h++) 999 (r = f.getRect(n[h])), 1000 (0 === h || r.left <= f.getRect(n[h - 1]).left) && ((a = 0), i++), 1001 this.pages[a] || (this.pages[a] = []), 1002 (l = d.max(-r.left, this.maxScrollX)), 1003 (o = d.max(-r.top, this.maxScrollY)), 1004 (s = l - d.round(r.width / 2)), 1005 (e = o - d.round(r.height / 2)), 1006 (this.pages[a][i] = { x: l, y: o, width: r.width, height: r.height, cx: s, cy: e }), 1007 l > this.maxScrollX && a++; 1008 this.goToPage(this.currentPage.pageX || 0, this.currentPage.pageY || 0, 0), 1009 this.options.snapThreshold % 1 == 0 1010 ? ((this.snapThresholdX = this.options.snapThreshold), 1011 (this.snapThresholdY = this.options.snapThreshold)) 1012 : ((this.snapThresholdX = d.round( 1013 this.pages[this.currentPage.pageX][this.currentPage.pageY].width * 1014 this.options.snapThreshold 1015 )), 1016 (this.snapThresholdY = d.round( 1017 this.pages[this.currentPage.pageX][this.currentPage.pageY].height * 1018 this.options.snapThreshold 1019 ))); 1020 } 1021 }), 1022 this.on('flick', function () { 1023 var t = 1024 this.options.snapSpeed || 1025 d.max( 1026 d.max(d.min(d.abs(this.x - this.startX), 1e3), d.min(d.abs(this.y - this.startY), 1e3)), 1027 300 1028 ); 1029 this.goToPage( 1030 this.currentPage.pageX + this.directionX, 1031 this.currentPage.pageY + this.directionY, 1032 t 1033 ); 1034 }); 1035 }, 1036 _nearestSnap: function (t, i) { 1037 if (!this.pages.length) return { x: 0, y: 0, pageX: 0, pageY: 0 }; 1038 var s = 0, 1039 e = this.pages.length, 1040 o = 0; 1041 if (d.abs(t - this.absStartX) < this.snapThresholdX && d.abs(i - this.absStartY) < this.snapThresholdY) 1042 return this.currentPage; 1043 for ( 1044 0 < t ? (t = 0) : t < this.maxScrollX && (t = this.maxScrollX), 1045 0 < i ? (i = 0) : i < this.maxScrollY && (i = this.maxScrollY); 1046 s < e; 1047 s++ 1048 ) 1049 if (t >= this.pages[s][0].cx) { 1050 t = this.pages[s][0].x; 1051 break; 1052 } 1053 for (e = this.pages[s].length; o < e; o++) 1054 if (i >= this.pages[0][o].cy) { 1055 i = this.pages[0][o].y; 1056 break; 1057 } 1058 return ( 1059 s == this.currentPage.pageX && 1060 ((s += this.directionX) < 0 ? (s = 0) : s >= this.pages.length && (s = this.pages.length - 1), 1061 (t = this.pages[s][0].x)), 1062 o == this.currentPage.pageY && 1063 ((o += this.directionY) < 0 ? (o = 0) : o >= this.pages[0].length && (o = this.pages[0].length - 1), 1064 (i = this.pages[0][o].y)), 1065 { x: t, y: i, pageX: s, pageY: o } 1066 ); 1067 }, 1068 goToPage: function (t, i, s, e) { 1069 (e = e || this.options.bounceEasing), 1070 t >= this.pages.length ? (t = this.pages.length - 1) : t < 0 && (t = 0), 1071 i >= this.pages[t].length ? (i = this.pages[t].length - 1) : i < 0 && (i = 0); 1072 var o = this.pages[t][i].x, 1073 n = this.pages[t][i].y; 1074 (s = 1075 void 0 === s 1076 ? this.options.snapSpeed || 1077 d.max(d.max(d.min(d.abs(o - this.x), 1e3), d.min(d.abs(n - this.y), 1e3)), 300) 1078 : s), 1079 (this.currentPage = { x: o, y: n, pageX: t, pageY: i }), 1080 this.scrollTo(o, n, s, e); 1081 }, 1082 next: function (t, i) { 1083 var s = this.currentPage.pageX, 1084 e = this.currentPage.pageY; 1085 ++s >
1085= this.pages.length && this.hasVerticalScroll && ((s = 0), e++), this.goToPage(s, e, t, i); 1086 }, 1087 prev: function (t, i) { 1088 var s = this.currentPage.pageX, 1089 e = this.currentPage.pageY; 1090 --s < 0 && this.hasVerticalScroll && ((s = 0), e--), this.goToPage(s, e, t, i); 1091 }, 1092 _initKeys: function (t) { 1093 var i, 1094 s = { pageUp: 33, pageDown: 34, end: 35, home: 36, left: 37, up: 38, right: 39, down: 40 }; 1095 if ('object' == typeof this.options.keyBindings) 1096 for (i in this.options.keyBindings) 1097 'string' == typeof this.options.keyBindings[i] && 1098 (this.options.keyBindings[i] = this.options.keyBindings[i].toUpperCase().charCodeAt(0)); 1099 else this.options.keyBindings = {}; 1100 for (i in s) this.options.keyBindings[i] = this.options.keyBindings[i] || s[i]; 1101 f.addEvent(n, 'keydown', this), 1102 this.on('destroy', function () { 1103 f.removeEvent(n, 'keydown', this); 1104 }); 1105 }, 1106 _key: function (t) { 1107 if (this.enabled) { 1108 var i, 1109 s = this.options.snap, 1110 e = s ? this.currentPage.pageX : this.x, 1111 o = s ? this.currentPage.pageY : this.y, 1112 n = f.getTime(), 1113 r = this.keyTime || 0; 1114 switch ( 1115 (this.options.useTransition && 1116 this.isInTransition && 1117 ((i = this.getComputedPosition()), 1118 this._translate(d.round(i.x), d.round(i.y)), 1119 (this.isInTransition = !1)), 1120 (this.keyAcceleration = n - r < 200 ? d.min(this.keyAcceleration + 0.25, 50) : 0), 1121 t.keyCode) 1122 ) { 1123 case this.options.keyBindings.pageUp: 1124 this.hasHorizontalScroll && !this.hasVerticalScroll 1125 ? (e += s ? 1 : this.wrapperWidth) 1126 : (o += s ? 1 : this.wrapperHeight); 1127 break; 1128 case this.options.keyBindings.pageDown: 1129 this.hasHorizontalScroll && !this.hasVerticalScroll 1130 ? (e -= s ? 1 : this.wrapperWidth) 1131 : (o -= s ? 1 : this.wrapperHeight); 1132 break; 1133 case this.options.keyBindings.end: 1134 (e = s ? this.pages.length - 1 : this.maxScrollX), 1135 (o = s ? this.pages[0].length - 1 : this.maxScrollY); 1136 break; 1137 case this.options.keyBindings.home: 1138 o = e = 0; 1139 break; 1140 case this.options.keyBindings.left: 1141 e += s ? -1 : (5 + this.keyAcceleration) >> 0; 1142 break; 1143 case this.options.keyBindings.up: 1144 o += s ? 1 : (5 + this.keyAcceleration) >> 0; 1145 break; 1146 case this.options.keyBindings.right: 1147 e -= s ? -1 : (5 + this.keyAcceleration) >> 0; 1148 break; 1149 case this.options.keyBindings.down: 1150 o -= s ? 1 : (5 + this.keyAcceleration) >> 0; 1151 break; 1152 default: 1153 return; 1154 } 1155 s 1156 ? this.goToPage(e, o) 1157 : (0 < e 1158 ? ((e = 0), (this.keyAcceleration = 0)) 1159 : e < this.maxScrollX && ((e = this.maxScrollX), (this.keyAcceleration = 0)), 1160 0 < o 1161 ? ((o = 0), (this.keyAcceleration = 0)) 1162 : o < this.maxScrollY && ((o = this.maxScrollY), (this.keyAcceleration = 0)), 1163 this.scrollTo(e, o, 0), 1164 (this.keyTime = n)); 1165 } 1166 }, 1167 _animate: function (n, r, h, a) { 1168 var l = this, 1169 c = this.x, 1170 p = this.y, 1171 d = f.getTime(), 1172 u = d + h; 1173 (this.isAnimating = !0), 1174 (function t() { 1175 var i, 1176 s, 1177 e, 1178 o = f.getTime(); 1179 if (u <= o) 1180 return ( 1181 (l.isAnimating = !1), 1182 l._translate(n, r), 1183 void (l.resetPosition(l.options.bounceTime) || l._execEvent('scrollEnd')) 1184 ); 1185 (e = a((o = (o - d) / h))), 1186 (i = (n - c) * e + c), 1187 (s = (r - p) * e + p), 1188 l._translate(i, s), 1189 l.isAnimating && m(t); 1190 })(); 1191 }, 1192 handleEvent: function (t) { 1193 switch (t.type) { 1194 case 'touchstart': 1195 case 'pointerdown': 1196 case 'MSPointerDown': 1197 case 'mousedown': 1198 this._start(t), this.options.zoom && t.touches && 1 < t.touches.length && this._zoomStart(t); 1199 break; 1200 case 'touchmove': 1201 case 'pointermove': 1202 case 'MSPointerMove': 1203 case 'mousemove': 1204 if (this.options.zoom && t.touches && t.touches[1]) return void this._zoom(t); 1205 this._move(t); 1206 break; 1207 case 'touchend': 1208 case 'pointerup': 1209 case 'MSPointerUp': 1210 case 'mouseup': 1211 case 'touchcancel': 1212 case 'pointercancel': 1213 case 'MSPointerCancel': 1214 case 'mousecancel': 1215 if (this.scaled) return void this._zoomEnd(t); 1216 this._end(t); 1217 break; 1218 case 'orientationchange': 1219 case 'resize': 1220 this._resize(); 1221 break; 1222 case 'transitionend': 1223 case 'webkitTransitionEnd': 1224 case 'oTransitionEnd': 1225 case 'MSTransitionEnd': 1226 this._transitionEnd(t); 1227 break; 1228 case 'wheel': 1229 case 'DOMMouseScroll': 1230 case 'mousewheel': 1231 if ('zoom' == this.options.wheelAction) return void this._wheelZoom(t); 1232 this._wheel(t); 1233 break; 1234 case 'keydown': 1235 this._key(t); 1236 } 1237 }, 1238 }), 1239 (a.prototype = { 1240 handleEvent: function (t) { 1241 switch (t.type) { 1242 case 'touchstart': 1243 case 'pointerdown': 1244 case 'MSPointerDown': 1245 case 'mousedown': 1246 this._start(t); 1247 break; 1248 case 'touchmove': 1249 case 'pointermove': 1250 case 'MSPointerMove': 1251 case 'mousemove': 1252 this._move(t); 1253 break; 1254 case 'touchend': 1255 case 'pointerup': 1256 case 'MSPointerUp': 1257 case 'mouseup': 1258 case 'touchcancel': 1259 case 'pointercancel': 1260 case 'MSPointerCancel': 1261 case 'mousecancel': 1262 this._end(t); 1263 } 1264 }, 1265 destroy: function () { 1266 this.options.fadeScrollbars && (clearTimeout(this.fadeTimeout), (this.fadeTimeout = null)), 1267 this.options.interactive && 1268 (f.removeEvent(this.indicator, 'touchstart', this), 1269 f.removeEvent(this.indicator, f.prefixPointerEvent('pointerdown'), this), 1270 f.removeEvent(this.indicator, 'mousedown', this), 1271 f.removeEvent(n, 'touchmove', this), 1272 f.removeEvent(n, f.prefixPointerEvent('pointermove'), this), 1273 f.removeEvent(n, 'mousemove', this), 1274 f.removeEvent(n, 'touchend', this), 1275 f.removeEvent(n, f.prefixPointerEvent('pointerup'), this), 1276 f.removeEvent(n, 'mouseup', this)), 1277 this.options.defaultScrollbars && 1278 this.wrapper.parentNode && 1279 this.wrapper.parentNode.removeChild(this.wrapper); 1280 }, 1281 _start: function (t) { 1282 var i = t.touches ? t.touches[0] : t; 1283 t.preventDefault(), 1284 t.stopPropagation(), 1285 this.transitionTime(), 1286 (this.initiated = !0), 1287 (this.moved = !1), 1288 (this.lastPointX = i.pageX), 1289 (this.lastPointY = i.pageY), 1290 (this.startTime = f.getTime()), 1291 this.options.disableTouch || f.addEvent(n, 'touchmove', this), 1292 this.options.disablePointer || f.addEvent(n, f.prefixPointerEvent('pointermove'), this), 1293 this.options.disableMouse || f.addEvent(n, 'mousemove', this), 1294 this.scroller._execEvent('beforeScrollStart'); 1295 }, 1296 _move: function (t) { 1297 var i, 1298 s, 1299 e, 1300 o, 1301 n = t.touches ? t.touches[0] : t; 1302 f.getTime(); 1303 this.moved || this.scroller._execEvent('scrollStart'), 1304 (this.moved = !0), 1305 (i = n.pageX - this.lastPointX), 1306 (this.lastPointX = n.pageX), 1307 (s = n.pageY - this.lastPointY), 1308 (this.lastPointY = n.pageY), 1309 (e = this.x + i), 1310 (o = this.y + s), 1311 this._pos(e, o), 1312 t.preventDefault(), 1313 t.stopPropagation(); 1314 }, 1315 _end: function (t) { 1316 if (this.initiated) { 1317 if ( 1318 ((this.initiated = !1), 1319 t.preventDefault(), 1320 t.stopPropagation(), 1321 f.removeEvent(n, 'touchmove', this), 1322 f.removeEvent(n, f.prefixPointerEvent('pointermove'), this), 1323 f.removeEvent(n, 'mousemove', this), 1324 this.scroller.options.snap) 1325 ) { 1326 var i = this.scroller._nearestSnap(this.scroller.x, this.scroller.y), 1327 s = 1328 this.options.snapSpeed || 1329 d.max( 1330 d.max( 1331 d.min(d.abs(this.scroller.x - i.x), 1e3), 1332 d.min(d.abs(this.scroller.y - i.y), 1e3) 1333 ), 1334 300 1335 ); 1336 (this.scroller.x == i.x && this.scroller.y == i.y) || 1337 ((this.scroller.directionX = 0), 1338 (this.scroller.directionY = 0), 1339 (this.scroller.currentPage = i), 1340 this.scroller.scrollTo(i.x, i.y, s, this.scroller.options.bounceEasing)); 1341 } 1342 this.moved && this.scroller._execEvent('scrollEnd'); 1343 } 1344 }, 1345 transitionTime: function (t) { 1346 t = t || 0; 1347 var i = f.style.transitionDuration; 1348 if (i && ((this.indicatorStyle[i] = t + 'ms'), !t && f.isBadAndroid)) { 1349 this.indicatorStyle[i] = '0.0001ms'; 1350 var s = this; 1351 m(function () { 1352 '0.0001ms' === s.indicatorStyle[i] && (s.indicatorStyle[i] = '0s'); 1353 }); 1354 } 1355 }, 1356 transitionTimingFunction: function (t) { 1357 this.indicatorStyle[f.style.transitionTimingFunction] = t; 1358 }, 1359 refresh: function () { 1360 this.transitionTime(), 1361 this.options.listenX && !this.options.listenY 1362 ? (this.indicatorStyle.display = this.scroller.hasHorizontalScroll ? 'block' : 'none') 1363 : this.options.listenY && !this.options.listenX 1364 ? (this.indicatorStyle.display = this.scroller.hasVerticalScroll ? 'block' : 'none') 1365 : (this.indicatorStyle.display = 1366 this.scroller.hasHorizontalScroll || this.scroller.hasVerticalScroll ? 'block' : 'none'), 1367 this.scroller.hasHorizontalScroll && this.scroller.hasVerticalScroll 1368 ? (f.addClass(this.wrapper, 'iScrollBothScrollbars'), 1369 f.removeClass(this.wrapper, 'iScrollLoneScrollbar'), 1370 this.options.defaultScrollbars && 1371 this.options.customStyle && 1372 (this.options.listenX 1373 ? (this.wrapper.style.right = '8px') 1374 : (this.wrapper.style.bottom = '8px'))) 1375 : (f.removeClass(this.wrapper, 'iScrollBothScrollbars'), 1376 f.addClass(this.wrapper, 'iScrollLoneScrollbar'), 1377 this.options.defaultScrollbars && 1378 this.options.customStyle && 1379 (this.options.listenX 1380 ? (this.wrapper.style.right = '2px') 1381 : (this.wrapper.style.bottom = '2px'))), 1382 f.getRect(this.wrapper), 1383 this.options.listenX &&
1384 ((this.wrapperWidth = this.wrapper.clientWidth), 1385 this.options.resize 1386 ? ((this.indicatorWidth = d.max( 1387 d.round( 1388 (this.wrapperWidth * this.wrapperWidth) / 1389 (this.scroller.scrollerWidth || this.wrapperWidth || 1) 1390 ), 1391 8 1392 )), 1393 (this.indicatorStyle.width = this.indicatorWidth + 'px')) 1394 : (this.indicatorWidth = this.indicator.clientWidth), 1395 (this.maxPosX = this.wrapperWidth - this.indicatorWidth), 1396 'clip' == this.options.shrink 1397 ? ((this.minBoundaryX = 8 - this.indicatorWidth), 1398 (this.maxBoundaryX = this.wrapperWidth - 8)) 1399 : ((this.minBoundaryX = 0), (this.maxBoundaryX = this.maxPosX)), 1400 (this.sizeRatioX = 1401 this.options.speedRatioX || 1402 (this.scroller.maxScrollX && this.maxPosX / this.scroller.maxScrollX))), 1403 this.options.listenY && 1404 ((this.wrapperHeight = this.wrapper.clientHeight), 1405 this.options.resize 1406 ? ((this.indicatorHeight = d.max( 1407 d.round( 1408 (this.wrapperHeight * this.wrapperHeight) / 1409 (this.scroller.scrollerHeight || this.wrapperHeight || 1) 1410 ), 1411 8 1412 )), 1413 (this.indicatorStyle.height = this.indicatorHeight + 'px')) 1414 : (this.indicatorHeight = this.indicator.clientHeight), 1415 (this.maxPosY = this.wrapperHeight - this.indicatorHeight), 1416 'clip' == this.options.shrink 1417 ? ((this.minBoundaryY = 8 - this.indicatorHeight), 1418 (this.maxBoundaryY = this.wrapperHeight - 8)) 1419 : ((this.minBoundaryY = 0), (this.maxBoundaryY = this.maxPosY)), 1420 (this.maxPosY = this.wrapperHeight - this.indicatorHeight), 1421 (this.sizeRatioY = 1422 this.options.speedRatioY || 1423 (this.scroller.maxScrollY && this.maxPosY / this.scroller.maxScrollY))), 1424 this.updatePosition(); 1425 }, 1426 updatePosition: function () { 1427 var t = (this.options.listenX && d.round(this.sizeRatioX * this.scroller.x)) || 0, 1428 i = (this.options.listenY && d.round(this.sizeRatioY * this.scroller.y)) || 0; 1429 this.options.ignoreBoundaries || 1430 (t < this.minBoundaryX 1431 ? ('scale' == this.options.shrink && 1432 ((this.width = d.max(this.indicatorWidth + t, 8)), 1433 (this.indicatorStyle.width = this.width + 'px')), 1434 (t = this.minBoundaryX)) 1435 : t > this.maxBoundaryX 1436 ? (t = 1437 'scale' == this.options.shrink 1438 ? ((this.width = d.max(this.indicatorWidth - (t - this.maxPosX), 8)), 1439 (this.indicatorStyle.width = this.width + 'px'), 1440 this.maxPosX + this.indicatorWidth - this.width) 1441 : this.maxBoundaryX) 1442 : 'scale' == this.options.shrink && 1443 this.width != this.indicatorWidth && 1444 ((this.width = this.indicatorWidth), (this.indicatorStyle.width = this.width + 'px')), 1445 i < this.minBoundaryY 1446 ? ('scale' == this.options.shrink && 1447 ((this.height = d.max(this.indicatorHeight + 3 * i, 8)), 1448 (this.indicatorStyle.height = this.height + 'px')), 1449 (i = this.minBoundaryY)) 1450 : i > this.maxBoundaryY 1451 ? (i = 1452 'scale' == this.options.shrink 1453 ? ((this.height = d.max(this.indicatorHeight - 3 * (i - this.maxPosY), 8)), 1454 (this.indicatorStyle.height = this.height + 'px'), 1455 this.maxPosY + this.indicatorHeight - this.height) 1456 : this.maxBoundaryY) 1457 : 'scale' == this.options.shrink && 1458 this.height != this.indicatorHeight && 1459 ((this.height = this.indicatorHeight), (this.indicatorStyle.height = this.height + 'px'))), 1460 (this.x = t), 1461 (this.y = i), 1462 this.scroller.options.useTransform 1463 ? (this.indicatorStyle[f.style.transform] = 1464 'translate(' + t + 'px,' + i + 'px)' + this.scroller.translateZ) 1465 : ((this.indicatorStyle.left = t + 'px'), (this.indicatorStyle.top = i + 'px')); 1466 }, 1467 _pos: function (t, i) { 1468 t < 0 ? (t = 0) : t > this.maxPosX && (t = this.maxPosX), 1469 i < 0 ? (i = 0) : i > this.maxPosY && (i = this.maxPosY), 1470 (t = this.options.listenX ? d.round(t / this.sizeRatioX) : this.scroller.x), 1471 (i = this.options.listenY ? d.round(i / this.sizeRatioY) : this.scroller.y), 1472 this.scroller.scrollTo(t, i); 1473 }, 1474 fade: function (t, i) { 1475 if (!i || this.visible) { 1476 clearTimeout(this.fadeTimeout), (this.fadeTimeout = null); 1477 var s = t ? 250 : 500, 1478 e = t ? 0 : 300; 1479 (t = t ? '1' : '0'), 1480 (this.wrapperStyle[f.style.transitionDuration] = s + 'ms'), 1481 (this.fadeTimeout = setTimeout( 1482 function (t) { 1483 (this.wrapperStyle.opacity = t), (this.visible = +t); 1484 }.bind(this, t), 1485 e 1486 )); 1487 } 1488 }, 1489 }), 1490 (t.utils = f), 1491 'undefined' != typeof module && module.exports 1492 ? (module.exports = t) 1493 : 'function' == typeof define && define.amd 1494 ? define(function () { 1495 return t; 1496 }) 1497 : (n.IScroll = t), 1498 (n.FLIPBOOK = n.FLIPBOOK || {}), 1499 (n.FLIPBOOK.IScroll = t), 1500 (n.PointerEvent = void 0); 1501})(window, document, Math);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.