1/* Minification failed. Returning unminified contents. 2(4793,11-12): run-time error JS1010: Expected identifier: . 3(4793,11-12): run-time error JS1195: Expected expression: . 4 */ 5 6 7! function o(a, s, u) { 8 function c(t, e) { 9 if (!s[t]) { 10 if (!a[t]) { 11 var n = "function" == typeof require && require; 12 if (!e && n) return n(t, !0); 13 if (l) return l(t, !0); 14 var r = new Error("Cannot find module '" + t + "'"); 15 throw r.code = "MODULE_NOT_FOUND", r 16 } 17 var i = s[t] = { 18 exports: {} 19 }; 20 a[t][0].call(i.exports, function (e) { 21 return c(a[t][1][e] || e) 22 }, i, i.exports, o, a, s, u) 23 } 24 return s[t].exports 25 } 26 for (var l = "function" == typeof require && require, e = 0; e < u.length; e++) c(u[e]); 27 return c 28}({ 29 30 1: [function (e, t, n) { 31 "use strict"; 32 Object.defineProperty(n, "__esModule", { 33 value: !0 34 }), n.scrollToElement = void 0; 35 var r, i = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) { 36 return typeof e 37 } : function (e) { 38 return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e 39 }, 40 o = e("animejs"), 41 a = (r = o) && r.__esModule ? r : { 42 default: r 43 }; 44 var s = void 0; 45 46 function u() { 47 window.removeEventListener("touch", c, !1), window.removeEventListener("mousewheel", c, !1), window.removeEventListener("mousedown", c, !1) 48 } 49 50 function c() { 51 a.default.remove(s), u() 52 } 53 n.scrollToElement = function (e) { 54 if ("object" !== (void 0 === e ? "undefined" : i(e))) return console.warn("Warning, Non DOM element passed to scrollToElement"), !1; 55 var t = e.getBoundingClientRect(); 56 s = { 57 y: window.pageYOffset 58 }; 59 var n = t.top + s.y; 60 (0, a.default)({ 61 targets: s, 62 y: n, 63 duration: 1e3, 64 easing: "easeInOutCubic", 65 update: function () { 66 window.scroll(0, s.y) 67 }, 68 complete: function () { 69 u() 70 } 71 }); 72 window.addEventListener("touch", c, !1), window.addEventListener("mousewheel", c, !1), window.addEventListener("mousedown", c, !1) 73 } 74 }, { 75 animejs: 9 76 }], 77 2: [function (e, t, n) { 78 "use strict"; 79 Object.defineProperty(n, "__esModule", { 80 value: !0 81 }); 82 n.toArray = function (e) { 83 return e && void 0 !== e.length ? Array.prototype.slice.call(e, 0) : [e] 84 } 85 }, {}], 86 3: [function (e, t, n) { 87 "use strict"; 88 var r = e("helpers/shared/toArray"), 89 i = e("objects/shared/DOMReady"), 90 o = e("objects/shared/Resize"); 91 e("implementation/scrollToElement/scrollToElement"); 92 new i.DOMReady(function () { 93 var e = (0, r.toArray)(document.querySelectorAll("[data-back-to-top]")); 94 0 < e.length && e.forEach(function (e) { 95 var t = function (e) { 96 var t = e[0], 97 n = t.querySelector("[data-scroll-to]"), 98 r = (window.pageYOffset, document.body), 99 i = document.documentElement, 100 o = .4 * Math.max(r.scrollHeight, r.offsetHeight, i.clientHeight, i.scrollHeight, i.offsetHeight), 101 a = t.hasAttribute("data-back-to-top-show"); 102 window.pageYOffset > o && !a ? (t.setAttribute("data-back-to-top-show", ""), n && n.setAttribute("tabindex", "0")) : window.pageYOffset < o && a && (t.removeAttribute("data-back-to-top-show"), n && n.setAttribute("tabindex", "-1")) 103 }.bind(this, [e]); 104 window.addEventListener("scroll", t), new o.Resize(t), t() 105 }) 106 }) 107 }, { 108 "helpers/shared/toArray": 2, 109 "implementation/scrollToElement/scrollToElement": 5, 110 "objects/shared/DOMReady": 7, 111 "objects/shared/Resize": 8 112 }], 113 4: [function (e, t, n) { 114 "use strict"; 115 var r = e("helpers/shared/toArray"), 116 i = e("objects/shared/DOMReady"), 117 o = e("objects/shared/Cookie"); 118 new i.DOMReady(function () { 119 var e = (0, r.toArray)(document.querySelectorAll("[data-cookie-warning]")); 120 if (0 < e.length) { 121 var t = new o.Cookie; 122 void 0 === t.cookieWarning && e.forEach(function (e) { 123 e.setAttribute("data-cookie-warning", "show"), e.querySelector("[data-cookie-accept]").addEventListener("click", function () { 124 e.setAttribute("data-cookie-warning", "no"), t.add("cookieWarning", "true") 125 }) 126 }) 127 } 128 }) 129 }, { 130 "helpers/shared/toArray": 2, 131 "objects/shared/Cookie": 6, 132 "objects/shared/DOMReady": 7 133 }], 134 5: [function (e, t, n) { 135 "use strict"; 136 var r = e("helpers/shared/toArray"), 137 i = e("objects/shared/DOMReady"), 138 a = e("helpers/scrollToElement"); 139 new i.DOMReady(function () { 140 var e = (0, r.toArray)(document.querySelectorAll("[data-scroll-to]")); 141 0 < e.length && e.forEach(function (o) { 142 o.addEventListener("click", function (e) { 143 e.preventDefault(); 144 var t, n, r = o.getAttribute("data-scroll-to"), 145 i = (n = void 0, null != (n = (t = r).includes("data-") ? document.querySelector("[" + t + "]") : document.querySelector(t)) && n); 146 !1 !== i && (0, a.scrollToElement)(i) 147 }) 148 }) 149 }) 150 }, { 151 "helpers/scrollToElement": 1, 152 "helpers/shared/toArray": 2, 153 "objects/shared/DOMReady": 7 154 }], 155 6: [function (e, t, n) { 156 "use strict"; 157 Object.defineProperty(n, "__esModule", { 158 value: !0 159 }); 160 var r = n.Cookie = function () { 161 this.expiry = 30, this.path = "/", this.bake() 162 }; 163 r.prototype.bake = function () { 164 var n = this; 165 return document.cookie.split("; ").forEach(function (e) { 166 var i, o, t = e.split("="); 167 void 0 === n[t[0]] && (o = t[0], t[1], void 0 === (i = n)[o] && Object.defineProperty(i, o, { 168 get: function () { 169 for (var e = document.cookie.split("; "), t = void 0, n = e.length; n;) 170 if ((t = e[n -= 1].split("="))[0] === o) return t[1]; 171 return null 172 }, 173 set: function (e) { 174 for (var t = document.cookie.split("; "), n = void 0, r = t.length; r;) 175 if ((n = t[r -= 1].split("="))[0] === o) return i.delete(o), n[1] = e, t[r] = n.join("="), document.cookie = t.join("; "), e; 176 return null 177 } 178 })) 179 }), n 180 }, r.prototype.add = function (e, t, n, r) { 181 return void 0 === n && (n = new Date).setDate(n.getDate() + this.expiry), void 0 === r && (r = this.path), document.cookie = e + "=" + t + "; expires=" + n.toUTCString() + "; path=" + this.path, this.bake() 182 }, r.prototype.delete = function (e) { 183 var t = new Date; 184 return t.setDate(t.getDate() - 1), this.add(e, "", t) 185 } 186 }, {}], 187 7: [function (e, t, n) { 188 "use strict"; 189 Object.defineProperty(n, "__esModule", { 190 value: !0 191 }); 192 var r = [], 193 i = !1, 194 o = n.DOMReady = function (e) { 195 (this.callback = e) && this.init() 196 }; 197 o.prototype.init = function () { 198 !1 === i ? r.push(this.callback) : this.callback() 199 }, o.prototype.isReady = function () { 200 return i 201 }, document.addEventListener("DOMContentLoaded", function (t) { 202 i = !0, r.forEach(function (e) { 203 e(t) 204 }), r = [], t.preventDefault() 205 }, !0) 206 }, {}], 207 8: [function (e, t, n) { 208 "use strict"; 209 Object.defineProperty(n, "__esModule", { 210 value: !0 211 }); 212 var r = []; 213 window.addEventListener("resize", function (t) { 214 r.forEach(function (e) { 215 e && e(t) 216 }) 217 }); 218 var i = n.Resize = function (e) { 219 this.callback = e, this.index = void 0, e && this.attach(e) 220 }; 221 i.prototype.attach = function () { 222 var e = this; 223 return void 0 === e.index && (e.index = r.length, r[e.index] = e.callback), e 224 }, i.prototype.detach = function () { 225 return void 0 !== this.index && (r[this.index] = void 0, this.index = void 0), this 226 }, i.prototype.getCallbacks = function () { 227 return r 228 } 229 }, {}], 230 9: [function (e, r, t) { 231 (function (t) { 232 var o = { 233 scope: {} 234 }; 235 o.defineProperty = "function" == typeof Object.defineProperties ? Object.defineProperty : function (e, t, n) { 236 if (n.get || n.set) throw new TypeError("ES3 does not support getters and setters."); 237 e != Array.prototype && e != Object.prototype && (e[t] = n.value) 238 }, o.getGlobal = function (e) { 239 return "undefined" != typeof window && window === e ? e : void 0 !== t && null != t ? t : e 240 }, o.global = o.getGlobal(this), o.SYMBOL_PREFIX = "jscomp_symbol_", o.initSymbol = function () { 241 o.initSymbol = function () { }, o.global.Symbol || (o.global.Symbol = o.Symbol) 242 }, o.symbolCounter_ = 0, o.Symbol = function (e) { 243 return o.SYMBOL_PREFIX + (e || "") + o.symbolCounter_++ 244 }, o.initSymbolIterator = function () { 245 o.initSymbol(); 246 var e = o.global.Symbol.iterator; 247 e || (e = o.global.Symbol.iterator = o.global.Symbol("iterator")), "function" != typeof Array.prototype[e] && o.defineProperty(Array.prototype, e, { 248 configurable: !0, 249 writable: !0, 250 value: function () { 251 return o.arrayIterator(this) 252 } 253 }), o.initSymbolIterator = function () { } 254 }, o.arrayIterator = function (e) { 255 var t = 0; 256 return o.iteratorPrototype(function () { 257 return t < e.length ? { 258 done: !1, 259 value: e[t++] 260 } : { 261 done: !0 262 } 263 }) 264 }, o.iteratorPrototype = function (e) { 265 return o.initSymbolIterator(), (e = { 266 next: e 267 })[o.global.Symbol.iterator] = function () { 268 return this 269 }, e 270 }, o.array = o.array || {}, o.iteratorFromArray = function (t, n) { 271 o.initSymbolIterator(), t instanceof String && (t += ""); 272 var r = 0, 273 i = { 274 next: function () { 275 if (r < t.length) { 276 var e = r++; 277 return { 278 value: n(e, t[e]), 279 done: !1 280 } 281 } 282 return i.next = function () { 283 return { 284 done: !0, 285 value: void 0 286 } 287 }, i.next() 288 } 289 }; 290 return i[Symbol.iterator] = function () { 291 return i 292 }, i 293 }, o.polyfill = function (e, t, n, r) { 294 if (t) { 295 for (n = o.global, e = e.split("."), r = 0; r < e.length - 1; r++) { 296 var i = e[r]; 297 i in n || (n[i] = {}), n = n[i] 298 } (t = t(r = n[e = e[e.length - 1]])) != r && null != t && o.defineProperty(n, e, { 299 configurable: !0, 300 writable: !0, 301 value: t 302 }) 303 } 304 }, o.polyfill("Array.prototype.keys", function (e) { 305 return e || function () { 306 return o.iteratorFromArray(this, function (e) { 307 return e 308 }) 309 } 310 }, "es6-impl", "es3"); 311 var e, n, H = this; 312 e = this, n = function () { 313 function i(e) { 314 if (!L.col(e)) try { 315 return document.querySelectorAll(e) 316 } catch (e) { } 317 } 318 319 function w(e, t) { 320 for (var n = e.length, r = 2 <= arguments.length ? t : void 0, i = [], o = 0; o < n; o++) 321 if (o in e) { 322 var a = e[o]; 323 t.call(r, a, o, e) && i.push(a) 324 } 325 return i 326 } 327 328 function d(e) { 329 return e.reduce(function (e, t) { 330 return e.concat(L.arr(t) ? d(t) : t) 331 }, []) 332 } 333 334 function o(e) { 335 return L.arr(e) ? e : (L.str(e) && (e = i(e) || e), e instanceof NodeList || e instanceof HTMLCollection ? [].slice.call(e) : [e]) 336 } 337 338 function a(e, t) { 339 return e.some(function (e) { 340 return e === t 341 }) 342 } 343 344 function s(e) { 345 var t, n = {}; 346 for (t in e) n[t] = e[t]; 347 return n 348 } 349 350 function h(e, t) { 351 var n, r = s(e); 352 for (n in e) r[n] = t.hasOwnProperty(n) ? t[n] : e[n]; 353 return r 354 } 355 356 function f(e, t) { 357 var n, r = s(e); 358 for (n in t) r[n] = L.und(e[n]) ? t[n] : e[n]; 359 return r 360 } 361 362 function u(e) { 363 if (e = /([\+\-]?[0-9#\.]+)(%|px|pt|em|rem|in|cm|mm|ex|ch|pc|vw|vh|vmin|vmax|deg|rad|turn)?$/.exec(e)) return e[2] 364 } 365 366 function c(e, t) { 367 return L.fnc(e) ? e(t.target, t.id, t.total) : e 368 } 369 370 function S(e, t) { 371 if (t in e.style) return getComputedStyle(e).getPropertyValue(t.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()) || "0" 372 } 373 374 function p(e, t) { 375 return L.dom(e) && a(j, t) ? "transform" : L.dom(e) && (e.getAttribute(t) || L.svg(e) && e[t]) ? "attribute" : L.dom(e) && "transform" !== t && S(e, t) ? "css" : null != e[t] ? "object" : void 0 376 } 377 378 function l(e, t) { 379 switch (p(e, t)) { 380 case "transform": 381 return function (e, n) { 382 var t, r = -1 < (t = n).indexOf("translate") || "perspective" === t ? "px" : -1 < t.indexOf("rotate") || -1 < t.indexOf("skew") ? "deg" : void 0; 383
vendor: 25,252 bytes, lines 383-873
383 if (r = -1 < n.indexOf("scale") ? 1 : 0 + r, !(e = e.style.transform)) return r; 384 for (var i = [], o = [], a = [], s = /(\w+)\((.+?)\)/g; i = s.exec(e) ;) o.push(i[1]), a.push(i[2]); 385 return (e = w(a, function (e, t) { 386 return o[t] === n 387 })).length ? e[0] : r 388 }(e, t); 389 case "css": 390 return S(e, t); 391 case "attribute": 392 return e.getAttribute(t) 393 } 394 return e[t] || 0 395 } 396 397 function v(e, t) { 398 var n = /^(\*=|\+=|-=)/.exec(e); 399 if (!n) return e; 400 var r = u(e) || 0; 401 switch (t = parseFloat(t), e = parseFloat(e.replace(n[0], "")), n[0][0]) { 402 case "+": 403 return t + e + r; 404 case "-": 405 return t - e + r; 406 case "*": 407 return t * e + r 408 } 409 } 410 411 function m(e, t) { 412 return Math.sqrt(Math.pow(t.x - e.x, 2) + Math.pow(t.y - e.y, 2)) 413 } 414 415 function n(e) { 416 e = e.points; 417 for (var t, n = 0, r = 0; r < e.numberOfItems; r++) { 418 var i = e.getItem(r); 419 0 < r && (n += m(t, i)), t = i 420 } 421 return n 422 } 423 424 function y(e) { 425 if (e.getTotalLength) return e.getTotalLength(); 426 switch (e.tagName.toLowerCase()) { 427 case "circle": 428 return 2 * Math.PI * e.getAttribute("r"); 429 case "rect": 430 return 2 * e.getAttribute("width") + 2 * e.getAttribute("height"); 431 case "line": 432 return m({ 433 x: e.getAttribute("x1"), 434 y: e.getAttribute("y1") 435 }, { 436 x: e.getAttribute("x2"), 437 y: e.getAttribute("y2") 438 }); 439 case "polyline": 440 return n(e); 441 case "polygon": 442 var t = e.points; 443 return n(e) + m(t.getItem(t.numberOfItems - 1), t.getItem(0)) 444 } 445 } 446 447 function A(t, n) { 448 function e(e) { 449 return e = void 0 === e ? 0 : e, t.el.getPointAtLength(1 <= n + e ? n + e : 0) 450 } 451 var r = e(), 452 i = e(-1), 453 o = e(1); 454 switch (t.property) { 455 case "x": 456 return r.x; 457 case "y": 458 return r.y; 459 case "angle": 460 return 180 * Math.atan2(o.y - i.y, o.x - i.x) / Math.PI 461 } 462 } 463 464 function g(e, t) { 465 var n, r = /-?\d*\.?\d+/g; 466 if (n = L.pth(e) ? e.totalLength : e, L.col(n)) 467 if (L.rgb(n)) { 468 var i = /rgb\((\d+,\s*[\d]+,\s*[\d]+)\)/g.exec(n); 469 n = i ? "rgba(" + i[1] + ",1)" : n 470 } else n = L.hex(n) ? function (e) { 471 e = e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i, function (e, t, n, r) { 472 return t + t + n + n + r + r 473 }); 474 var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); 475 return "rgba(" + (e = parseInt(t[1], 16)) + "," + parseInt(t[2], 16) + "," + (t = parseInt(t[3], 16)) + ",1)" 476 }(n) : L.hsl(n) ? function (e) { 477 function t(e, t, n) { 478 return n < 0 && (n += 1), 1 < n && --n, n < 1 / 6 ? e + 6 * (t - e) * n : n < .5 ? t : n < 2 / 3 ? e + (t - e) * (2 / 3 - n) * 6 : e 479 } 480 var n = /hsl\((\d+),\s*([\d.]+)%,\s*([\d.]+)%\)/g.exec(e) || /hsla\((\d+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)/g.exec(e); 481 e = parseInt(n[1]) / 360; 482 var r = parseInt(n[2]) / 100, 483 i = parseInt(n[3]) / 100; 484 if (n = n[4] || 1, 0 == r) i = r = e = i; 485 else { 486 var o = i < .5 ? i * (1 + r) : i + r - i * r, 487 a = 2 * i - o; 488 i = t(a, o, e + 1 / 3), r = t(a, o, e), e = t(a, o, e - 1 / 3) 489 } 490 return "rgba(" + 255 * i + "," + 255 * r + "," + 255 * e + "," + n + ")" 491 }(n) : void 0; 492 else i = (i = u(n)) ? n.substr(0, n.length - i.length) : n, n = t && !/\s/g.test(n) ? i + t : i; 493 return { 494 original: n += "", 495 numbers: n.match(r) ? n.match(r).map(Number) : [0], 496 strings: L.str(e) || t ? n.split(r) : [] 497 } 498 } 499 500 function b(e) { 501 return w(e = e ? d(L.arr(e) ? e.map(o) : o(e)) : [], function (e, t, n) { 502 return n.indexOf(e) === t 503 }) 504 } 505 506 function E(e, n) { 507 var t = s(n); 508 if (L.arr(e)) { 509 var r = e.length; 510 2 !== r || L.obj(e[0]) ? L.fnc(n.duration) || (t.duration = n.duration / r) : e = { 511 value: e 512 } 513 } 514 return o(e).map(function (e, t) { 515 return t = t ? 0 : n.delay, e = L.obj(e) && !L.pth(e) ? e : { 516 value: e 517 }, L.und(e.delay) && (e.delay = t), e 518 }).map(function (e) { 519 return f(e, t) 520 }) 521 } 522 523 function T(o, a) { 524 var s; 525 return o.tweens.map(function (e) { 526 var t = (e = function (e, t) { 527 var n, r = {}; 528 for (n in e) { 529 var i = c(e[n], t); 530 L.arr(i) && 1 === (i = i.map(function (e) { 531 return c(e, t) 532 })).length && (i = i[0]), r[n] = i 533 } 534 return r.duration = parseFloat(r.duration), r.delay = parseFloat(r.delay), r 535 }(e, a)).value, 536 n = l(a.target, o.name), 537 r = s ? s.to.original : n, 538 i = (r = L.arr(t) ? t[0] : r, v(L.arr(t) ? t[1] : t, r)); 539 n = u(i) || u(r) || u(n); 540 return e.from = g(r, n), e.to = g(i, n), e.start = s ? s.end : o.offset, e.end = e.start + e.delay + e.duration, e.easing = function (e) { 541 return L.arr(e) ? D.apply(this, e) : P[e] 542 }(e.easing), e.elasticity = (1e3 - Math.min(Math.max(e.elasticity, 1), 999)) / 1e3, e.isPath = L.pth(t), e.isColor = L.col(e.from.original), e.isColor && (e.round = 1), s = e 543 }) 544 } 545 546 function M(t, e, n, r) { 547 var i = "delay" === t; 548 return e.length ? (i ? Math.min : Math.max).apply(Math, e.map(function (e) { 549 return e[t] 550 })) : i ? r.delay : n.offset + r.delay + r.duration 551 } 552 553 function r(e) { 554 var t, n, r, i, o, a = h(O, e), 555 s = h(x, e), 556 u = (n = e.targets, (r = b(n)).map(function (e, t) { 557 return { 558 target: e, 559 id: t, 560 total: r.length 561 } 562 })), 563 c = [], 564 l = f(a, s); 565 for (t in e) l.hasOwnProperty(t) || "targets" === t || c.push({ 566 name: t, 567 offset: l.offset, 568 tweens: E(e[t], s) 569 }); 570 return o = c, f(a, { 571 children: [], 572 animatables: i = u, 573 animations: e = w(d(i.map(function (r) { 574 return o.map(function (e) { 575 var t = p(r.target, e.name); 576 if (t) { 577 var n = T(e, r); 578 e = { 579 type: t, 580 property: e.name, 581 animatable: r, 582 tweens: n, 583 duration: n[n.length - 1].end, 584 delay: n[0].delay 585 } 586 } else e = void 0; 587 return e 588 }) 589 })), function (e) { 590 return !L.und(e) 591 }), 592 duration: M("duration", e, a, s), 593 delay: M("delay", e, a, s) 594 }) 595 } 596 597 function k(e) { 598 function l() { 599 return window.Promise && new Promise(function (e) { 600 return g = e 601 }) 602 } 603 604 function d(e) { 605 return E.reversed ? E.duration - e : e 606 } 607 608 function h(t) { 609 for (var e = 0, n = {}, r = E.animations, i = r.length; e < i;) { 610 var o = r[e], 611 a = o.animatable, 612 s = (u = o.tweens)[d = u.length - 1]; 613 d && (s = w(u, function (e) { 614 return t < e.end 615 })[0] || s); 616 for (var u = Math.min(Math.max(t - s.start - s.delay, 0), s.duration) / s.duration, c = isNaN(u) ? 1 : s.easing(u, s.elasticity), l = (u = s.to.strings, s.round), d = [], h = void 0, f = (h = s.to.numbers.length, 0) ; f < h; f++) { 617 var p = void 0, 618 v = (p = s.to.numbers[f], s.from.numbers[f]); 619 p = s.isPath ? A(s.value, c * p) : v + c * (p - v); 620 l && (s.isColor && 2 < f || (p = Math.round(p * l) / l)), d.push(p) 621 } 622 if (s = u.length) 623 for (h = u[0], c = 0; c < s; c++) l = u[c + 1], f = d[c], isNaN(f) || (h = l ? h + (f + l) : h + (f + " ")); 624 else h = d[0]; 625 I[o.type](a.target, o.property, h, n, a.id), o.currentValue = h, e++ 626 } 627 if (e = Object.keys(n).length) 628 for (r = 0; r < e; r++) _ || (_ = S(document.body, "transform") ? "transform" : "-webkit-transform"), E.animatables[r].target.style[_] = n[r].join(" "); 629 E.currentTime = t, E.progress = t / E.duration * 100 630 } 631 632 function f(e) { 633 E[e] && E[e](E) 634 } 635 636 function p() { 637 E.remaining && !0 !== E.remaining && E.remaining-- 638 } 639 640 function t(e) { 641 var t = E.duration, 642 n = E.offset, 643 r = n + E.delay, 644 i = E.currentTime, 645 o = E.reversed, 646 a = d(e); 647 if (E.children.length) { 648 var s = E.children, 649 u = s.length; 650 if (a >= E.currentTime) 651 for (var c = 0; c < u; c++) s[c].seek(a); 652 else 653 for (; u--;) s[u].seek(a) 654 } (r <= a || !t) && (E.began || (E.began = !0, f("begin")), f("run")), n < a && a < t ? h(a) : (a <= n && 0 !== i && (h(0), o && p()), (t <= a && i !== t || !t) && (h(t), o || p())), f("update"), t <= e && (E.remaining ? (m = v, "alternate" === E.direction && (E.reversed = !E.reversed)) : (E.pause(), E.completed || (E.completed = !0, f("complete"), "Promise" in window && (g(), b = l()))), y = 0) 655 } 656 e = void 0 === e ? {} : e; 657 var v, m, y = 0, 658 g = null, 659 b = l(), 660 E = r(e); 661 return E.reset = function () { 662 var e = E.direction, 663 t = E.loop; 664 for (E.currentTime = 0, E.progress = 0, E.paused = !0, E.began = !1, E.completed = !1, E.reversed = "reverse" === e, E.remaining = "alternate" === e && 1 === t ? 2 : t, h(0), e = E.children.length; e--;) E.children[e].reset() 665 }, E.tick = function (e) { 666 v = e, m || (m = v), t((y + v - m) * k.speed) 667 }, E.seek = function (e) { 668 t(d(e)) 669 }, E.pause = function () { 670 var e = C.indexOf(E); -1 < e && C.splice(e, 1), E.paused = !0 671 }, E.play = function () { 672 E.paused && (E.paused = !1, m = 0, y = d(E.currentTime), C.push(E), R || q()) 673 }, E.reverse = function () { 674 E.reversed = !E.reversed, m = 0, y = d(E.currentTime) 675 }, E.restart = function () { 676 E.pause(), E.reset(), E.play() 677 }, E.finished = b, E.reset(), E.autoplay && E.play(), E 678 } 679 var _, O = { 680 update: void 0, 681 begin: void 0, 682 run: void 0, 683 complete: void 0, 684 loop: 1, 685 direction: "normal", 686 autoplay: !0, 687 offset: 0 688 }, 689 x = { 690 duration: 1e3, 691 delay: 0, 692 easing: "easeOutElastic", 693 elasticity: 500, 694 round: 0 695 }, 696 j = "translateX translateY translateZ rotate rotateX rotateY rotateZ scale scaleX scaleY scaleZ skewX skewY perspective".split(" "), 697 L = { 698 arr: function (e) { 699 return Array.isArray(e) 700 }, 701 obj: function (e) { 702 return -1 < Object.prototype.toString.call(e).indexOf("Object") 703 }, 704 pth: function (e) { 705 return L.obj(e) && e.hasOwnProperty("totalLength") 706 }, 707 svg: function (e) { 708 return e instanceof SVGElement 709 }, 710 dom: function (e) { 711 return e.nodeType || L.svg(e) 712 }, 713 str: function (e) { 714 return "string" == typeof e 715 }, 716 fnc: function (e) { 717 return "function" == typeof e 718 }, 719 und: function (e) { 720 return void 0 === e 721 }, 722 hex: function (e) { 723 return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e) 724 }, 725 rgb: function (e) { 726 return /^rgb/.test(e) 727 }, 728 hsl: function (e) { 729 return /^hsl/.test(e) 730 }, 731 col: function (e) { 732 return L.hex(e) || L.rgb(e) || L.hsl(e) 733 } 734 }, 735 D = function () { 736 function d(e, t, n) { 737 return (((1 - 3 * n + 3 * t) * e + (3 * n - 6 * t)) * e + 3 * t) * e 738 } 739 return function (a, s, u, c) { 740 if (0 <= a && a <= 1 && 0 <= u && u <= 1) { 741 var l = new Float32Array(11); 742 if (a !== s || u !== c) 743 for (var e = 0; e < 11; ++e) l[e] = d(.1 * e, a, u); 744 return function (e) { 745 if (a === s && u === c) return e; 746 if (0 === e) return 0; 747 if (1 === e) return 1; 748 for (var t = 0, n = 1; 10 !== n && l[n] <= e; ++n) t += .1; 749 n = t + (e - l[--n]) / (l[n + 1] - l[n]) * .1; 750 var r = 3 * (1 - 3 * u + 3 * a) * n * n + 2 * (3 * u - 6 * a) * n + 3 * a; 751 if (.001 <= r) { 752 for (t = 0; t < 4 && 0 !== (r = 3 * (1 - 3 * u + 3 * a) * n * n + 2 * (3 * u - 6 * a) * n + 3 * a) ; ++t) { 753 var i = d(n, a, u) - e; 754 n = n - i / r 755 } 756 e = n 757 } else if (0 === r) e = n; 758 else { 759 n = t, t = t + .1; 760 for (var o = 0; 0 < (r = d(i = n + (t - n) / 2, a, u) - e) ? t = i : n = i, 1e-7 < Math.abs(r) && ++o < 10;); 761 e = i 762 } 763 return d(e, s, c) 764 } 765 } 766 } 767 }(), 768 P = function () { 769 function n(e, t) { 770 return 0 === e || 1 === e ? e : -Math.pow(2, 10 * (e - 1)) * Math.sin(2 * (e - 1 - t / (2 * Math.PI) * Math.asin(1)) * Math.PI / t) 771 } 772 var e, r = "Quad Cubic Quart Quint Sine Expo Circ Back Elastic".split(" "), 773 t = { 774 In: [ 775 [.55, .085, .68, .53], 776 [.55, .055, .675, .19], 777 [.895, .03, .685, .22], 778 [.755, .05, .855, .06], 779 [.47, 0, .745, .715], 780 [.95, .05, .795, .035], 781 [.6, .04, .98, .335], 782 [.6, -.28, .735, .045], n 783 ], 784 Out: [ 785 [.25, .46, .45, .94], 786 [.215, .61, .355, 1], 787 [.165, .84, .44, 1], 788 [.23, 1, .32, 1], 789 [.39, .575, .565, 1], 790 [.19, 1, .22, 1], 791 [.075, .82, .165, 1], 792 [.175, .885, .32, 1.275], 793 function (e, t) { 794 return 1 - n(1 - e, t) 795 } 796 ], 797 InOut: [ 798 [.455, .03, .515, .955], 799 [.645, .045, .355, 1], 800 [.77, 0, .175, 1], 801 [.86, 0, .07, 1], 802 [.445, .05, .55, .95], 803 [1, 0, 0, 1], 804 [.785, .135, .15, .86], 805 [.68, -.55, .265, 1.55], 806 function (e, t) { 807 return e < .5 ? n(2 * e, t) / 2 : 1 - n(-2 * e + 2, t) / 2 808 } 809 ] 810 }, 811 i = { 812 linear: D(.25, .25, .75, .75) 813 }, 814 o = {}; 815 for (e in t) o.type = e, t[o.type].forEach(function (n) { 816 return function (e, t) { 817 i["ease" + n.type + r[t]] = L.fnc(e) ? e : D.apply(H, e) 818 } 819 }(o)), o = { 820 type: o.type 821 }; 822 return i 823 }(), 824 I = { 825 css: function (e, t, n) { 826 return e.style[t] = n 827 }, 828 attribute: function (e, t, n) { 829 return e.setAttribute(t, n) 830 }, 831 object: function (e, t, n) { 832 return e[t] = n 833 }, 834 transform: function (e, t, n, r, i) { 835 r[i] || (r[i] = []), r[i].push(t + "(" + n + ")") 836 } 837 }, 838 C = [], 839 R = 0, 840 q = function () { 841 function r() { 842 R = requestAnimationFrame(e) 843 } 844 845 function e(e) { 846 var t = C.length; 847 if (t) { 848 for (var n = 0; n < t;) C[n] && C[n].tick(e), n++; 849 r() 850 } else cancelAnimationFrame(R), R = 0 851 } 852 return r 853 }(); 854 return k.version = "2.2.0", k.speed = 1, k.running = C, k.remove = function (e) { 855 e = b(e); 856 for (var t = C.length; t--;) 857 for (var n = C[t], r = n.animations, i = r.length; i--;) a(e, r[i].animatable.target) && (r.splice(i, 1), r.length || n.pause()) 858 }, k.getValue = l, k.path = function (e, t) { 859 var n = L.str(e) ? i(e)[0] : e, 860 r = t || 100; 861 return function (e) { 862 return { 863 el: n, 864 property: e, 865 totalLength: y(n) * (r / 100) 866 } 867 } 868 }, k.setDashoffset = function (e) { 869 var t = y(e); 870 return e.setAttribute("stroke-dasharray", t), t 871 }, k.bezier = D, k.easings = P, k.timeline = function (r) { 872 var i = k(r); 873 return i.pause(), i.duration = 0, i.add = function (e) {
874 return i.children.forEach(function (e) { 875 e.began = !0, e.completed = !0 876 }), o(e).forEach(function (e) { 877 var t = f(e, h(x, r || {})); 878 t.targets = t.targets || r.targets, e = i.duration; 879 var n = t.offset; 880 t.autoplay = !1, t.direction = i.direction, t.offset = L.und(n) ? e : v(n, e), i.began = !0, i.completed = !0, i.seek(t.offset), (t = k(t)).began = !0, t.completed = !0, t.duration > e && (i.duration = t.duration), i.children.push(t) 881 }), i.seek(0), i.reset(), i.autoplay && i.restart(), i 882 }, i 883 }, k.random = function (e, t) { 884 return Math.floor(Math.random() * (t - e + 1)) + e 885 }, k 886 }, "function" == typeof define && define.amd ? define([], n) : "object" == typeof r && r.exports ? r.exports = n() : e.anime = n() 887 }).call(this, "undefined" != typeof global ? global : "undefined" != typeof self ? self : "undefined" != typeof window ? window : {}) 888 }, {}] 889}, {}, [3, 4, 5]); 890 891 892 893 894// new code 895 896!function(t){"function"==typeof define&&define.amd?define(["shoestring"],t):"object"==typeof module&&module.exports?module.exports=t():t()}(function(){var s="undefined"!=typeof window?window:this,o=s.document;function l(t,e){var n=typeof t;if(!t)return new i([]);if(t.call)return l.ready(t);if(t.constructor===i&&!e)return t;if("string"!=n||0!==t.indexOf("<"))return"string"==n?e?l(e).find(t):(e=o.querySelectorAll(t),new i(e,t)):"[object Array]"===Object.prototype.toString.call(n)||s.NodeList&&t instanceof s.NodeList||t.constructor===Array?new i(t,t):new i([t],t);var a=o.createElement("div");return a.innerHTML=t,l(a).children().each(function(){a.removeChild(this)})}var i=function(t,e){this.length=0,this.selector=e,l.merge(this,t)};i.prototype.reverse=[].reverse,l.fn=i.prototype,l.Shoestring=i,l.extend=function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},l.merge=function(t,e){for(var n=Number(e.length),a=0,s=t.length;a<n;a++)t[s++]=e[a];return t.length=s,t},(s.shoestring=l).fn.each=function(t){return l.each(this,t)},l.each=function(t,e){for(var n=0,a=t.length;n<a&&!1!==e.call(t[n],n,t[n]);n++);return t},l.inArray=function(t,e){for(var n=-1,a=0,s=e.length;a<s;a++)e.hasOwnProperty(a)&&e[a]===t&&(n=a);return n},l.ready=function(t){return e&&t?t.call(o):t?n.push(t):a(),[o]};var r,c,h,e=!(l.fn.ready=function(t){return l.ready(t),this}),n=[],a=function(){if(!e){for(;n.length;)n.shift().call(o);e=!0}};function u(t,e){var n=!1;return t.each(function(){for(var t=0;t<e.length;)this===e[t]&&(n=!0),t++}),n}function d(t,e){return s.getComputedStyle(t,null).getPropertyValue(e)}(o.attachEvent?"complete"===o.readyState:"loading"!==o.readyState)?a():(o.addEventListener("DOMContentLoaded",a,!1),o.addEventListener("readystatechange",a,!1),s.addEventListener("load",a,!1)),l.fn.is=function(n){var t,a=!1,s=this;return"string"!=typeof n?u(this,n.length&&n[0]?n:[n]):((t=!(t=this.parent()).length?l(o):t).each(function(t,e){e=e.querySelectorAll(n);a=u(s,e)}),a)},l.fn.data=function(t,e){return void 0!==t?void 0!==e?this.each(function(){this.shoestringData||(this.shoestringData={}),this.shoestringData[t]=e}):this[0]&&this[0].shoestringData?this[0].shoestringData[t]:void 0:this[0]?this[0].shoestringData||{}:void 0},l.fn.removeData=function(t){return this.each(function(){void 0!==t&&this.shoestringData?(this.shoestringData[t]=void 0,delete this.shoestringData[t]):this[0].shoestringData={}})},(s.$=l).fn.addClass=function(t){var n=t.replace(/^\s+|\s+$/g,"").split(" ");return this.each(function(){for(var t=0,e=n.length;t<e;t++)void 0===this.className||""!==this.className&&this.className.match(new RegExp("(^|\\s)"+n[t]+"($|\\s)"))||(this.className+=" "+n[t])})},l.fn.add=function(t){var e=[];return this.each(function(){e.push(this)}),l(t).each(function(){e.push(this)}),l(e)},l.fn.append=function(a){return"string"!=typeof a&&void 0===a.nodeType||(a=l(a)),this.each(function(t){for(var e=0,n=a.length;e<n;e++)this.appendChild(0<t?a[e].cloneNode(!0):a[e])})},l.fn.appendTo=function(t){return this.each(function(){l(t).append(this)})},l.fn.attr=function(e,n){var a="string"==typeof e;return void 0===n&&a?this[0]?this[0].getAttribute(e):void 0:this.each(function(){if(a)this.setAttribute(e,n);else for(var t in e)e.hasOwnProperty(t)&&this.setAttribute(t,e[t])})},l.fn.before=function(a){return"string"!=typeof a&&void 0===a.nodeType||(a=l(a)),this.each(function(t){for(var e=0,n=a.length;e<n;e++)this.parentNode.insertBefore(0<t?a[e].cloneNode(!0):a[e],this)})},l.fn.children=function(){var t,e,n=[];return this.each(function(){for(t=this.children,e=-1;e++<t.length-1;)-1===l.inArray(t[e],n)&&n.push(t[e])}),l(n)},l.fn.closest=function(e){var n=[];return e&&this.each(function(){var t;if(l(t=this).is(e))n.push(this);else for(;t.parentElement;){if(l(t.parentElement).is(e)){n.push(t.parentElement);break}t=t.parentElement}}),l(n)},l.cssExceptions={float:["cssFloat"]},r=l.cssExceptions,c=["","-webkit-","-ms-","-moz-","-o-","-khtml-"],l._getStyle=function(t,e){var n,a,s,i;if(r[e])for(s=0,i=r[e].length;s<i;
896s++)if(a=d(t,r[e][s]))return a;for(s=0,i=c.length;s<i;s++)if(a=d(t,n=(c[s]+e).replace(/\-([A-Za-z])/g,function(t,e){return e.toUpperCase()})),n!==e&&(a=a||d(t,e)),a=c[s]?a||d(t,c[s]+e):a)return a},h=l.cssExceptions,l._setStyle=function(t,e,n){var a=e.replace(/\-([A-Za-z])/g,function(t,e){return e.toUpperCase()});if(t.style[e]=n,a!==e&&(t.style[a]=n),h[e])for(var s=0,i=h[e].length;s<i;s++)t.style[h[e][s]]=n},l.fn.css=function(e,t){if(this[0])return"object"==typeof e?this.each(function(){for(var t in e)e.hasOwnProperty(t)&&l._setStyle(this,t,e[t])}):void 0!==t?this.each(function(){l._setStyle(this,e,t)}):l._getStyle(this[0],e)},l.fn.eq=function(t){return this[t]?l(this[t]):l([])},l.fn.filter=function(n){var a=[];return this.each(function(t){var e;"function"==typeof n?!1!==n.call(this,t)&&a.push(this):(e=this.parentNode?l(n,this.parentNode):((e=l(o.createDocumentFragment()))[0].appendChild(this),l(n,e)),-1<l.inArray(this,e)&&a.push(this))}),l(a)},l.fn.find=function(n){var a,s=[];return this.each(function(){for(var t=0,e=(a=this.querySelectorAll(n)).length;t<e;t++)s=s.concat(a[t])}),l(s)},l.fn.first=function(){return this.eq(0)},l.fn.get=function(t){if(void 0!==t)return this[t];for(var e=[],n=0;n<this.length;n++)e.push(this[n]);return e};function t(t,e){for(var n,a,s=n=0;s<t.length;s++){if(e(a=t.item?t.item(s):t[s]))return n;1===a.nodeType&&n++}return-1}l.fn.html=function(t){if(void 0!==t)return function(t){if("string"==typeof t||"number"==typeof t)return this.each(function(){this.innerHTML=String(t)});var e="";if(void 0!==t.length)for(var n=0,a=t.length;n<a;n++)e+=t[n].outerHTML;else e=t.outerHTML;return this.each(function(){this.innerHTML=e})}.call(this,t);var e="";return this.each(function(){e+=this.innerHTML}),e},l.fn.index=function(e){var n=this;return void 0===e?t((this[0]&&this[0].parentNode||o.documentElement).childNodes,function(t){return n[0]===t}):t(n,function(t){return t===l(e,t.parentNode)[0]})},l.fn.insertBefore=function(t){return this.each(function(){l(t).before(this)})},l.fn.last=function(){return this.eq(this.length-1)},l.fn.next=function(){var s=[];return this.each(function(){for(var t,e,n=l(this.parentNode)[0].childNodes,a=0;a<n.length;a++){if(t=n.item(a),e&&1===t.nodeType){s.push(t);break}t===this&&(e=!0)}}),l(s)},l.fn.not=function(e){var n=[];return this.each(function(){var t=l(e,this.parentNode);-1===l.inArray(this,t)&&n.push(this)}),l(n)},l.fn.parent=function(){var t,e=[];return this.each(function(){(t=this===o.documentElement?o:this.parentNode)&&11!==t.nodeType&&e.push(t)}),l(e)},l.fn.prepend=function(s){return"string"!=typeof s&&void 0===s.nodeType||(s=l(s)),this.each(function(t){for(var e=0,n=s.length;e<n;e++){var a=0<t?s[e].cloneNode(!0):s[e];this.firstChild?this.insertBefore(a,this.firstChild):this.appendChild(a)}})},l.fn.prev=function(){var s=[];return this.each(function(){for(var t,e,n=l(this.parentNode)[0].childNodes,a=n.length-1;0<=a;a--){if(t=n.item(a),e&&1===t.nodeType){s.push(t);break}t===this&&(e=!0)}}),l(s)},l.fn.prevAll=function(){var e=[];return this.each(function(){for(var t=l(this).prev();t.length;)e.push(t[0]),t=t.prev()}),l(e)},l.fn.removeAttr=function(t){return this.each(function(){this.removeAttribute(t)})},l.fn.removeClass=function(t){var a=t.replace(/^\s+|\s+$/g,"").split(" ");return this.each(function(){for(var t,e=0,n=a.length;e<n;e++)void 0!==this.className&&(t=new RegExp("(^|\\s)"+a[e]+"($|\\s)","gmi"),t=this.className.replace(t," "),this.className=t.replace(/^\s+|\s+$/g,""))})},l.fn.remove=function(){return this.each(function(){this.parentNode&&this.parentNode.removeChild(this)})},l.fn.replaceWith=function(i){"string"==typeof i&&(i=l(i));var r=[];return 1<i.length&&(i=i.reverse()),this.each(function(t){var e,n=this.cloneNode(!0);if(r.push(n),this.parentNode)if(1===i.length)e=0<t?i[0].cloneNode(!0):i[0],this.parentNode.replaceChild(e,this);else{for(var a=0,s=i.length;a<s;a++)e=0<t?i[a].cloneNode(!0):i[a],this.parentNode.insertBefore(e,this.nextSibling);this.parentNode.removeChild(this)}}),l(r)},l.fn.siblings=function(){if(!this.length)return l([]);for(var t=[],e=this[0].parentNode.firstChild;1===e.nodeType&&e!==this[0]&&t.push(e),e=e.nextSibling;);return l(t)};var f=function(t){var e,n="",a=0,s=t.nodeType;
896if(s){if(1===s||9===s||11===s){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)n+=f(t)}else if(3===s||4===s)return t.nodeValue}else for(;e=t[a++];)n+=f(e);return n};function p(t,e,n){var a=this.shoestringData.events[t];if(a&&a.length){for(var s=[],i=0,r=a.length;i<r;i++)e&&e!==a[i].namespace||void 0!==n&&n!==a[i].originalCallback||(this.removeEventListener(t,a[i].callback,!1),s.push(i));for(i=0,r=s.length;i<r;i++)this.shoestringData.events[t].splice(i,1)}}function g(t,e){for(var n in this.shoestringData.events)p.call(this,n,t,e)}return l.fn.text=function(){return f(this)},l.fn.val=function(r){var t;return void 0!==r?this.each(function(){if("SELECT"===this.tagName){var t,e,n,a=this.options,s=[],i=a.length;for(s[0]=r;i--;)((e=a[i]).selected=0<=l.inArray(e.value,s))&&(t=!0,n=i);this.selectedIndex=t?n:-1}else this.value=r}):"SELECT"===(t=this[0]).tagName?t.selectedIndex<0?"":t.options[t.selectedIndex].value:t.value},l._dimension=function(t,e,n){var a;return void 0===n?(a=e.replace(/^[a-z]/,function(t){return t.toUpperCase()}),t[0]["offset"+a]):(n="string"==typeof n?n:n+"px",t.each(function(){this.style[e]=n}))},l.fn.width=function(t){return l._dimension(this,"width",t)},l.fn.wrapInner=function(e){return this.each(function(){var t=this.innerHTML;this.innerHTML="",l(this).append(l(e).html(t))})},l.fn.bind=function(t,l,c){"function"==typeof l&&(c=l,l=null);var h=t.split(" ");return this.each(function(){for(var t,e=this,n=0,a=h.length;n<a;n++){var s=h[n].split("."),i=s[0],r=0<s.length?s[1]:null,o=function(t){return e.ssEventTrigger&&(t._namespace=e.ssEventTrigger._namespace,t._args=e.ssEventTrigger._args,e.ssEventTrigger=null),function(t,e,n){if(!t._namespace||t._namespace===e){t.data=l,t.namespace=t._namespace;function a(){return!0}t.isDefaultPrevented=function(){return!1};var s=t.preventDefault;return t.target=n||t.target||t.srcElement,t.preventDefault=s?function(){t.isDefaultPrevented=a,s.call(t)}:function(){t.isDefaultPrevented=a,t.returnValue=!1},t.stopPropagation=t.stopPropagation||function(){t.cancelBubble=!0},!1===(n=c.apply(this,[t].concat(t._args)))&&(t.preventDefault(),t.stopPropagation()),n}}.call(e,t,r)};t=i,(s=this).shoestringData||(s.shoestringData={}),s.shoestringData.events||(s.shoestringData.events={}),s.shoestringData.loop||(s.shoestringData.loop={}),s.shoestringData.events[t]||(s.shoestringData.events[t]=[]),this.addEventListener(i,o,!1),s=this,t=i,i={callfunc:o,isCustomEvent:Boolean(null),customEventLoop:null,originalCallback:c,namespace:r},(o={}).isCustomEvent=i.isCustomEvent,o.callback=i.callfunc,o.originalCallback=i.originalCallback,o.namespace=i.namespace,s.shoestringData.events[t].push(o),i.customEventLoop&&(s.shoestringData.loop[t]=i.customEventLoop)}})},l.fn.on=l.fn.bind,l.fn.unbind=function(t,s){var i=t?t.split(" "):[];return this.each(function(){if(this.shoestringData&&this.shoestringData.events)if(i.length)for(var t,e,n=0,a=i.length;n<a;n++)t=(e=i[n].split("."))[0],e=0<e.length?e[1]:null,t?p.call(this,t,e,s):g.call(this,e,s);else g.call(this)})},l.fn.off=l.fn.unbind,l.fn.one=function(t,i){var r=t.split(" ");return this.each(function(){for(var t,a={},e=l(this),n=0,s=r.length;n<s;n++)t=r[n],a[t]=function(t){var e,n=l(this);for(e in a)n.unbind(e,a[e]);return i.apply(this,[t].concat(t._args))},e.bind(t,a[t])})},l.fn.triggerHandler=function(t,e){var n,a=t.split(" ")[0],s=this[0];if(o.createEvent&&s.shoestringData&&s.shoestringData.events&&s.shoestringData.events[a]){var i,r=s.shoestringData.events[a];for(i in r)r.hasOwnProperty(i)&&((t=o.createEvent("Event")).initEvent(a,!0,!0),(t._args=e).unshift(t),n=r[i].originalCallback.apply(t.target,e))}return n},l.fn.trigger=function(t,i){var r=t.split(" ");return this.each(function(){for(var t,e,n,a=0,s=r.length;a<s;a++){if(t=(n=r[a].split("."))[0],e=0<n.length?n[1]:null,"click"===t&&"INPUT"===this.tagName&&"checkbox"===this.type&&this.click)return this.click(),!1;o.createEvent&&((n=o.createEvent("Event")).initEvent(t,!0,!0),n._args=i,n._namespace=e,this.dispatchEvent(n))}})},l}),function(e,n){"function"==typeof define&&define.amd?define(["shoestring"],function(t){return e.Tablesaw=n(t,e)}):"object"==typeof exports?module.exports=n(require("shoestring"),e):e.Tablesaw=n(shoestring,e)}("undefined"!=typeof window?window:this,function(E,D){"use strict";var S=D.document,e=!1;S.addEventListener("DOMContentLoaded",function(){e=!0});var s,t,l,h,i,A={i18n:{modeStack:"Stack",modeSwipe:"Swipe",modeToggle:"Toggle",modeSwitchColumnsAbbreviated:"Cols",modeSwitchColumns:"Columns",columnToggleButton:"Columns",columnToggleError:"No eligible columns.",sort:"Sort",swipePreviousColumn:"Previous column",swipeNextColumn:"Next column"},mustard:"head"in S&&(!D.blackberry||D.WebKitPoint)&&!D.operamini,$:E,_init:function(t){A.$(t||S).trigger("enhance.tablesaw")},init:function(t){e?A._init(t):"addEventListener"in S&&S.addEventListener("DOMContentLoaded",function(){A._init(t)})}};function n(t){this.tablesaw=t,this.$table=t.$table,this.attr="data-tablesaw-checkall",this.checkAllSelector="["+this.attr+"]",this.forceCheckedSelector="["+this.attr+"-checked]",this.forceUncheckedSelector="["+this.attr+"-unchecked]",this.checkboxSelector='input[type="checkbox"]',this.$triggers=null,this.$checkboxes=null,this.$table.data(i)||(this.$table.data(i,this),this.init())}return E(S).on("enhance.tablesaw",function(){"undefined"!=typeof TablesawConfig&&TablesawConfig.i18n&&(A.i18n=E.extend(A.i18n,TablesawConfig.i18n||{})),A.i18n.modes=[A.i18n.modeStack,A.i18n.modeSwipe,A.i18n.modeToggle]}),A.mustard&&E(S.documentElement).addClass("tablesaw-enhanced"),function(){var e="tablesaw",n="tablesaw-bar",a={create:"tablesawcreate",destroy:"tablesawdestroy",refresh:"tablesawrefresh",resize:"tablesawresize"},s={};A.events=a;function t(t){if(!t)throw new Error("Tablesaw requires an element.");this.table=t,this.$table=E(t),this.$thead=this.$table.children().filter("thead").eq(0),this.$tbody=this.$table.children().filter("tbody"),this.mode=this.$table.attr("data-tablesaw-mode")||"stack",this.$toolbar=null,this.attributes={subrow:"data-tablesaw-subrow",ignorerow:"data-tablesaw-ignorerow"},this.init()}t.prototype.init=function(){if(!this.$thead.length)throw new Error("tablesaw: a <thead> is required, but none was found.");if(!this.$thead.find("th").length)throw new Error("tablesaw: no header cells found. Are you using <th> inside of <thead>?");this.$table.attr("id")||this.$table.attr("id",e+"-"+Math.round(1e4*Math.random())),this.createToolbar(),this._initCells(),this.$table.data(e,this),this.$table.trigger(a.create,[this])},t.prototype.getConfig=function(t){t=E.extend(s,t||{});return E.extend(t,"undefined"!=typeof TablesawConfig?TablesawConfig:{})},t.prototype._getPrimaryHeaderRow=function(){return this._getHeaderRows().eq(0)},t.prototype._getHeaderRows=function(){return this.$thead.children().filter("tr").filter(function(){return!E(this).is("[data-tablesaw-ignorerow]")})},t.prototype._getRowIndex=function(t){return t.prevAll().length},t.prototype._getHeaderRowIndeces=function(){var t=this,e=[];return this._getHeaderRows().each(function(){e.push(t._getRowIndex(E(this)))}),e},t.prototype._getPrimaryHeaderCells=function(t){return(t||this._getPrimaryHeaderRow()).find("th")},t.prototype._$getCells=function(t){var n=this;return E(t).add(t.cells).filter(function(){var t=E(this),e=t.parent(),t=t.is("[colspan]");return!(e.is("["+n.attributes.subrow+"]")||e.is("["+n.attributes.ignorerow+"]")&&t)})},t.prototype._getVisibleColspan=function(){var e=0;return this._getPrimaryHeaderCells().each(function(){var t=E(this);"none"!==t.css("display")&&(e+=parseInt(t.attr("colspan"),10)||1)}),e},t.prototype.getColspanForCell=function(t){var e=this._getVisibleColspan(),n=0;return t.closest("tr").data("tablesaw-rowspanned")&&n++,t.siblings().each(function(){var t=E(this),e=parseInt(t.attr("colspan"),10)||1;"none"!==t.css("display")&&(n+=e)}),e-n},t.prototype.isCellInColumn=function(t,e){return E(t).add(t.cells).filter(function(){return this===e}).length},t.prototype.updateColspanCells=function(a,s,i){var r=this,t=r._getPrimaryHeaderRow();
896this.$table.find("[rowspan][data-tablesaw-priority]").each(function(){var t,e=E(this);"persist"===e.attr("data-tablesaw-priority")&&(t=e.closest("tr"),1<(e=parseInt(e.attr("rowspan"),10))&&((t=t.next()).data("tablesaw-rowspanned",!0),e--))}),this.$table.find("[colspan],[data-tablesaw-maxcolspan]").filter(function(){return E(this).closest("tr")[0]!==t[0]}).each(function(){var t,e,n=E(this);void 0!==i&&!r.isCellInColumn(s,this)||(t=r.getColspanForCell(n),a&&void 0!==i&&n[0===t?"addClass":"removeClass"](a),(e=parseInt(n.attr("data-tablesaw-maxcolspan"),10))?e<t&&(t=e):n.attr("data-tablesaw-maxcolspan",n.attr("colspan")),n.attr("colspan",t))})},t.prototype._findPrimaryHeadersForCell=function(t){for(var e=this._getPrimaryHeaderRow(),n=this._getPrimaryHeaderCells(e),a=this._getRowIndex(e),s=[],i=0;i<this.headerMapping.length;i++)if(i!==a)for(var r=0;r<this.headerMapping[i].length;r++)this.headerMapping[i][r]===t&&s.push(n[r]);return s},t.prototype.getRows=function(){var t=this;return this.$table.find("tr").filter(function(){return E(this).closest("table").is(t.$table)})},t.prototype.getBodyRows=function(t){return(t?E(t):this.$tbody).children().filter("tr")},t.prototype.getHeaderCellIndex=function(t){for(var e=this.headerMapping[0],n=0;n<e.length;n++)if(e[n]===t)return n;return-1},t.prototype._initCells=function(){this.$table.find("[data-tablesaw-maxcolspan]").each(function(){var t=E(this);t.attr("colspan",t.attr("data-tablesaw-maxcolspan"))});var t=this.getRows(),r=[];t.each(function(t){r[t]=[]}),t.each(function(s){var i=0;E(this).children().each(function(){for(var t=parseInt(this.getAttribute("data-tablesaw-maxcolspan")||this.getAttribute("colspan"),10),e=parseInt(this.getAttribute("rowspan"),10);r[s][i];)i++;if(r[s][i]=this,t)for(var n=0;n<t-1;n++)i++,r[s][i]=this;if(e)for(var a=1;a<e;a++)r[s+a][i]=this;i++})});for(var e=this._getHeaderRowIndeces(),n=0;n<r[0].length;n++)for(var a=0,s=e.length;a<s;a++){var i,o=r[e[a]][n],l=e[a];for(o.cells||(o.cells=[]);l<r.length;)o!==(i=r[l][n])&&o.cells.push(i),l++}this.headerMapping=r},t.prototype.refresh=function(){this._initCells(),this.$table.trigger(a.refresh,[this])},t.prototype._getToolbarAnchor=function(){var t=this.$table.parent();return t.is(".tablesaw-overflow")?t:this.$table},t.prototype._getToolbar=function(t){return(t=t||this._getToolbarAnchor()).prev().filter("."+n)},t.prototype.createToolbar=function(){var t=this._getToolbarAnchor(),e=this._getToolbar(t);e.length||(e=E("<div>").addClass(n).insertBefore(t)),this.$toolbar=e,this.mode&&this.$toolbar.addClass("tablesaw-mode-"+this.mode)},t.prototype.destroy=function(){this._getToolbar().each(function(){this.className=this.className.replace(/\btablesaw-mode\-\w*\b/gi,"")});var t=this.$table.attr("id");E(S).off("."+t),E(D).off("."+t),this.$table.trigger(a.destroy,[this]),this.$table.removeData(e)},E.fn[e]=function(){return this.each(function(){E(this).data(e)||new t(this)})};var i=E(S);i.on("enhance.tablesaw",function(t){A.mustard&&E(t.target).find("table").filter("[data-tablesaw],[data-tablesaw-mode],[data-tablesaw-sortable]")[e]()});var r,o,l=!1;i.on("scroll.tablesaw",function(){l=!0,D.clearTimeout(r),r=D.setTimeout(function(){l=!1},300)}),E(D).on("resize",function(){l||(D.clearTimeout(o),o=D.setTimeout(function(){i.trigger(a.resize)},150))}),A.Table=t}(),function(){function n(t,e){this.tablesaw=e,this.$table=E(t),this.labelless=this.$table.is("["+r+"]"),this.hideempty=this.$table.is("["+o+"]"),this.$table.data(i,this)}var t="tablesaw-stack",a="tablesaw-cell-label",s="tablesaw-cell-content",i="tablesaw-stack",r="data-tablesaw-no-labels",o="data-tablesaw-hide-empty";n.prototype.init=function(){var n;this.$table.addClass(t),this.labelless||(n=this).$table.find("th, td").filter(function(){return!E(this).closest("thead").length}).filter(function(){return!E(this).closest("tr").is("["+r+"]")&&(!n.hideempty||Boolean(E(this).html()))}).each(function(){var r=E(S.createElement("b")).addClass(a),t=E(this);E(n.tablesaw._findPrimaryHeadersForCell(this)).each(function(t){var e=E(this.cloneNode(!0)),n=e.find(".tablesaw-sortable-btn");e.find(".tablesaw-sortable-arrow").remove();var a=e.find("[data-tablesaw-checkall]");if(a.closest("label").remove(),a.length)r=E([]);else{0<t&&r.append(S.createTextNode(", "));for(var s,i=(n.length?n:e)[0];s=i.firstChild;)r[0].appendChild(s)}}),r.length&&!t.find("."+s).length&&t.wrapInner("<span class='"+s+"'></span>");var e=t.find("."+a);e.length?e.replaceWith(r):t.prepend(r)})},n.prototype.destroy=function(){this.$table.removeClass(t),this.$table.find("."+a).remove(),this.$table.find("."+s).each(function(){E(this).replaceWith(this.childNodes)})},E(S).on(A.events.create,function(t,e){"stack"===e.mode&&new n(e.table,e).init()}).on(A.events.refresh,function(t,e){"stack"===e.mode&&E(e.table).data(i).init()}).on(A.events.destroy,function(t,e){"stack"===e.mode&&E(e.table).data(i).destroy()}),A.Stack=n}(),s="tablesawbtn",t={_create:function(){return E(this).each(function(){E(this).trigger("beforecreate."+s)[s]("_init").trigger("create."+s)})},_init:function(){var t=E(this),e=this.getElementsByTagName("select")[0];return e&&E(this).addClass("btn-select tablesaw-btn-select")[s]("_select",e),t},_select:function(t){function e(t,e){var n,a,e=E(e).find("option"),s=S.createElement("span"),i=!1;if(s.setAttribute("aria-hidden","true"),s.innerHTML=" ",e.each(function(){this.selected&&(s.innerHTML=this.text)}),a=t.childNodes,0<e.length){for(var r=0,o=a.length;r<o;r++)(n=a[r])&&"SPAN"===n.nodeName.toUpperCase()&&(t.replaceChild(s,n),i=!0);i||t.insertBefore(s,t.firstChild)}}e(this,t),E(this).on("change refresh",function(){e(this,t)})}},E.fn[s]=function(t,e,n,a){return this.each(function(){return t&&"string"==typeof t?E.fn[s].prototype[t].call(this,e,n,a):E(this).data(s+"active")?E(this):(E(this).data(s+"active",!0),void E.fn[s].prototype._create.call(this))})},E.extend(E.fn[s].prototype,t),function(){function n(t){this.$table=E(t),this.$table.length&&(this.tablesaw=this.$table.data("tablesaw"),this.attributes={btnTarget:"data-tablesaw-columntoggle-btn-target",set:"data-tablesaw-columntoggle-set"},this.classes={columnToggleTable:"tablesaw-columntoggle",columnBtnContain:"tablesaw-columntoggle-btnwrap tablesaw-advance",columnBtn:"tablesaw-columntoggle-btn tablesaw-nav-btn down",popup:"tablesaw-columntoggle-popup",priorityPrefix:"tablesaw-priority-"},this.set=[],this.$headers=this.tablesaw._getPrimaryHeaderCells(),this.$table.data(f,this))}var f="tablesaw-coltoggle";n.prototype.initSet=function(){var t,e=this.$table.attr(this.attributes.set);e&&(t=this.$table[0],this.set=E("table["+this.attributes.set+"='"+e+"']").filter(function(){return this!==t}).get())},n.prototype.init=function(){var e,n,a,s,i,r,o,t,l,c,h;function u(t){var e=t.checked,n=i.getHeaderFromCheckbox(t),t=i.tablesaw._$getCells(n);t[e?"removeClass":"addClass"]("tablesaw-toggle-cellhidden"),t[e?"addClass":"removeClass"]("tablesaw-toggle-cellvisible"),i.updateColspanCells(n,e),i.$table.trigger("tablesawcolumns")}function d(t){t&&E(t.target).closest("."+i.classes.popup).length||(E(S).off("click."+e),n.removeClass("up").addClass("down"),s.removeClass("visible"))}this.$table.length&&(r=(i=this).tablesaw.getConfig({getColumnToggleLabelTemplate:function(t){return"<label><input type='checkbox' checked>"+t+"</label>"}}),this.$table.addClass(this.classes.columnToggleTable),t=(e=this.$table.attr("id"))+"-popup",s=E("<div class='"+this.classes.columnBtnContain+"'></div>"),n=E("<a href='#"+t+"' class='btn tablesaw-btn btn-micro "+this.classes.columnBtn+"' data-popup-link>
896<span>"+A.i18n.columnToggleButton+"</span></a>"),c=E("<div class='"+this.classes.popup+"' id='"+t+"'></div>"),a=E("<div class='btn-group'></div>"),this.$popup=c,o=!1,this.$headers.each(function(){var t=E(this),e=t.attr("data-tablesaw-priority"),n=i.tablesaw._$getCells(this);e&&"persist"!==e&&(n.addClass(i.classes.priorityPrefix+e),E(r.getColumnToggleLabelTemplate(t.text())).appendTo(a).find('input[type="checkbox"]').data("tablesaw-header",this),o=!0)}),o||a.append("<label>"+A.i18n.columnToggleError+"</label>"),a.appendTo(c),a.find('input[type="checkbox"]').on("change",function(e){var n;u(e.target),i.set.length&&(E(i.$popup).find("input[type='checkbox']").each(function(t){if(this===e.target)return n=t,!1}),E(i.set).each(function(){var t=E(this).data(f).$popup.find("input[type='checkbox']").get(n);t&&(t.checked=e.target.checked,u(t))}))}),n.appendTo(s),t=E(this.$table.attr(this.attributes.btnTarget)),s.appendTo(t.length?t:this.tablesaw.$toolbar),n.on("click.tablesaw",function(t){t.preventDefault(),s.is(".visible")?d():(s.addClass("visible"),n.removeClass("down").addClass("up"),E(S).off("click."+e,d),D.clearTimeout(l),l=D.setTimeout(function(){E(S).on("click."+e,d)},15))}),c.appendTo(s),this.$menu=a,(c=this.$table.closest(".tablesaw-overflow")).css("-webkit-overflow-scrolling")&&c.on("scroll",function(){var t=E(this);D.clearTimeout(h),h=D.setTimeout(function(){t.css("-webkit-overflow-scrolling","auto"),D.setTimeout(function(){t.css("-webkit-overflow-scrolling","touch")},0)},100)}),E(D).on(A.events.resize+"."+e,function(){i.refreshToggle()}),this.initSet(),this.refreshToggle())},n.prototype.getHeaderFromCheckbox=function(t){return E(t).data("tablesaw-header")},n.prototype.refreshToggle=function(){var e=this;this.$menu.find("input").each(function(){var t=e.getHeaderFromCheckbox(this);this.checked="table-cell"===e.tablesaw._$getCells(t).eq(0).css("display")}),this.updateColspanCells()},n.prototype.updateColspanCells=function(t,e){this.tablesaw.updateColspanCells("tablesaw-toggle-cellhidden",t,e)},n.prototype.destroy=function(){this.$table.removeClass(this.classes.columnToggleTable),this.$table.find("th, td").each(function(){E(this).removeClass("tablesaw-toggle-cellhidden").removeClass("tablesaw-toggle-cellvisible"),this.className=this.className.replace(/\bui\-table\-priority\-\d\b/g,"")})},E(S).on(A.events.create,function(t,e){"columntoggle"===e.mode&&new n(e.table).init()}),E(S).on(A.events.destroy,function(t,e){"columntoggle"===e.mode&&E(e.table).data(f).destroy()}),E(S).on(A.events.refresh,function(t,e){"columntoggle"===e.mode&&E(e.table).data(f).refreshPriority()}),A.ColumnToggle=n}(),function(){function d(t){var e=[];return E(t.childNodes).each(function(){var t=E(this);t.is("input, select")?e.push(t.val()):t.is(".tablesaw-cell-label")||e.push((t.text()||"").replace(/^\s+|\s+$/g,""))}),e.join("")}var u="tablesaw-sortable",o="data-tablesaw-sortable-col",h="data-tablesaw-sortable-default-col",f="data-tablesaw-sortable-numeric",p="data-tablesaw-subrow",g="data-tablesaw-ignorerow",b={head:u+"-head",ascend:u+"-ascending",desce
896nd:u+"-descending",switcher:u+"-switch",tableToolbar:"tablesaw-bar-section",sortButton:u+"-btn"},t={_create:function(t){return E(this).each(function(){return!E(this).data(u+"-init")&&void E(this).data(u+"-init",!0).trigger("beforecreate."+u)[u]("_init",t).trigger("create."+u)})},_init:function(){var s,i,t,e,a,n,r=E(this),l=r.data("tablesaw");function c(t){E.each(t,function(t,e){e=E(e);e.removeAttr(h),e.removeClass(b.ascend),e.removeClass(b.descend)})}r.addClass(u),s=r.children().filter("thead").find("th["+o+"]"),t=s,E.each(t,function(t,e){E(e).addClass(b.head)}),e=s,a=function(t){var e,n,a;E(t.target).is("a[href]")||(t.stopPropagation(),e=E(t.target).closest("["+o+"]"),n=t.data.col,a=s.index(e[0]),c(e.closest("thead").find("th").filter(function(){return this!==e[0]})),e.is("."+b.descend)||!e.is("."+b.ascend)?(r[u]("sortBy",n,!0),a+="_asc"):(r[u]("sortBy",n),a+="_desc"),i&&i.find("select").val(a).trigger("refresh"),t.preventDefault())},E.each(e,function(t,e){var n=E("<button class='"+b.sortButton+"'/>");n.on("click",{col:e},a),E(e).wrapInner(n).find("button").append("<span class='tablesaw-sortable-arrow'>")}),n=s,E.each(n,function(t,e){e=E(e);e.is("["+h+"]")&&(e.is("."+b.descend)||e.addClass(b.ascend))}),r.is("[data-tablesaw-sortable-switch]")&&function(n){i=E("<div>").addClass(b.switcher).addClass(b.tableToolbar);var o=["<label>"+A.i18n.sort+":"];o.push('<span class="btn tablesaw-btn"><select>'),n.each(function(t){var e=E(this),n=e.is("["+h+"]"),a=e.is("."+b.descend),s=e.is("["+f+"]"),i=0;E(this.cells.slice(0,5)).each(function(){isNaN(parseInt(d(this),10))||i++});var r=5===i;s||e.attr(f,r?"":"false"),o.push("<option"+(n&&!a?" selected":"")+' value="'+t+'_asc">'+e.text()+" "+(r?"↑":"(A-Z)")+"</option>"),o.push("<option"+(n&&a?" selected":"")+' value="'+t+'_desc">'+e.text()+" "+(r?"↓":"(Z-A)")+"</option>")}),o.push("</select></span></label>"),i.html(o.join(""));var t=l.$toolbar.children().eq(0);t.length?i.insertBefore(t):i.appendTo(l.$toolbar),i.find(".tablesaw-btn").tablesawbtn(),i.find("select").on("change",function(){var t=E(this).val().split("_"),e=n.eq(t[0]);c(e.siblings()),r[u]("sortBy",e.get(0),"asc"===t[1])})}(s)},sortRows:function(t,e,n,a,s){var i,o,l,r,c,h,u=(i=a.cells,o=s,l=[],E.each(i,function(t,e){for(var n=e.parentNode,a=E(n),s=[],i=a.next();i.is("["+p+"]");)s.push(i[0]),i=i.next();var r=n.parentNode;a.is("["+p+"]")||r===o&&l.push({element:e,cell:d(e),row:n,subrows:s.length?s:null,ignored:a.is("["+g+"]")})}),l),s=E(a).data("tablesaw-sort"),a=!(!s||"function"!=typeof s)&&s(n)||(r=n,c=E(a).is("["+f+"]")&&!E(a).is("["+f+'="false"]'),h=/[^\-\+\d\.]/g,r=r?function(t,e){return t.ignored||e.ignored?0:c?parseFloat(t.cell.replace(h,""))-parseFloat(e.cell.replace(h,"")):t.cell.toLowerCase()>e.cell.toLowerCase()?1:-1}:function(t,e){return t.ignored||e.ignored?0:c?parseFloat(e.cell.replace(h,""))-parseFloat(t.cell.replace(h,"")):t.cell.toLowerCase()<e.cell.toLowerCase()?1:-1});return function(t){for(var e=[],n=0,a=t.length;n<a;n++)e.push(t[n].row),t[n].subrows&&e.push(t[n].subrows);return e}(u.sort(a))},makeColDefault:function(t,e){t=E(t);t.attr(h,"true"),e?(t.removeClass(b.descend),t.addClass(b.ascend)):(t.removeClass(b.ascend),t.addClass(b.descend))},sortBy:function(r,o){var l,c=E(this),h=c.data("tablesaw");h.$tbody.each(function(){for(var t,e=E(this),n=h.getBodyRows(this),a=h.headerMapping[0],s=0,i=a.length;s<i;s++)if(a[s]===r){l=s;break}for(s=0,i=(t=c[u]("sortRows",n,l,o,r,this)).length;s<i;s++)e.append(t[s])}),c[u]("makeColDefault",r,o),c.trigger("tablesaw-sorted")}};E.fn[u]=function(t){var e=Array.prototype.slice.call(arguments,1);return t&&"string"==typeof t?void 0!==(e=E.fn[u].prototype[t].apply(this[0],e))?e:E(this):(E(this).data(u+"-active")||(E(this).data(u+"-active",!0),E.fn[u].prototype._create.call(this,t)),E(this))},E.extend(E.fn[u].prototype,t),E(S).on(A.events.create,function(t,e){e.$table.is("table[data-tablesaw-sortable]")&&e.$table[u]()})}(),function(){var T="disabled",$="tablesaw-fix-persist",k="tablesaw-swipe-cellhidden",x="tablesaw-swipe-cellpersist",_="tablesaw-all-cols-visible",N="data-tablesaw-no-touch";function n(l,c){var h=c.data("tablesaw"),t=E("<div class='tablesaw-advance'></div>"),n=E("<a href='#' class='btn tablesaw-nav-btn tablesaw-btn btn-micro left'>"+A.i18n.swipePreviousColumn+"</a>").appendTo(t),a=E("<a href='#' class='btn tablesaw-nav-btn tablesaw-btn btn-micro right'>"+A.i18n.swipeNextColumn+"</a>").appendTo(t),u=l._getPrimaryHeaderCells(),s=u.not('[data-tablesaw-priority="persist"]'),d=[],r=E(S.head||"head"),o=c.attr("id");if(!u.length)throw new Error("tablesaw swipe: no header cells found.");function e(){c.css({width:"1px"}),c.find("."+k).removeClass(k),d=[],u.each(function(){d.push(this.offsetWidth)}),c.css({width:""})}function f(t){h._$getCells(t).removeClass(k)}function p(t){h._$getCells(t).addClass(k)}function g(){c.removeClass($),E("#"+o+"-persist").remove()}function i(){var t,e,n="#"+o+".tablesaw-swipe ",a=[],s=c.width(),i=[];u.each(function(t){var e;!E(this).is('[data-tablesaw-priority="persist"]')||(e=this.offsetWidth)<.75*s&&(i.push(t+"-"+e),a.push(n+" ."+x+":nth-child("+(t+1)+") { width: "+e+"px; }"))}),t=i.join("_"),a.length&&(c.addClass($),(e=E("#"+o+"-persist")).length&&e.data("tablesaw-hash")===t||(e.remove(),E("<style>"+a.join("\n")+"</style>").attr("id",o+"-persist").data("tablesaw-hash",t).appendTo(r)))}function b(){var n,a=[];return s.each(function(t){var e=E(this),e="none"===e.css("display")||e.is("."+k);if(e||n){if(e&&n)return a[1]=t,!1}else n=!0,a[0]=t}),a}function v(){var t=b();return[t[1]-1,t[0]-1]}function w(t){return-1<t[1]&&t[1]<s.length}function m(){var t,n,a,s,i,r,o;(!(t=c.attr("data-tablesaw-swipe-media"))||"matchMedia"in D&&D.matchMedia(t).matches)&&(n=c.parent().width(),a=[],s=0,i=[],r=u.length,u.each(function(t){var e=E(this).is('[data-tablesaw-priority="persist"]');a.push(e),s+=d[t],i.push(s),(e||n<s)&&r--}),o=0===r,u.each(function(t){i[t]>n&&p(this)}),u.each(function(t){return a[t]?(e=this,void h._$getCells(e).addClass(x)):void((i[t]<=n||o)&&(o=!1,f(this),h.updateColspanCells(k,this,!0)));var e}),g(),c.trigger("tablesawcolumns"))}function C(t){var e=(t?b:v)();w(e)&&(isNaN(e[0])&&(e[0]=t?0:s.length-1),i(),p(s.get(e[0])),h.updateColspanCells(k,s.get(e[0]),!1),f(s.get(e[1])),h.updateColspanCells(k,s.get(e[1]),!0),c.trigger("tablesawcolumns"))}function y(t,e){return(t.touches||t.originalEvent.touches)[0][e]}c.addClass("tablesaw-swipe"),e(),t.appendTo(h.$toolbar),o||(o="tableswipe-"+Math.round(1e4*Math.random()),c.attr("id",o)),n.add(a).on("click",function(t){C(Boolean(E(t.target).closest(a).length)),t.preventDefault()}),c.is("["+N+"]")||c.on("touchstart.swipetoggle",function(t){var a,s,i=y(t,"pageX"),r=y(t,"pageY"),o=D.pageYOffset;E(D).off(A.events.resize,m),E(this).on("touchmove.swipetoggle",function(t){a=y(t,"pageX"),s=y(t,"pageY")}).on("touchend.swipetoggle",function(){var t=l.getConfig({swipeHorizontalThreshold:30,swipeVerticalThreshold:30}),e=t.swipe?t.swipe.verticalThreshold:t.swipeVerticalThreshold,n=t.swipe?t.swipe.horizontalThreshold:t.swipeHorizontalThreshold,t=Math.abs(D.pageYOffset-o)>=e;Math.abs(s-r)>=e||t||(a-i<-1*n&&C(!0),n<a-i&&C(!1)),D.setTimeout(function(){E(D).on(A.events.resize,m)}
896,300),E(this).off("touchmove.swipetoggle touchend.swipetoggle")})}),c.on("tablesawcolumns.swipetoggle",function(){var t=w(v()),e=w(b());n[t?"removeClass":"addClass"](T),a[e?"removeClass":"addClass"](T),h.$toolbar[t||e?"removeClass":"addClass"](_)}).on("tablesawnext.swipetoggle",function(){C(!0)}).on("tablesawprev.swipetoggle",function(){C(!1)}).on(A.events.destroy+".swipetoggle",function(){var t=E(this);t.removeClass("tablesaw-swipe"),h.$toolbar.find(".tablesaw-advance").remove(),E(D).off(A.events.resize,m),t.off(".swipetoggle")}).on(A.events.refresh,function(){g(),e(),m()}),m(),E(D).on(A.events.resize,m)}E(S).on(A.events.create,function(t,e){"swipe"===e.mode&&n(e,e.$table)})}(),l={attr:{init:"data-tablesaw-minimap"},show:function(t){t=t.getAttribute(l.attr.init);return""===t||!!(t&&"matchMedia"in D)&&D.matchMedia(t).matches}},E(S).on(A.events.create,function(t,e){function n(){var e;l.show(a[0])?(i.css("display","block"),e=r.find("li").removeClass(o),a.find("thead th").each(function(t){"none"===E(this).css("display")&&e.eq(t).addClass(o)})):i.css("display","none")}var a,s,i,r,o;"swipe"!==e.mode&&"columntoggle"!==e.mode||!e.$table.is("[ "+l.attr.init+"]")||(a=e.$table,s=a.data("tablesaw"),i=E('<div class="tablesaw-advance minimap">'),r=E('<ul class="tablesaw-advance-dots">').appendTo(i),o="tablesaw-advance-dots-hide",a.data("tablesaw")._getPrimaryHeaderCells().each(function(){r.append("<li><i></i></li>")}),i.appendTo(s.$toolbar),n(),E(D).on(A.events.resize,n),a.on("tablesawcolumns.minimap",function(){n()}).on(A.events.destroy+".minimap",function(){var t=E(this);s.$toolbar.find(".tablesaw-advance").remove(),E(D).off(A.events.resize,n),t.off(".minimap")}))}),A.MiniMap=l,h={selectors:{init:"table[data-tablesaw-mode-switch]"},attributes:{excludeMode:"data-tablesaw-mode-exclude"},classes:{main:"tablesaw-modeswitch",toolbar:"tablesaw-bar-section"},modes:["stack","swipe","columntoggle"],init:function(e){var t,n=E(e),a=n.data("tablesaw"),s=n.attr(h.attributes.excludeMode),i=a.$toolbar,a=E("<div>").addClass(h.classes.main+" "+h.classes.toolbar),r=['<label><span class="abbreviated">'+A.i18n.modeSwitchColumnsAbbreviated+'</span><span class="longform">'+A.i18n.modeSwitchColumns+"</span>:"],o=n.attr("data-tablesaw-mode");r.push('<span class="btn tablesaw-btn"><select>');for(var l=0,c=h.modes.length;l<c;l++)s&&s.toLowerCase()===h.modes[l]||(t=o===h.modes[l],r.push("<option"+(t?" selected":"")+' value="'+h.modes[l]+'">'+A.i18n.modes[l]+"</option>"));r.push("</select></span></label>"),a.html(r.join(""));n=i.find(".tablesaw-advance").eq(0);n.length?a.insertBefore(n):a.appendTo(i),a.find(".tablesaw-btn").tablesawbtn(),a.find("select").on("change",function(t){return h.onModeChange.call(e,t,E(this).val())})},onModeChange:function(t,e){var n=E(this),a=n.data("tablesaw");a.$toolbar.find("."+h.classes.main).remove(),a.destroy(),n.attr("data-tablesaw-mode",e),n.tablesaw()}},E(S).on(A.events.create,function(t,e){e.$table.is(h.selectors.init)&&h.init(e.table)}),i="tablesawCheckAll",n.prototype._filterCells=function(t){return t.filter(function(){return!E(this).closest("tr").is("[data-tablesaw-subrow],[data-tablesaw-ignorerow]")}).find(this.checkboxSelector).not(this.checkAllSelector)},n.prototype.getCheckboxesForButton=function(t){return this._filterCells(E(E(t).attr(this.attr)))},n.prototype.getCheckboxesForCheckbox=function(t){return this._filterCells(E(E(t).closest("th")[0].cells))},n.prototype.init=function(){var t=this;this.$table.find(this.checkAllSelector).each(function(){E(this).is(t.checkboxSelector)?t.addCheckboxEvents(this):t.addButtonEvents(this)})},n.prototype.addButtonEvents=function(t){var a=this;E(t).on("click",function(t){t.preventDefault();var e,t=a.getCheckboxesForButton(this),n=!0;t.each(function(){this.checked||(n=!1)}),e=!!E(this).is(a.forceCheckedSelector)||!E(this).is(a.forceUncheckedSelector)&&!n,t.each(function(){this.checked=e,E(this).trigger("change."+i)})})},n.prototype.addCheckboxEvents=function(n){var e=this;E(n).on("change",function(){var t=this.checked;e.getCheckboxesForCheckbox(this).each(function(){this.checked=t})});var a=e.getCheckboxesForCheckbox(n);a.on("change."+i,function(){var t=0;a.each(function(){this.checked&&t++});var e=t===a.length;n.checked=e,n.indeterminate=0!==t&&!e})},E(S).on(A.events.create,function(t,e){new n(e)}),A.CheckAll=n,A}); 897(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}
897var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})() 898 899({3:[function(require,module,exports){ 900 901},{}],4:[function(require,module,exports){ 902 903},{}],5:[function(require,module,exports){ 904 905},{"objects/shared/DelegatedEvent":108}],6:[function(require,module,exports){ 906 907},{}],7:[function(require,module,exports){ 908 909},{}],8:[function(require,module,exports){ 910 911},{}],9:[function(require,module,exports){ 912 913},{}],10:[function(require,module,exports){ 914 915},{}],11:[function(require,module,exports){ 916 917},{}],12:[function(require,module,exports){ 918 919},{}],13:[function(require,module,exports){ 920 921},{}],14:[function(require,module,exports){ 922 923},{}],15:[function(require,module,exports){ 924 925},{}],16:[function(require,module,exports){ 926 927},{"animejs":112}],17:[function(require,module,exports){ 928 929},{"animejs":112}],18:[function(require,module,exports){ 930 931},{"animejs":112}],19:[function(require,module,exports){ 932 933},{"animejs":112}],20:[function(require,module,exports){ 934 935},{"animejs":112}],21:[function(require,module,exports){ 936 937},{"animejs":112}],22:[function(require,module,exports){ 938 939},{"animejs":112}],23:[function(require,module,exports){ 940 941},{"animejs":112}],24:[function(require,module,exports){ 942 943},{"animejs":112,"helpers/keyAccessibility":32}],25:[function(require,module,exports){ 944 945},{"animejs":112}],26:[function(require,module,exports){ 946"use strict"; 947 948Object.defineProperty(exports, "__esModule", { 949 value: true 950}); 951var arrowEvents = exports.arrowEvents = function arrowEvents(arrows, instance) { 952 // Cache instance 953 var carousel = instance; 954 955 // Check if the next arrow exists 956 if (arrows.next) { 957 // Add click event 958 arrows.next.addEventListener("click", function (event) { 959 // Prevent Default 960 event.preventDefault(); 961 // Call next slide 962 carousel.next(carousel.numToSlide); 963 }); 964 } 965 966 // Check if the prev arrow exists 967 if (arrows.prev) { 968 // Add Click Event 969 arrows.prev.addEventListener("click", function (event) { 970 // Prevent Default 971 event.preventDefault(); 972 // Call previous slide 973 carousel.prev(carousel.numToSlide); 974 }); 975 } 976}; 977 978},{}],27:[function(require,module,exports){ 979 980},{"helpers/shared/toArray":35}],28:[function(require,module,exports){ 981"use strict"; 982 983Object.defineProperty(exports, "__esModule", { 984 value: true 985}); 986exports.pagination = undefined; 987 988var _toArray = require("helpers/shared/toArray"); 989 990var pagination = exports.pagination = function pagination(container, slides, instance) { 991 slides = (0, _toArray.toArray)(slides); 992 // Cache the carousel instance 993 var carousel = instance; 994 995 // Create a fresh array for the carousel dots 996 carousel.carouselDots = []; 997 998 // If no container just return 999 if (!container) { 1000 return; 1001 } 1002 // Clear the container 1003 container.innerHTML = ""; 1004 1005 // Create a templat function 1006 var createTemplate = function createTemplate(index) { 1007 // Create a button element 1008 var templateBtn = document.createElement("button"); 1009 // Add an attribute to the button 1010 templateBtn.setAttribute("data-pagination-item", ""); 1011 // Add a click event 1012 templateBtn.addEventListener("click", function (event) { 1013 // Prevent default 1014 event.preventDefault(); 1015 // Go to the index 1016 carousel.goTo(index); 1017 }); 1018 1019 // Return 1020 return templateBtn; 1021 }; 1022 1023 // Loop through each slide 1024 slides.forEach(function (currentSlide, index) { 1025 // Create the templat button 1026 var buttonElement = createTemplate(index); 1027 1028 // If the button is valid to the num shown 1029 if (index / carousel.numToSlide === parseInt(index / carousel.numToSlide) || index === 0) { 1030 // Add into the DOM 1031 container.appendChild(buttonElement); 1032 // Push to the carousel dots array 1033 carousel.carouselDots.push(buttonElement); 1034 } 1035 });
1036 1037 if (carousel.numToSlide > 1) { 1038 // Calculate which pagination item to pic 1039 var desiredDot = Math.ceil(carousel.currentSlide / carousel.numToSlide); 1040 1041 // Set the active element 1042 carousel.carouselDots[desiredDot].setAttribute("data-active", "true"); 1043 } else { 1044 // Set the active element 1045 carousel.carouselDots[carousel.currentSlide].setAttribute("data-active", "true"); 1046 } 1047}; 1048 1049},{"helpers/shared/toArray":35}],29:[function(require,module,exports){ 1050"use strict"; 1051 1052Object.defineProperty(exports, "__esModule", { 1053 value: true 1054}); 1055exports.touchEvents = undefined; 1056 1057var _hammerjs = require("hammerjs"); 1058 1059var _hammerjs2 = _interopRequireDefault(_hammerjs); 1060 1061function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1062 1063var touchEvents = exports.touchEvents = function touchEvents(element, instance) { 1064 1065 // Cache instance 1066 var carousel = instance; 1067 1068 // Create new hammer event 1069 var touch = new _hammerjs2.default(element); 1070 1071 // Handle left swipe 1072 touch.on("swipeleft", function () { 1073 carousel.next(carousel.numToSlide); 1074 }); 1075 1076 // Handle right swipe 1077 touch.on("swiperight", function () { 1078 carousel.prev(carousel.numToSlide); 1079 }); 1080}; 1081 1082},{"hammerjs":117}],30:[function(require,module,exports){ 1083 1084 1085},{"helpers/shared/toArray":35}],31:[function(require,module,exports){ 1086"use strict"; 1087 1088Object.defineProperty(exports, "__esModule", { 1089 value: true 1090}); 1091var interactiveState = exports.interactiveState = function interactiveState() { 1092 return new Promise(function (resolve) { 1093 // Check if the document is already interactive 1094 if (document.readyState === "complete") { 1095 // Resolve 1096 resolve(); 1097 } else { 1098 // Set Custom event to watch for interactive call 1099 document.addEventListener("readystatechange", function () { 1100 // If the document is interactive 1101 if (document.readyState === "complete") { 1102 // Resolve 1103 resolve(); 1104 } 1105 }); 1106 } 1107 }); 1108}; 1109 1110},{}],32:[function(require,module,exports){ 1111 1112},{}],33:[function(require,module,exports){ 1113 1114},{"animejs":112}],34:[function(require,module,exports){ 1115 1116},{"objects/shared/CatchError":105}],35:[function(require,module,exports){ 1117"use strict"; 1118 1119Object.defineProperty(exports, "__esModule", { 1120 value: true 1121}); 1122var toArray = exports.toArray = function toArray(obj) { 1123 1124 if (obj && obj.length !== undefined) { 1125 return Array.prototype.slice.call(obj, 0); 1126 } 1127 1128 return [obj]; 1129}; 1130 1131},{}],36:[function(require,module,exports){ 1132 1133},{}],37:[function(require,module,exports){ 1134 "use strict"; 1135 var _DOMReady = require("objects/shared/DOMReady"); 1136 new _DOMReady.DOMReady(function () { 1137 var a11yStatus = false; 1138 document.addEventListener("keydown", function (event) { 1139 if (event.key === "Tab" && a11yStatus === false) { 1140 document.body.setAttribute("data-a11y", ""); 1141 a11yStatus = true; 1142 } 1143 }); 1144 document.addEventListener("click", function () { 1145 if (a11yStatus === true) { 1146 document.body.removeAttribute("data-a11y"); 1147 a11yStatus = false; 1148 } 1149 }); 1150 }); 1151 1152},{"objects/shared/DOMReady":107}],38:[function(require,module,exports){ 1153 1154},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107,"objects/shared/ToggleView":111}],39:[function(require,module,exports){ 1155 1156},{"helpers/shared/toArray":35,"objects/AccordionGroup":81,"objects/shared/DOMReady":107}],40:[function(require,module,exports){ 1157 1158},{"animejs":112,"helpers/shared/toArray":35,"objects/InViewport":89,"objects/shared/DOMReady":107}],41:[function(require,module,exports){ 1159 1160},{"aos":113}],42:[function(require,module,exports){ 1161 1162},{"helpers/shared/toArray":35,"objects/AccordionGroup":81,"objects/shared/DOMReady":107}],43:[function(require,module,exports){ 1163 1164},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107}],44:[function(require,module,exports){ 1165 1166 1167},{"helpers/shared/toArray":35,"implementation/scrollToElement/scrollToElement":74,"objects/shared/DOMReady":107,"objects/shared/Resize":109}] 1168,45:[function(require,module,exports){ 1169 1170},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107}],46:[function(require,module,exports){ 1171 1172},{"helpers/carousel/matchSlideHeights":27,"helpers/carousel/touchEvents":29,"helpers/interactiveState":31,"helpers/shared/toArray":35,"objects/HeroCarouselPagination":87,"objects/SlideAccessiblity":96,"objects/shared/DOMReady":107,"objects/shared/Resize":109,"siema":120}] 1173,47:[function(require,module,exports){ 1174 1175}
1175,{"helpers/carousel/arrowEvents":26,"helpers/carousel/pagination":28,"helpers/carousel/touchEvents":29,"helpers/shared/toArray":35,"objects/SlideAccessiblity":96,"objects/shared/DOMReady":107,"objects/shared/Resize":109,"siema":120}] 1176,48:[function(require,module,exports){ 1177"use strict"; 1178 1179Object.defineProperty(exports, "__esModule", { 1180 value: true 1181}); 1182exports.initThreeBlockCarousel = initThreeBlockCarousel; 1183 1184var _toArray = require("helpers/shared/toArray"); 1185 1186var _DOMReady = require("objects/shared/DOMReady"); 1187 1188var _Resize = require("objects/shared/Resize"); 1189 1190var _siema = require("siema"); 1191 1192var _siema2 = _interopRequireDefault(_siema); 1193 1194var _pagination = require("helpers/carousel/pagination"); 1195 1196var _touchEvents = require("helpers/carousel/touchEvents"); 1197 1198var _arrowEvents = require("helpers/carousel/arrowEvents"); 1199 1200var _SlideAccessiblity = require("objects/SlideAccessiblity"); 1201 1202function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1203 1204//================================================================================================== 1205// Private Functions 1206//================================================================================================== 1207// Create New Resize Event 1208//================================================================================================== 1209// Dependencies 1210//================================================================================================== 1211function carouselResize(instance) { 1212 // Cache the instance 1213 var carousel = instance; 1214 1215 // If the window is desktop 1216 if (window.innerWidth >= 960 && carousel.activeViewport !== "desktop") { 1217 // Set the slider to slide 3 at a time 1218 carousel.destroy(true); 1219 // Set the active viewport to desktop 1220 carousel.activeViewport = "desktop"; 1221 // Enable tabbing on all slides 1222 carousel.slideAccessiblity.enableTabbingOnAllSlides(); 1223 } else if (window.innerWidth >= 600 && window.innerWidth < 960 && carousel.activeViewport !== "tablet") { 1224 // Set the slider to slide 2 at a time 1225 if (carousel.activeViewport === "desktop") { 1226 carousel.init(); 1227 } 1228 // Set the active viewport to tablet 1229 carousel.activeViewport = "tablet"; 1230 1231 // Set carousel to position 0 1232 carousel.goTo(0); 1233 } else if (window.innerWidth < 600 && carousel.activeViewport !== "mobile") { 1234 // Set the slider to slide 1 at a time 1235 if (carousel.activeViewport === "desktop") { 1236 carousel.init(); 1237 } 1238 // Set the active viewport to mobile 1239 carousel.activeViewport = "mobile"; 1240 1241 // Set carousel to position 0 1242 carousel.goTo(0); 1243 } 1244 1245 // Restrict tabbing to visible slide 1246 if (carousel.activeViewport !== "desktop") { 1247 carousel.slideAccessiblity.restrictTabbingToSlides(carousel.currentSlide, carousel.numToSlide); 1248 } 1249} 1250 1251//================================================================================================== 1252// 1253// Responsive Block Carousel 1254// 1255//================================================================================================== 1256function initThreeBlockCarousel(element) { 1257 if (!(element && element.nodeType === Node.ELEMENT_NODE)) element = document; 1258 1259 // / Query Select Carousel conatiner 1260 var containers = (0, _toArray.toArray)(element.querySelectorAll("[data-responsive-block-carousel]")); 1261 1262 // Check container exists 1263 if (containers.length > 0) { 1264 // Loop through container 1265 containers.forEach(function initCarousel(currentItem) { 1266 1267 // Find the carousel 1268 var carouselElement = currentItem.querySelector("[data-carousel]"); 1269 1270 // Find the carousel arrows 1271 var arrows = { 1272 prev: currentItem.querySelector("[data-carousel-prev]"), 1273 next: currentItem.querySelector("[data-carousel-next]") 1274 }; 1275 1276 // Find the pagination component 1277 var paginationContainer = currentItem.querySelector("[data-pagination]"); 1278 1279 // Detect the slides 1280 var slides = currentItem.querySelectorAll("[data-sli
1280de]"); 1281 1282 // Instantiate slide tab manager 1283 var slideAccessiblity = new _SlideAccessiblity.SlideAccessiblity(currentItem, "[data-slide]"); 1284 1285 // Create a new carousel 1286 var carousel = new _siema2.default({ 1287 selector: carouselElement, 1288 duration: 200, 1289 easing: 'ease-out', 1290 perPage: 1, 1291 startIndex: 0, 1292 draggable: false, 1293 threshold: 20, 1294 loop: true, 1295 onChange: function onChange() { 1296 // Loop through each carousel dot 1297 carousel.carouselDots.forEach(function (currentPaginationItem) { 1298 if (currentPaginationItem) { 1299 // Remove the active attribute 1300 currentPaginationItem.removeAttribute("data-active"); 1301 } 1302 }); 1303 1304 // If the carousel is more than the max (returns -1) 1305 if (carousel.currentSlide < 0) { 1306 // Set the last item as active 1307 carousel.carouselDots[carousel.carouselDots.length - 1].setAttribute("data-active", "true"); 1308 } else { 1309 1310 // If the num to slide is 1 1311 if (carousel.numToSlide === 1) { 1312 // Set the current slide as active 1313 carousel.carouselDots[carousel.currentSlide].setAttribute("data-active", "true"); 1314 } else { 1315 // Calculate which pagination item to pic 1316 var desiredDot = Math.ceil(carousel.currentSlide / carousel.numToSlide); 1317 // Set the active item 1318 carousel.carouselDots[desiredDot].setAttribute("data-active", "true"); 1319 } 1320 } 1321 1322 //Disable tabbing on all but the current slide 1323 slideAccessiblity.restrictTabbingToSlides(carousel.currentSlide, carousel.numToSlide); 1324 } 1325 }); 1326 1327 // Add custom property for number to slide 1328 carousel.numToSlide = 1; 1329 1330 // Add custom property on carousel for resize - the resize event will take care of initialisation 1331 carousel.slideAccessiblity = slideAccessiblity; 1332 1333 // Add Touch Events 1334 (0, _touchEvents.touchEvents)(carouselElement, carousel); 1335 1336 // Add arrow events 1337 (0, _arrowEvents.arrowEvents)(arrows, carousel); 1338 1339 // Fire resize 1340 carouselResize(carousel); 1341 1342 // Create the carousel dots 1343 (0, _pagination.pagination)(paginationContainer, slides, carousel); 1344 1345 window.slider = carousel; 1346 1347 var sliderResponsiveTimeout = void 0; 1348 1349 // Create a new resize handler 1350 new _Resize.Resize(function () { 1351 clearTimeout(sliderResponsiveTimeout); 1352 sliderResponsiveTimeout = setTimeout(function () { 1353 // Fire resize 1354 carouselResize(carousel); 1355 // Update the dots 1356 (0, _pagination.pagination)(paginationContainer, slides, carousel); 1357 }, 50); 1358 }); 1359 }); 1360 } 1361} 1362 1363new _DOMReady.DOMReady(initThreeBlockCarousel); 1364 1365},{"helpers/carousel/arrowEvents":26,"helpers/carousel/pagination":28,"helpers/carousel/touchEvents":29,"helpers/shared/toArray":35,"objects/SlideAccessiblity":96,"objects/shared/DOMReady":107,"objects/shared/Resize":109,"siema":120}] 1366,49:[function(require,module,exports){ 1367 "use strict"; 1368 var _toArray = require("helpers/shared/toArray"); 1369 var _DOMReady = require("objects/shared/DOMReady"); 1370 var _Resize = require("objects/shared/Resize"); 1371 var _siema = require("siema"); 1372 var _siema2 = _interopRequireDefault(_siema); 1373 var _interactiveState = require("helpers/interactiveState");
1374 var _pagination = require("helpers/carousel/pagination"); 1375 var _touchEvents = require("helpers/carousel/touchEvents"); 1376 var _arrowEvents = require("helpers/carousel/arrowEvents"); 1377 var _SlideAccessiblity = require("objects/SlideAccessiblity"); 1378 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 1379 1380 function carouselResize(instance) { 1381 var carousel = instance; 1382 if (window.innerWidth >= 960 && carousel.activeViewport !== "desktop") { 1383 carousel.numToSlide = 2; 1384 carousel.activeViewport = "desktop"; 1385 carousel.goTo(0); 1386 } else if (window.innerWidth > 600 && window.innerWidth < 960 && carousel.activeViewport !== "tablet") { 1387 carousel.numToSlide = 2; 1388 carousel.activeViewport = "tablet"; 1389 carousel.goTo(0); 1390 } else if (window.innerWidth < 600 && carousel.activeViewport !== "mobile") { 1391 carousel.numToSlide = 1; 1392 carousel.activeViewport = "mobile"; 1393 carousel.goTo(0); 1394 } 1395 carousel.slideAccessiblity.restrictTabbingToSlides(carousel.currentSlide, carousel.numToSlide); 1396 } 1397 function toggleArrows(arrows, instance) { 1398 var carousel = instance; 1399 if (carousel.activeViewport == "mobile" || !arrows.prev || !arrows.next) { 1400 return false; 1401 } 1402 var page = Math.ceil(carousel.currentSlide / carousel.numToSlide) + 1; 1403 var pages = Math.ceil(carousel.numSlides / carousel.numToSlide); 1404 if (pages == 1) { 1405 arrows.prev.classList.add("hidden"); 1406 arrows.next.classList.add("hidden"); 1407 } else if (page == 1 && pages > 1) { 1408 arrows.prev.classList.add("hidden"); 1409 arrows.next.classList.remove("hidden"); 1410 } else if (page > 1 && page < pages) { 1411 arrows.prev.classList.remove("hidden"); 1412 arrows.next.classList.remove("hidden"); 1413 } else if (page > 1 && page == pages) { 1414 1415 arrows.prev.classList.remove("hidden"); 1416 arrows.next.classList.add("hidden"); 1417 } 1418 } 1419 function setClosest(elem, num) { 1420 var closest = document.querySelectorAll('button[data-closest]'); 1421 var siblings = []; 1422 var next = 0; 1423 var prev = 0; 1424 var nextEl = elem.nextElementSibling; 1425 var prevEl = elem.previousElementSibling; 1426 while (next < num) { 1427 if (nextEl) { 1428 nextEl.setAttribute('data-closest', 'true'); 1429 nextEl = nextEl.nextElementSibling; 1430 next++; 1431 } else { 1432 break; 1433 } 1434 } 1435 while (prev < num) { 1436 if (prevEl) { 1437 prevEl.setAttribute('data-closest', 'true'); 1438 prevEl = prevEl.previousElementSibling; 1439 prev++; 1440 } else { 1441 break; 1442 } 1443 } 1444 } 1445 function setDots(carousel) { 1446 if (window.innerWidth >= 600) { 1447 return; 1448 } 1449 var current_slide_num = carousel.currentSlide; 1450 carousel.carouselDots.forEach(function (element, index) { 1451 element.setAttribute('data-closest', 'false'); 1452 element.setAttribute('data-active', 'false'); 1453 }); 1454 var activeButton = carousel.carouselDots[current_slide_num]; 1455 activeButton.setAttribute('data-active', 'true'); 1456 var paginationContainer = activeButton.parentElement; 1457 if (current_slide_num < 1) { 1458 setClosest(activeButton, 2); 1459 } 1460 else if (current_slide_num === carousel.carouselDots.length - 1) { 1461 setClosest(activeButton, 2); 1462 } 1463 else { 1464 setClosest(activeButton, 1); 1465 } 1466 if (current_slide_num < 2) { 1467 paginationContainer.classList.add("dot-left-remove"); 1468 paginationContainer.classList.remove("dot-right-remove"); 1469 } 1470 else if (current_slide_num === carousel.carouselDots.length - 1 || current_slide_num === carousel.carouselDots.length - 2) { 1471 paginationContainer.classList.remove("dot-left-remove"); 1472 paginationContainer.classList.add("dot-right-remove"); 1473 } 1474 else { 1475 paginationContainer.classList.remove("dot-left-remove"); 1476 paginationContainer.classList.remove("dot-right-remove"); 1477 } 1478 } 1479 1480 // edited code 1481 1482 function togglePagination(carousel){ 1483 if(carousel.numSlides <= carousel.perPage){ 1484 carousel.config.paginationContainer.classList.add('hidden'); 1485 } else { 1486 carousel.config.paginationContainer.classList.remove('hidden'); 1487 1488 } 1489 } 1490 1491 // Function to call to switch src to data-src for lazy-loading or on unsupported browsers 1492 function switchImages(lazyImages){ 1493 if(lazyImages.length > 0){
1494 lazyImages.forEach(function(image){ 1495 image.src = image.dataset.src; 1496 }) 1497 } 1498 } 1499 1500 // Three Block Carousel 1501 1502 new _DOMReady.DOMReady(function initThreeBlockCarousel() { 1503 var containers = (0, _toArray.toArray)(document.querySelectorAll("[data-three-block-carousel-wrapper]")); 1504 if (containers.length > 0) { 1505 containers.forEach(function initCarousel(currentItem) { 1506 var carouselElement = currentItem.querySelector("[data-three-block-carousel]"); 1507 var arrows = { 1508 prev: currentItem.querySelector("[data-carousel-prev]"), 1509 next: currentItem.querySelector("[data-carousel-next]") 1510 }; 1511 var paginationContainer = currentItem.querySelector("[data-pagination]"); 1512 var slides = currentItem.querySelectorAll("[data-slide]"); 1513 var slideAccessiblity = new _SlideAccessiblity.SlideAccessiblity(carouselElement, "[data-slide]"); 1514 var carousel = new _siema2.default({ 1515 selector: carouselElement, 1516 duration: 200, 1517 easing: "ease-out", 1518 perPage: { 1519 960: 2, 1520 600: 2, 1521 0: 1 1522 }, 1523 startIndex: 0, 1524 draggable: false, 1525 threshold: 20, 1526 loop: false, 1527 paginationContainer: paginationContainer, 1528 onChange: function onChange() { 1529 carousel.carouselDots.forEach(function (currentPaginationItem) { 1530 currentPaginationItem.removeAttribute("data-active"); 1531 }); 1532 if (carousel.currentSlide < 0) { 1533 carousel.carouselDots[carousel.carouselDots.length - 1].setAttribute("data-active", "true"); 1534 } else { 1535 if (carousel.numToSlide === 1) { 1536 carousel.carouselDots[carousel.currentSlide].setAttribute("data-active", "true"); 1537 } else { 1538 var desiredDot = Math.ceil(carousel.currentSlide / carousel.numToSlide); 1539 carousel.carouselDots[desiredDot].setAttribute("data-active", "true"); 1540 } 1541 } 1542 toggleArrows(arrows, carousel); 1543 setDots(carousel); 1544 slideAccessiblity.restrictTabbingToSlides(carousel.currentSlide, carousel.numToSlide); 1545 } 1546 }); 1547 carousel.numSlides = slides.length; 1548 carousel.slideAccessiblity = slideAccessiblity; 1549 (0, _touchEvents.touchEvents)(carouselElement, carousel); 1550 (0, _arrowEvents.arrowEvents)(arrows, carousel); 1551 toggleArrows(arrows, carousel); 1552 var interactive = new _interactiveState.interactiveState(); 1553 interactive.then(function () { 1554 carouselResize(carousel); 1555 (0, _pagination.pagination)(paginationContainer, slides, carousel); 1556 setDots(carousel); 1557 carousel.resizeHandler(carousel); 1558 slideAccessiblity.restrictTabbingToSlides(carousel.currentSlide, carousel.numToSlide); 1559 }); 1560 var resizeTimeout = void 0; 1561 new _Resize.Resize(function () { 1562 clearTimeout(resizeTimeout); 1563 resizeTimeout = setTimeout(function () { 1564 carouselResize(carousel); 1565 (0, _pagination.pagination)(paginationContainer, slides, carousel); 1566 setDots(carousel); 1567 }, 50); 1568 }); 1569 }); 1570 } 1571 1572 // edited code 1573 1574 // Set IntersectionObserver on block to add lazy loading to all images in carousel 1575 let lazyImages = _toArray.toArray(document.querySelectorAll(".block-panel__panel-image")); 1576 if ("IntersectionObserver" in window) { 1577 let options = { 1578 root: null, 1579 rootMargin: '400px', 1580 threshold: 0 1581 } 1582 let lazyImageObserver = new IntersectionObserver(function(entries, observer) {
1583 entries.forEach(function(entry) { 1584 if (entry.isIntersecting) { 1585 switchImages(lazyImages) 1586 lazyImageObserver.unobserve(entry.target); 1587 } 1588 }); 1589 }, options); 1590 containers.forEach(function(container) { 1591 lazyImageObserver.observe(container); 1592 }); 1593 } else { 1594 switchImages(lazyImages) 1595 } 1596 }); 1597 1598},{"helpers/carousel/arrowEvents":26,"helpers/carousel/pagination":28,"helpers/carousel/touchEvents":29,"helpers/interactiveState":31,"helpers/shared/toArray":35,"objects/SlideAccessiblity":96,"objects/shared/DOMReady":107,"objects/shared/Resize":109,"siema":120}] 1599,50:[function(require,module,exports){ 1600 1601},{"helpers/shared/toArray":35,"objects/shared/Cookie":106,"objects/shared/DOMReady":107}] 1602,51:[function(require,module,exports){ 1603 1604},{"clipboard":114}],52:[function(require,module,exports){ 1605 1606},{"helpers/shared/toArray":35,"objects/CountrySelector":83,"objects/shared/DOMReady":107}] 1607,53:[function(require,module,exports){ 1608 1609},{"helpers/shared/toArray":35,"objects/DiagnosticTool":84,"objects/shared/DOMReady":107}] 1610,54:[function(require,module,exports){ 1611 1612},{"helpers/shared/toArray":35,"objects/DropDownList":85,"objects/shared/DOMReady":107}] 1613,55:[function(require,module,exports){ 1614 1615},{"./feefoFormModal":56,"helpers/scrollToElement":33,"helpers/shared/toArray":35,"objects/FormTags":86,"objects/feefo/Feefo":99,"objects/feefo/FeefoSchema":100,"objects/shared/DOMReady":107}] 1616,56:[function(require,module,exports){ 1617 1618},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107,"objects/shared/ToggleView":111}] 1619,57:[function(require,module,exports){ 1620 1621},{"helpers/shared/toArray":35,"objects/shared/ToggleView":111}] 1622,58:[function(require,module,exports){ 1623 1624},{"objects/shared/DOMReady":107}],59:[function(require,module,exports){ 1625 1626},{"helpers/keyAccessibility":32,"helpers/shared/toArray":35,"objects/shared/DOMReady":107}] 1627,60:[function(require,module,exports){ 1628 1629},{"helpers/keyAccessibility":32,"helpers/shared/toArray":35,"objects/shared/DOMReady":107}] 1630,61:[function(require,module,exports){ 1631 1632},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107}],62:[function(require,module,exports){ 1633 1634},{"helpers/shared/toArray":35,"objects/hotspotDefault":103,"objects/shared/DOMReady":107}] 1635,63:[function(require,module,exports){ 1636 1637},{"helpers/shared/toArray":35,"objects/hotspotListicle":104,"objects/shared/DOMReady":107}] 1638,64:[function(require,module,exports){ 1639 1640},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107}],65:[function(require,module,exports){ 1641 1642},{"helpers/shared/toArray":35,"helpers/shared/wrapElement":36,"objects/shared/DOMReady":107}] 1643,66:[function(require,module,exports){ 1644 1645},{"helpers/shared/toArray":35,"objects/LoginOverlay":90,"objects/shared/DOMReady":107}] 1646,67:[function(require,module,exports){ 1647 1648},{"helpers/shared/toArray":35,"objects/MegaMenu":91,"objects/shared/DOMReady":107}],68:[function(require,module,exports){ 1649 1650},{"helpers/shared/toArray":35,"objects/MegaMenuMobile":92,"objects/shared/DOMReady":107,"objects/shared/Resize":109}],69:[function(require,module,exports){ 1651"use strict"; 1652 1653},{"objects/MenuSearch":93,"objects/shared/DOMReady":107}],70:[function(require,module,exports){ 1654"use strict"; 1655 1656},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107}],71:[function(require,module,exports){ 1657 1658},{"objects/NavigationTracker":94,"objects/shared/DOMReady":107}],72:[function(require,module,exports){ 1659 1660},{}],73:[function(require,module,exports){ 1661 1662},{"es6-promise/auto":115}],74:[function(require,module,exports){ 1663 1664 1665},{"helpers/scrollToElement":33,"helpers/shared/toArray":35,"objects/shared/DOMReady":107}] 1666,76:[function(require,module,exports){ 1667'use strict'; 1668 1669var _toArray = require('helpers/shared/toArray'); 1670 1671var _DOMReady = require('objects/shared/DOMReady'); 1672 1673var _SocialShare = require('objects/shared/SocialShare'); 1674 1675//================================================================================================== 1676// 1677// Social Share 1678// 1679//================================================================================================== 1680new _DOMReady.DOMReady(function initShare() { 1681 1682 // Get all ahre links on page 1683 var socialShareElements = (0, _toArray.toArray)(document.querySelectorAll("[data-link='share']")); 1684 1685 // Check the elements exist 1686 if (socialShareElements.length > 0) { 1687 // Loop through all the social share elements
1688 socialShareElements.forEach(function (currentElement) { 1689 // Create new social share instance 1690 var socialShare = new _SocialShare.SocialShare(currentElement); 1691 }); 1692 } 1693}); 1694//================================================================================================== 1695// Dependencies 1696//================================================================================================== 1697 1698},{"helpers/shared/toArray":35,"objects/shared/DOMReady":107,"objects/shared/SocialShare":110}] 1699,77:[function(require,module,exports){ 1700"use strict"; 1701 1702var _toArray = require("helpers/shared/toArray"); 1703 1704var _DOMReady = require("objects/shared/DOMReady"); 1705 1706var _SocialShareMenu = require("objects/SocialShareMenu"); 1707 1708//================================================================================================== 1709// 1710// Social Share Menu 1711// 1712//================================================================================================== 1713new _DOMReady.DOMReady(function initShareMenu() { 1714 1715 // Lookup all social share menu elements 1716 var socialShareMenus = (0, _toArray.toArray)(document.querySelectorAll("[data-social-menu]")); 1717 1718 // If elements exist 1719 if (socialShareMenus.length > 0) { 1720 // Loop through the menus 1721 socialShareMenus.forEach(function (currentItem) { 1722 1723 // Create a new social share menu 1724 var socialShareMenu = new _SocialShareMenu.SocialShareMenu(currentItem); 1725 1726 // Close the menu by default (Applies relevant values to closed menu) 1727 socialShareMenu.close(); 1728 }); 1729 } 1730}); //================================================================================================== 1731// Dependencies 1732//================================================================================================== 1733 1734},{"helpers/shared/toArray":35,"objects/SocialShareMenu":97,"objects/shared/DOMReady":107}] 1735,78:[function(require,module,exports){ 1736 1737},{"svg4everybody":121}],79:[function(require,module,exports){ 1738 1739},{"helpers/shared/toArray":35,"objects/SwitchView":98,"objects/shared/DOMReady":107}],80:[function(require,module,exports){ 1740 1741},{}],81:[function(require,module,exports){ 1742 1743},{}],82:[function(require,module,exports){ 1744 1745},{"animejs":112}],83:[function(require,module,exports){ 1746 1747},{"animejs":112,"helpers/keyAccessibility":32,"helpers/shared/get":34,"helpers/shared/toArray":35,"objects/ImagePreloader":88}] 1748,84:[function(require,module,exports){ 1749 1750},{"helpers/shared/toArray":35}],85:[function(require,module,exports){ 1751 1752},{}],86:[function(require,module,exports){ 1753 1754},{"helpers/dataFindAndReplaceInElement":30}],87:[function(require,module,exports){ 1755 1756},{"helpers/keyAccessibility":32,"helpers/shared/toArray":35,"objects/AnimatedProgressBar":82}] 1757,88:[function(require,module,exports){ 1758 1759},{"helpers/shared/get":34,"helpers/shared/toArray":35}],89:[function(require,module,exports){ 1760"use strict"; 1761 1762},{"helpers/shared/toArray":35}],90:[function(require,module,exports){ 1763 1764},{"animejs":112,"helpers/scrollToElement":33,"helpers/shared/toArray":35}],91:[function(require,module,exports){ 1765 1766},{"helpers/animations/megaMenu/animateClose":22,"helpers/animations/megaMenu/animateOpen":23,"helpers/animations/megaMenu/animateSubMenuIn":24,"helpers/animations/megaMenu/animateSubMenuOut":25,"helpers/interactiveState":31,"helpers/shared/toArray":35,"objects/shared/Resize":109}] 1767,92:[function(require,module,exports){ 1768 1769},{"helpers/animations/megaMenuMobile/closeMenu":16,"helpers/animations/megaMenuMobile/closeSubMenu":17,"helpers/animations/megaMenuMobile/closeTrayMenu":18,"helpers/animations/megaMenuMobile/openMenu":19,"helpers/animations/megaMenuMobile/openSubMenu":20,"helpers/animations/megaMenuMobile/openTrayMenu":21,"helpers/interactiveState":31,"helpers/shared/toArray":35}] 1770,93:[function(require,module,exports){ 1771 1772},{"helpers/keyAccessibility":32}],94:[function(require,module,exports){ 1773 1774},{"./LoginOverlay":90,"helpers/shared/toArray":35}],95:[function(require,module,exports){ 1775 1776},{"helpers/dataFindAndReplaceInElement":30}],96:[function(require,module,exports){ 1777"use strict"; 1778 1779Object.defineProperty(exports, "__esModule", { 1780 value: true 1781}); 1782exports.SlideAccessiblity = undefined; 1783 1784var _toArray = require("helpers/shared/toArray"); 1785 1786var originalTabAttribute = "data-original-tab-index"; 1787var originalFocusAttribute = "data-original-focusable"; 1788var tabindex = "tabindex"; 1789//svg in IE11 can always be tabbed on to unless we set focusable false 1790var focusable = "focusable"; 1791 1792function stripTabIndex(elements) { 1793 var elementArray = (0, _toArray.toArray)(elements); 1794 1795 elementArray.forEach(function (element) { 1796 //check if the element has previously been processed so that we don't lose the original value of tabindex 1797 if (element.getAttribute && element.getAttribute(originalTabAttribute) === null) { 1798 setAttributeOff(element, tabindex, originalTabAttribute, "-1"); 1799 setAttributeOff(element, focusable, originalFocusAttribute, false); 1800 }
1801 stripTabIndex(element.childNodes); 1802 }); 1803} 1804 1805function setAttributeOff(element, attributeName, attributeStore, offValue) { 1806 //Get current value, convert null to an empty string 1807 var currentValue = element.getAttribute(attributeName) || ""; 1808 1809 //Store the current value in a data attribute on the element 1810 element.setAttribute(attributeStore, currentValue); 1811 1812 //Set the attribute to the off state 1813 element.setAttribute(attributeName, offValue); 1814} 1815 1816function restoreTabIndex(elements) { 1817 var elementArray = (0, _toArray.toArray)(elements); 1818 1819 elementArray.forEach(function (element) { 1820 if (element.getAttribute && element.getAttribute(originalTabAttribute) !== null) { 1821 setAttributeOn(element, tabindex, originalTabAttribute); 1822 setAttributeOn(element, focusable, originalFocusAttribute); 1823 } 1824 restoreTabIndex(element.childNodes); 1825 }); 1826} 1827 1828function setAttributeOn(element, attributeName, attributeStore) { 1829 var originalValue = element.getAttribute(attributeStore); 1830 element.removeAttribute(attributeStore); 1831 if (originalValue) { 1832 element.setAttribute(attributeName, originalValue); 1833 } else { 1834 element.removeAttribute(attributeName); 1835 } 1836} 1837 1838// TODO Good comments 1839// Initialise this before siema so it can count the slides without endless clones 1840var SlideAccessiblity = exports.SlideAccessiblity = function SlideAccessiblity(container, selector) { 1841 this.container = container; 1842 this.selector = selector; 1843 this.originalSlideCount = container.querySelectorAll(selector).length; 1844}; 1845 1846//Call this every time the browser is resized or the carousel index is changed 1847SlideAccessiblity.prototype.restrictTabbingToSlides = function (slidePosition, numberOfSlides) { 1848 var allSlides = (0, _toArray.toArray)(this.container.querySelectorAll(this.selector)); 1849 1850 //Siema will have created clones of first and last for endless if loop = true, need to account for this 1851 var offSet = (allSlides.length - this.originalSlideCount) / 2; 1852 1853 slidePosition += offSet; 1854 1855 var slides = allSlides.slice(slidePosition, slidePosition + numberOfSlides); 1856 1857 stripTabIndex(allSlides); 1858 restoreTabIndex(slides); 1859}; 1860 1861SlideAccessiblity.prototype.enableTabbingOnAllSlides = function () { 1862 restoreTabIndex(this.container.querySelectorAll(this.selector)); 1863}; 1864 1865},{"helpers/shared/toArray":35}],97:[function(require,module,exports){ 1866 1867},{"helpers/keyAccessibility":32,"helpers/shared/toArray":35}],98:[function(require,module,exports){ 1868 1869},{}],99:[function(require,module,exports){ 1870 1871},{"./data/FeefoData":101,"./utility/FeefoConstants":102,"helpers/dataFindAndReplaceInElement":30,"implementation/carousel/responsiveBlockCarousel":48,"implementation/feefo/feefoToggleTriggers":57,"objects/Pagination":95}] 1872,100:[function(require,module,exports){ 1873 1874},{"./data/FeefoData":101}],101:[function(require,module,exports){ 1875 1876},{"helpers/shared/get":34,"lodash.merge":118}],102:[function(require,module,exports){ 1877 1878},{}],103:[function(require,module,exports){ 1879 1880},{}],104:[function(require,module,exports){ 1881 1882},{"helpers/shared/toArray":35}],105:[function(require,module,exports){ 1883 1884},{"helpers/shared/toArray":35}],106:[function(require,module,exports){ 1885 1886},{}],107:[function(require,module,exports){ 1887 "use strict"; 1888 Object.defineProperty(exports, "__esModule", { 1889 value: true 1890 }); 1891 var callbacks = []; 1892 var ready = false; 1893 var DOMReady = exports.DOMReady = function DOMReady(callback) { 1894 var dom = this; 1895 dom.callback = callback; 1896 if (callback) { 1897 dom.init(); 1898 } 1899 }; 1900 DOMReady.prototype.init = function () { 1901 var dom = this; 1902 if (ready === false) { 1903 callbacks.push(dom.callback); 1904 } else { 1905 dom.callback(); 1906 } 1907 }; 1908 DOMReady.prototype.isReady = function () { 1909 return ready; 1910 }; 1911 function listener(event) { 1912 ready = true; 1913 callbacks.forEach(function iterate(callback) { 1914 callback(event); 1915 }); 1916 callbacks = []; 1917 event.preventDefault(); 1918 } 1919 document.addEventListener("DOMContentLoaded", listener, true); 1920 1921},{}],108:[function(require,module,exports){ 1922 "use strict"; 1923 1924 },{}],109:[function(require,module,exports){ 1925"use strict"; 1926 1927Object.defineProperty(exports, "__esModule", { 1928 value: true 1929}); 1930//================================================================================================== 1931// 1932// Resize event handler 1933// 1934//================================================================================================== 1935 1936//================================================================================================== 1937// Private variables 1938//================================================================================================== 1939/** 1940 * Queue of callbacks to be called when a resize event is fired 1941 * @private 1942 * @memberof Resize 1943 */ 1944var callbacks = []; 1945 1946//================================================================================================== 1947// We will assume if this object is imported the handler should be bound 1948//================================================================================================== 1949/** 1950 * Event listener added to the document to iterate through our callbacks 1951 * @private 1952 * @function listener 1953 * @memberof Resize 1954 * @param {Event} event - Event object passed to our callback by the event listener 1955 */ 1956function listener(event) { 1957 callbacks.forEach(function iterateCallbacks(callback) { 1958 if (callback) { 1959 callback(event); 1960 } 1961 });
1962} 1963 1964window.addEventListener("resize", listener); 1965 1966//================================================================================================== 1967// Constructor 1968//================================================================================================== 1969/** 1970 * Wrapper for the browser resize event. 1971 * This has the added benefit of only one event handler being bound, and the ability to add/remove individual callbacks 1972 * @constructor 1973 * @param {Function} callback - Callback to be added to the resize queue 1974 * @property {Function} index - Position of our callback within the resize queue 1975 * @property {Function} callback - Local reference to the callback passed on instantiation 1976 * @example 1977 * let callback = function(event) { console.log(event); } 1978 * let resize = new Resize(callback); 1979 */ 1980var Resize = exports.Resize = function Resize(callback) { 1981 var resize = this; 1982 1983 resize.callback = callback; 1984 resize.index = undefined; 1985 1986 if (callback) { 1987 resize.attach(callback); 1988 } 1989}; 1990 1991//================================================================================================== 1992// Method for adding the callback from this instance of Resize to the queue 1993//================================================================================================== 1994/** 1995 * Method to attach our callback to the resize queue 1996 * This is done automatically when the Resize object is instantiated 1997 */ 1998Resize.prototype.attach = function () { 1999 var resize = this; 2000 2001 if (resize.index === undefined) { 2002 resize.index = callbacks.length; 2003 callbacks[resize.index] = resize.callback; 2004 } 2005 2006 return resize; 2007}; 2008 2009//================================================================================================== 2010// Method for removing the callback from the queue 2011//================================================================================================== 2012/** 2013 * Method to detach our callback to the resize queue 2014 */ 2015Resize.prototype.detach = function () { 2016 var resize = this; 2017 2018 if (resize.index !== undefined) { 2019 callbacks[resize.index] = undefined; 2020 resize.index = undefined; 2021 } 2022 2023 return resize; 2024}; 2025 2026//================================================================================================== 2027// Expose our private queue array 2028//================================================================================================== 2029/** 2030 * Exposes our private callback collection 2031 * @returns {Array} - Callback collection 2032 */ 2033Resize.prototype.getCallbacks = function () { 2034 return callbacks; 2035}; 2036 2037},{}],110:[function(require,module,exports){ 2038"use strict"; 2039 2040Object.defineProperty(exports, "__esModule", { 2041 value: true 2042}); 2043//================================================================================================== 2044// 2045// Social Share 2046// 2047//================================================================================================== 2048 2049//================================================================================================== 2050// Share URLs 2051//================================================================================================== 2052/** 2053 * Share API URLs 2054 */ 2055var shareUrls = { 2056 X: "https://twitter.com/intent/tweet?&text={text}&hashtags={hashtags}&related={related}&url={url}", 2057 facebook: "https://www.facebook.com/sharer/sharer.php?u={url}", 2058 pinterest: "http://pinterest.com/pin/create/button/?url={url}&description={text}&media={image}", 2059 google: "https://plus.google.com/share?url={url}", 2060 linkedin: "https://www.linkedin.com/shareArticle?mini=true&url={url}&summary={text}&source={source}", 2061 email: "mailto:{mail}?subject={subject}&body={body}" 2062}; 2063 2064//================================================================================================== 2065// Private Methods 2066//================================================================================================== 2067/** 2068 * Get Data Attributes 2069 */ 2070function getDataAttributes(node) { 2071 var datAttributeList = {}; 2072 var dataAttrRegEx = /^data\-(.+)$/; 2073 2074 for (var i = 0; i < node.attributes.length; i++) {
2075 var nodeAttribute = node.attributes[i].nodeName; 2076 if (dataAttrRegEx.test(nodeAttribute)) { 2077 datAttributeList[node.attributes[i].nodeName.match(dataAttrRegEx)[1]] = node.attributes[i].nodeValue; 2078 } 2079 } 2080 2081 return datAttributeList; 2082} 2083 2084//================================================================================================== 2085// Constructor 2086//================================================================================================== 2087var SocialShare = exports.SocialShare = function SocialShare(button) { 2088 var socialShare = this; 2089 2090 socialShare.button = button; 2091 socialShare.dataAttributes = getDataAttributes(button); 2092 2093 // if url attribute is not defined use page HREF 2094 if (!socialShare.dataAttributes.url) { 2095 socialShare.dataAttributes.url = encodeURIComponent(window.location.href); 2096 } 2097 2098 // handle click 2099 socialShare.button.addEventListener("click", function (e) { 2100 e.preventDefault(); 2101 socialShare.share(); 2102 }, false); 2103}; 2104 2105//================================================================================================== 2106// Share 2107//================================================================================================== 2108/** 2109 * Opens a share window 2110 * @return {void} 2111 */ 2112SocialShare.prototype.share = function () { 2113 var SocialShare = this; 2114 2115 if (SocialShare.dataAttributes.social === "email") { 2116 window.location = this.getShareUrl(); 2117 } else { 2118 window.open(SocialShare.getShareUrl(), "shareDialog", "menubar=no,toolbar=no,resizable=yes,scrollbars=yes,width=660,height=480"); 2119 } 2120}; 2121 2122//================================================================================================== 2123// Get Share Url 2124//================================================================================================== 2125/** 2126 * Creates share URL for a specific social channel 2127 * @return {string} - share url 2128 */ 2129SocialShare.prototype.getShareUrl = function () { 2130 var SocialShare = this; 2131 2132 SocialShare.shareUrl = shareUrls[SocialShare.dataAttributes.social]; 2133 2134 // replace all URL attributes 2135 for (var attribute in this.dataAttributes) { 2136 if (SocialShare.dataAttributes.hasOwnProperty(attribute)) { 2137 SocialShare.shareUrl = SocialShare.shareUrl.replace("{" + attribute + "}", SocialShare.dataAttributes[attribute]); 2138 } 2139 } 2140 2141 // replace all placeholders e.g. {text} with empty string 2142 SocialShare.shareUrl = SocialShare.shareUrl.replace(/[^\?&=]+={.*?}&?/g, ""); 2143 2144 return this.shareUrl; 2145}; 2146 2147},{}],111:[function(require,module,exports){ 2148 2149},{}],112:[function(require,module,exports){ 2150 2151},{}],113:[function(require,module,exports){ 2152 2153},{}],114:[function(require,module,exports){ 2154 2155},{}],115:[function(require,module,exports){ 2156 2157},{"./":116}],116:[function(require,module,exports){ 2158 2159},{"_process":119}],117:[function(require,module,exports){ 2160/*!
vendor: 9,745 bytes, lines 2160-2542
2160Hammer.JS - v2.0.7 - 2016-04-22 2161 * http://hammerjs.github.io/ 2162 * 2163 * Copyright (c) 2016 Jorik Tangelder; 2164 * Licensed under the MIT license */ 2165(function(window, document, exportName, undefined) { 2166 'use strict'; 2167 2168var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; 2169var TEST_ELEMENT = document.createElement('div'); 2170 2171var TYPE_FUNCTION = 'function'; 2172 2173var round = Math.round; 2174var abs = Math.abs; 2175var now = Date.now; 2176 2177/** 2178 * set a timeout with a given scope 2179 * @param {Function} fn 2180 * @param {Number} timeout 2181 * @param {Object} context 2182 * @returns {number} 2183 */ 2184function setTimeoutContext(fn, timeout, context) { 2185 return setTimeout(bindFn(fn, context), timeout); 2186} 2187 2188/** 2189 * if the argument is an array, we want to execute the fn on each entry 2190 * if it aint an array we don't want to do a thing. 2191 * this is used by all the methods that accept a single and array argument. 2192 * @param {*|Array} arg 2193 * @param {String} fn 2194 * @param {Object} [context] 2195 * @returns {Boolean} 2196 */ 2197function invokeArrayArg(arg, fn, context) { 2198 if (Array.isArray(arg)) { 2199 each(arg, context[fn], context); 2200 return true; 2201 } 2202 return false; 2203} 2204 2205/** 2206 * walk objects and arrays 2207 * @param {Object} obj 2208 * @param {Function} iterator 2209 * @param {Object} context 2210 */ 2211function each(obj, iterator, context) { 2212 var i; 2213 2214 if (!obj) { 2215 return; 2216 } 2217 2218 if (obj.forEach) { 2219 obj.forEach(iterator, context); 2220 } else if (obj.length !== undefined) { 2221 i = 0; 2222 while (i < obj.length) { 2223 iterator.call(context, obj[i], i, obj); 2224 i++; 2225 } 2226 } else { 2227 for (i in obj) { 2228 obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); 2229 } 2230 } 2231} 2232 2233/** 2234 * wrap a method with a deprecation warning and stack trace 2235 * @param {Function} method 2236 * @param {String} name 2237 * @param {String} message 2238 * @returns {Function} A new function wrapping the supplied method. 2239 */ 2240function deprecate(method, name, message) { 2241 var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n'; 2242 return function() { 2243 var e = new Error('get-stack-trace'); 2244 var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '') 2245 .replace(/^\s+at\s+/gm, '') 2246 .replace(/^Object.<anonymous>\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; 2247 2248 var log = window.console && (window.console.warn || window.console.log); 2249 if (log) { 2250 log.call(window.console, deprecationMessage, stack); 2251 } 2252 return method.apply(this, arguments); 2253 }; 2254} 2255 2256/** 2257 * extend object. 2258 * means that properties in dest will be overwritten by the ones in src. 2259 * @param {Object} target 2260 * @param {...Object} objects_to_assign 2261 * @returns {Object} target 2262 */ 2263var assign; 2264if (typeof Object.assign !== 'function') { 2265 assign = function assign(target) { 2266 if (target === undefined || target === null) { 2267 throw new TypeError('Cannot convert undefined or null to object'); 2268 } 2269 2270 var output = Object(target); 2271 for (var index = 1; index < arguments.length; index++) { 2272 var source = arguments[index]; 2273 if (source !== undefined && source !== null) { 2274 for (var nextKey in source) { 2275 if (source.hasOwnProperty(nextKey)) { 2276 output[nextKey] = source[nextKey]; 2277 } 2278 } 2279 } 2280 } 2281 return output; 2282 }; 2283} else { 2284 assign = Object.assign; 2285} 2286 2287/** 2288 * extend object. 2289 * means that properties in dest will be overwritten by the ones in src. 2290 * @param {Object} dest 2291 * @param {Object} src 2292 * @param {Boolean} [merge=false] 2293 * @returns {Object} dest 2294 */ 2295var extend = deprecate(function extend(dest, src, merge) { 2296 var keys = Object.keys(src); 2297 var i = 0; 2298 while (i < keys.length) { 2299 if (!merge || (merge && dest[keys[i]] === undefined)) { 2300 dest[keys[i]] = src[keys[i]]; 2301 } 2302 i++; 2303 } 2304 return dest; 2305}, 'extend', 'Use `assign`.'); 2306 2307/** 2308 * merge the values from src in the dest. 2309 * means that properties that exist in dest will not be overwritten by src 2310 * @param {Object} dest 2311 * @param {Object} src 2312 * @returns {Object} dest 2313 */ 2314var merge = deprecate(function merge(dest, src) { 2315 return extend(dest, src, true); 2316}, 'merge', 'Use `assign`.'); 2317 2318/** 2319 * simple class inheritance 2320 * @param {Function} child 2321 * @param {Function} base 2322 * @param {Object} [properties] 2323 */ 2324function inherit(child, base, properties) { 2325 var baseP = base.prototype, 2326 childP; 2327 2328 childP = child.prototype = Object.create(baseP); 2329 childP.constructor = child; 2330 childP._super = baseP; 2331 2332 if (properties) { 2333 assign(childP, properties); 2334 } 2335} 2336 2337/** 2338 * simple function bind 2339 * @param {Function} fn 2340 * @param {Object} context 2341 * @returns {Function} 2342 */ 2343function bindFn(fn, context) { 2344 return function boundFn() { 2345 return fn.apply(context, arguments); 2346 }; 2347} 2348 2349/** 2350 * let a boolean value also be a function that must return a boolean 2351 * this first item in args will be used as the context 2352 * @param {Boolean|Function} val 2353 * @param {Array} [args] 2354 * @returns {Boolean} 2355 */ 2356function boolOrFn(val, args) { 2357 if (typeof val == TYPE_FUNCTION) { 2358 return val.apply(args ? args[0] || undefined : undefined, args); 2359 } 2360 return val; 2361} 2362 2363/** 2364 * use the val2 when val1 is undefined 2365 * @param {*} val1 2366 * @param {*} val2 2367 * @returns {*} 2368 */ 2369function ifUndefined(val1, val2) { 2370 return (val1 === undefined) ? val2 : val1; 2371} 2372 2373/** 2374 * addEventListener with multiple events at once 2375 * @param {EventTarget} target 2376 * @param {String} types 2377 * @param {Function} handler 2378 */ 2379function addEventListeners(target, types, handler) { 2380 each(splitStr(types), function(type) { 2381 target.addEventListener(type, handler, false); 2382 }); 2383} 2384 2385/** 2386 * removeEventListener with multiple events at once 2387 * @param {EventTarget} target 2388 * @param {String} types 2389 * @param {Function} handler 2390 */ 2391function removeEventListeners(target, types, handler) { 2392 each(splitStr(types), function(type) { 2393 target.removeEventListener(type, handler, false); 2394 }); 2395} 2396 2397/** 2398 * find if a node is in the given parent 2399 * @method hasParent 2400 * @param {HTMLElement} node 2401 * @param {HTMLElement} parent 2402 * @return {Boolean} found 2403 */ 2404function hasParent(node, parent) { 2405 while (node) { 2406 if (node == parent) { 2407 return true; 2408 } 2409 node = node.parentNode; 2410 } 2411 return false; 2412} 2413 2414/** 2415 * small indexOf wrapper 2416 * @param {String} str 2417 * @param {String} find 2418 * @returns {Boolean} found 2419 */ 2420function inStr(str, find) { 2421 return str.indexOf(find) > -1; 2422} 2423 2424/** 2425 * split string on whitespace 2426 * @param {String} str 2427 * @returns {Array} words 2428 */ 2429function splitStr(str) { 2430 return str.trim().split(/\s+/g); 2431} 2432 2433/** 2434 * find if a array contains the object using indexOf or a simple polyFill 2435 * @param {Array} src 2436 * @param {String} find 2437 * @param {String} [findByKey] 2438 * @return {Boolean|Number} false when not found, or the index 2439 */ 2440function inArray(src, find, findByKey) { 2441 if (src.indexOf && !findByKey) { 2442 return src.indexOf(find); 2443 } else { 2444 var i = 0; 2445 while (i < src.length) { 2446 if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) { 2447 return i; 2448 } 2449 i++; 2450 } 2451 return -1; 2452 } 2453} 2454 2455/** 2456 * convert array-like objects to real arrays 2457 * @param {Object} obj 2458 * @returns {Array} 2459 */ 2460function toArray(obj) { 2461 return Array.prototype.slice.call(obj, 0); 2462} 2463 2464/** 2465 * unique array with objects based on a key (like 'id') or just by the array's value 2466 * @param {Array} src [{id:1},{id:2},{id:1}] 2467 * @param {String} [key] 2468 * @param {Boolean} [sort=False] 2469 * @returns {Array} [{id:1},{id:2}] 2470 */ 2471function uniqueArray(src, key, sort) { 2472 var results = []; 2473 var values = []; 2474 var i = 0; 2475 2476 while (i < src.length) { 2477 var val = key ? src[i][key] : src[i]; 2478 if (inArray(values, val) < 0) { 2479 results.push(src[i]); 2480 } 2481 values[i] = val; 2482 i++; 2483 } 2484 2485 if (sort) { 2486 if (!key) { 2487 results = results.sort(); 2488 } else { 2489 results = results.sort(function sortUniqueArray(a, b) { 2490 return a[key] > b[key]; 2491 }); 2492 } 2493 } 2494 2495 return results; 2496} 2497 2498/** 2499 * get the prefixed property 2500 * @param {Object} obj 2501 * @param {String} property 2502 * @returns {String|Undefined} prefixed 2503 */ 2504function prefixed(obj, property) { 2505 var prefix, prop; 2506 var camelProp = property[0].toUpperCase() + property.slice(1); 2507 2508 var i = 0; 2509 while (i < VENDOR_PREFIXES.length) { 2510 prefix = VENDOR_PREFIXES[i]; 2511 prop = (prefix) ? prefix + camelProp : property; 2512 2513 if (prop in obj) { 2514 return prop; 2515 } 2516 i++; 2517 } 2518 return undefined; 2519} 2520 2521/** 2522 * get a unique id 2523 * @returns {number} uniqueId 2524 */ 2525var _uniqueId = 1; 2526function uniqueId() { 2527 return _uniqueId++; 2528} 2529 2530/** 2531 * get the window object of an element 2532 * @param {HTMLElement} element 2533 * @returns {DocumentView|Window} 2534 */ 2535function getWindowForElement(element) { 2536 var doc = element.ownerDocument || element; 2537 return (doc.defaultView || doc.parentWindow || window); 2538} 2539 2540var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; 2541 2542var SUPPORT_TOUCH = ('ontouchstart' in window);
vendor: 2,458 bytes, lines 2543-2626
2543var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined; 2544var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); 2545 2546var INPUT_TYPE_TOUCH = 'touch'; 2547var INPUT_TYPE_PEN = 'pen'; 2548var INPUT_TYPE_MOUSE = 'mouse'; 2549var INPUT_TYPE_KINECT = 'kinect'; 2550 2551var COMPUTE_INTERVAL = 25; 2552 2553var INPUT_START = 1; 2554var INPUT_MOVE = 2; 2555var INPUT_END = 4; 2556var INPUT_CANCEL = 8; 2557 2558var DIRECTION_NONE = 1; 2559var DIRECTION_LEFT = 2; 2560var DIRECTION_RIGHT = 4; 2561var DIRECTION_UP = 8; 2562var DIRECTION_DOWN = 16; 2563 2564var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; 2565var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; 2566var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; 2567 2568var PROPS_XY = ['x', 'y']; 2569var PROPS_CLIENT_XY = ['clientX', 'clientY']; 2570 2571/** 2572 * create new input type manager 2573 * @param {Manager} manager 2574 * @param {Function} callback 2575 * @returns {Input} 2576 * @constructor 2577 */ 2578function Input(manager, callback) { 2579 var self = this; 2580 this.manager = manager; 2581 this.callback = callback; 2582 this.element = manager.element; 2583 this.target = manager.options.inputTarget; 2584 2585 // smaller wrapper around the handler, for the scope and the enabled state of the manager, 2586 // so when disabled the input events are completely bypassed. 2587 this.domHandler = function(ev) { 2588 if (boolOrFn(manager.options.enable, [manager])) { 2589 self.handler(ev); 2590 } 2591 }; 2592 2593 this.init(); 2594 2595} 2596 2597Input.prototype = { 2598 /** 2599 * should handle the inputEvent data and trigger the callback 2600 * @virtual 2601 */ 2602 handler: function() { }, 2603 2604 /** 2605 * bind the events 2606 */ 2607 init: function() { 2608 this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); 2609 this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); 2610 this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); 2611 }, 2612 2613 /** 2614 * unbind the events 2615 */ 2616 destroy: function() { 2617 this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); 2618 this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); 2619 this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); 2620 } 2621}; 2622 2623/** 2624 * create new input type manager 2625 * called by the Manager constructor 2626 * @param {
vendor: 49,124 bytes, lines 2626-4298
2626Hammer} manager 2627 * @returns {Input} 2628 */ 2629function createInputInstance(manager) { 2630 var Type; 2631 var inputClass = manager.options.inputClass; 2632 2633 if (inputClass) { 2634 Type = inputClass; 2635 } else if (SUPPORT_POINTER_EVENTS) { 2636 Type = PointerEventInput; 2637 } else if (SUPPORT_ONLY_TOUCH) { 2638 Type = TouchInput; 2639 } else if (!SUPPORT_TOUCH) { 2640 Type = MouseInput; 2641 } else { 2642 Type = TouchMouseInput; 2643 } 2644 return new (Type)(manager, inputHandler); 2645} 2646 2647/** 2648 * handle input events 2649 * @param {Manager} manager 2650 * @param {String} eventType 2651 * @param {Object} input 2652 */ 2653function inputHandler(manager, eventType, input) { 2654 var pointersLen = input.pointers.length; 2655 var changedPointersLen = input.changedPointers.length; 2656 var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0)); 2657 var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0)); 2658 2659 input.isFirst = !!isFirst; 2660 input.isFinal = !!isFinal; 2661 2662 if (isFirst) { 2663 manager.session = {}; 2664 } 2665 2666 // source event is the normalized value of the domEvents 2667 // like 'touchstart, mouseup, pointerdown' 2668 input.eventType = eventType; 2669 2670 // compute scale, rotation etc 2671 computeInputData(manager, input); 2672 2673 // emit secret event 2674 manager.emit('hammer.input', input); 2675 2676 manager.recognize(input); 2677 manager.session.prevInput = input; 2678} 2679 2680/** 2681 * extend the data with some usable properties like scale, rotate, velocity etc 2682 * @param {Object} manager 2683 * @param {Object} input 2684 */ 2685function computeInputData(manager, input) { 2686 var session = manager.session; 2687 var pointers = input.pointers; 2688 var pointersLength = pointers.length; 2689 2690 // store the first input to calculate the distance and direction 2691 if (!session.firstInput) { 2692 session.firstInput = simpleCloneInputData(input); 2693 } 2694 2695 // to compute scale and rotation we need to store the multiple touches 2696 if (pointersLength > 1 && !session.firstMultiple) { 2697 session.firstMultiple = simpleCloneInputData(input); 2698 } else if (pointersLength === 1) { 2699 session.firstMultiple = false; 2700 } 2701 2702 var firstInput = session.firstInput; 2703 var firstMultiple = session.firstMultiple; 2704 var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; 2705 2706 var center = input.center = getCenter(pointers); 2707 input.timeStamp = now(); 2708 input.deltaTime = input.timeStamp - firstInput.timeStamp; 2709 2710 input.angle = getAngle(offsetCenter, center); 2711 input.distance = getDistance(offsetCenter, center); 2712 2713 computeDeltaXY(session, input); 2714 input.offsetDirection = getDirection(input.deltaX, input.deltaY); 2715 2716 var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); 2717 input.overallVelocityX = overallVelocity.x; 2718 input.overallVelocityY = overallVelocity.y; 2719 input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y; 2720 2721 input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; 2722 input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; 2723 2724 input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length > 2725 session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers); 2726 2727 computeIntervalInputData(session, input); 2728 2729 // find the correct target 2730 var target = manager.element; 2731 if (hasParent(input.srcEvent.target, target)) { 2732 target = input.srcEvent.target; 2733 } 2734 input.target = target; 2735} 2736 2737function computeDeltaXY(session, input) { 2738 var center = input.center; 2739 var offset = session.offsetDelta || {}; 2740 var prevDelta = session.prevDelta || {}; 2741 var prevInput = session.prevInput || {}; 2742 2743 if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { 2744 prevDelta = session.prevDelta = { 2745 x: prevInput.deltaX || 0, 2746 y: prevInput.deltaY || 0 2747 }; 2748 2749 offset = session.offsetDelta = { 2750 x: center.x, 2751 y: center.y 2752 }; 2753 } 2754 2755 input.deltaX = prevDelta.x + (center.x - offset.x); 2756 input.deltaY = prevDelta.y + (center.y - offset.y); 2757} 2758 2759/** 2760 * velocity is calculated every x ms 2761 * @param {Object} session 2762 * @param {Object} input 2763 */ 2764function computeIntervalInputData(session, input) { 2765 var last = session.lastInterval || input, 2766 deltaTime = input.timeStamp - last.timeStamp, 2767 velocity, velocityX, velocityY, direction; 2768 2769 if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { 2770 var deltaX = input.deltaX - last.deltaX; 2771 var deltaY = input.deltaY - last.deltaY; 2772 2773 var v = getVelocity(deltaTime, deltaX, deltaY); 2774 velocityX = v.x; 2775 velocityY = v.y; 2776 velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y; 2777 direction = getDirection(deltaX, deltaY); 2778 2779 session.lastInterval = input; 2780 } else { 2781 // use latest velocity info if it doesn't overtake a minimum period 2782 velocity = last.velocity; 2783 velocityX = last.velocityX; 2784 velocityY = last.velocityY; 2785 direction = last.direction; 2786 } 2787 2788 input.velocity = velocity; 2789 input.velocityX = velocityX; 2790 input.velocityY = velocityY; 2791 input.direction = direction; 2792} 2793 2794/** 2795 * create a simple clone from the input used for storage of firstInput and firstMultiple 2796 * @param {Object} input 2797 * @returns {Object} clonedInputData 2798 */ 2799function simpleCloneInputData(input) { 2800 // make a simple copy of the pointers because we will get a reference if we don't 2801 // we only need clientXY for the calculations 2802 var pointers = []; 2803 var i = 0; 2804 while (i < input.pointers.length) { 2805 pointers[i] = { 2806 clientX: round(input.pointers[i].clientX), 2807 clientY: round(input.pointers[i].clientY) 2808 }; 2809 i++; 2810 } 2811 2812 return { 2813 timeStamp: now(), 2814 pointers: pointers, 2815 center: getCenter(pointers), 2816 deltaX: input.deltaX, 2817 deltaY: input.deltaY 2818 }; 2819} 2820 2821/** 2822 * get the center of all the pointers 2823 * @param {Array} pointers 2824 * @return {Object} center contains `x` and `y` properties 2825 */ 2826function getCenter(pointers) { 2827 var pointersLength = pointers.length; 2828 2829 // no need to loop when only one touch 2830 if (pointersLength === 1) { 2831 return { 2832 x: round(pointers[0].clientX), 2833 y: round(pointers[0].clientY) 2834 }; 2835 } 2836 2837 var x = 0, y = 0, i = 0; 2838 while (i < pointersLength) { 2839 x += pointers[i].clientX; 2840 y += pointers[i].clientY; 2841 i++; 2842 } 2843 2844 return { 2845 x: round(x / pointersLength), 2846 y: round(y / pointersLength) 2847 }; 2848} 2849 2850/** 2851 * calculate the velocity between two points. unit is in px per ms. 2852 * @param {Number} deltaTime 2853 * @param {Number} x 2854 * @param {Number} y 2855 * @return {Object} velocity `x` and `y` 2856 */ 2857function getVelocity(deltaTime, x, y) { 2858 return { 2859 x: x / deltaTime || 0, 2860 y: y / deltaTime || 0 2861 }; 2862} 2863 2864/** 2865 * get the direction between two points 2866 * @param {Number} x 2867 * @param {Number} y 2868 * @return {Number} direction 2869 */ 2870function getDirection(x, y) { 2871 if (x === y) { 2872 return DIRECTION_NONE; 2873 } 2874 2875 if (abs(x) >= abs(y)) { 2876 return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; 2877 } 2878 return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; 2879} 2880 2881/** 2882 * calculate the absolute distance between two points 2883 * @param {Object} p1 {x, y} 2884 * @param {Object} p2 {x, y} 2885 * @param {Array} [props] containing x and y keys 2886 * @return {Number} distance 2887 */ 2888function getDistance(p1, p2, props) { 2889 if (!props) { 2890 props = PROPS_XY; 2891 } 2892 var x = p2[props[0]] - p1[props[0]], 2893 y = p2[props[1]] - p1[props[1]]; 2894 2895 return Math.sqrt((x * x) + (y * y)); 2896} 2897 2898/** 2899 * calculate the angle between two coordinates 2900 * @param {Object} p1 2901 * @param {Object} p2 2902 * @param {Array} [props] containing x and y keys 2903 * @return {Number} angle 2904 */ 2905function getAngle(p1, p2, props) { 2906 if (!props) { 2907 props = PROPS_XY; 2908 } 2909 var x = p2[props[0]] - p1[props[0]], 2910 y = p2[props[1]] - p1[props[1]]; 2911 return Math.atan2(y, x) * 180 / Math.PI; 2912} 2913 2914/** 2915 * calculate the rotation degrees between two pointersets 2916 * @param {Array} start array of pointers 2917 * @param {Array} end array of pointers 2918 * @return {Number} rotation 2919 */ 2920function getRotation(start, end) { 2921 return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); 2922} 2923 2924/** 2925 * calculate the scale factor between two pointersets 2926 * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out 2927 * @param {Array} start array of pointers 2928 * @param {Array} end array of pointers 2929 * @return {Number} scale 2930 */ 2931function getScale(start, end) { 2932 return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); 2933} 2934 2935var MOUSE_INPUT_MAP = { 2936 mousedown: INPUT_START, 2937 mousemove: INPUT_MOVE, 2938 mouseup: INPUT_END 2939}; 2940 2941var MOUSE_ELEMENT_EVENTS = 'mousedown'; 2942var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; 2943 2944/** 2945 * Mouse events input 2946 * @constructor 2947 * @extends Input 2948 */ 2949function MouseInput() { 2950 this.evEl = MOUSE_ELEMENT_EVENTS; 2951 this.evWin = MOUSE_WINDOW_EVENTS; 2952 2953 this.pressed = false; // mousedown state 2954 2955 Input.apply(this, arguments); 2956} 2957 2958inherit(MouseInput, Input, { 2959 /** 2960 * handle mouse events 2961 * @param {Object} ev 2962 */ 2963 handler: function MEhandler(ev) { 2964 var eventType = MOUSE_INPUT_MAP[ev.type]; 2965 2966 // on start we want to have the left mouse button down 2967 if (eventType & INPUT_START && ev.button === 0) { 2968 this.pressed = true; 2969 } 2970 2971 if (eventType & INPUT_MOVE && ev.which !== 1) { 2972 eventType = INPUT_END; 2973 } 2974 2975 // mouse must be down 2976 if (!this.pressed) { 2977 return; 2978 } 2979 2980 if (eventType & INPUT_END) { 2981 this.pressed = false; 2982 } 2983 2984 this.callback(this.manager, eventType, { 2985 pointers: [ev], 2986 changedPointers: [ev], 2987 pointerType: INPUT_TYPE_MOUSE, 2988 srcEvent: ev 2989 }); 2990 } 2991}); 2992 2993var POINTER_INPUT_MAP = { 2994 pointerdown: INPUT_START, 2995 pointermove: INPUT_MOVE, 2996 pointerup: INPUT_END, 2997 pointercancel: INPUT_CANCEL, 2998 pointerout: INPUT_CANCEL 2999}; 3000 3001// in IE10 the pointer types is defined as an enum 3002var IE10_POINTER_TYPE_ENUM = { 3003 2: INPUT_TYPE_TOUCH, 3004 3: INPUT_TYPE_PEN, 3005 4: INPUT_TYPE_MOUSE, 3006 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 3007}; 3008 3009var POINTER_ELEMENT_EVENTS = 'pointerdown'; 3010var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; 3011 3012// IE10 has prefixed support, and case-sensitive 3013if (window.MSPointerEvent && !window.PointerEvent) { 3014 POINTER_ELEMENT_EVENTS = 'MSPointerDown'; 3015 POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; 3016} 3017 3018/** 3019 * Pointer events input 3020 * @constructor 3021 * @extends Input 3022 */ 3023function PointerEventInput() { 3024 this.evEl = POINTER_ELEMENT_EVENTS; 3025 this.evWin = POINTER_WINDOW_EVENTS; 3026 3027 Input.apply(this, arguments); 3028 3029 this.store = (this.manager.session.pointerEvents = []); 3030} 3031 3032inherit(PointerEventInput, Input, { 3033 /** 3034 * handle mouse events 3035 * @param {Object} ev 3036 */ 3037 handler: function PEhandler(ev) { 3038 var store = this.store; 3039 var removePointer = false; 3040 3041 var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); 3042 var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; 3043 var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; 3044 3045 var isTouch = (pointerType == INPUT_TYPE_TOUCH); 3046 3047 // get index of the event in the store 3048 var storeIndex = inArray(store, ev.pointerId, 'pointerId'); 3049 3050 // start and mouse must be down 3051 if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { 3052 if (storeIndex < 0) { 3053 store.push(ev); 3054 storeIndex = store.length - 1; 3055 } 3056 } else if (eventType & (INPUT_END | INPUT_CANCEL)) { 3057 removePointer = true; 3058 } 3059 3060 // it not found, so the pointer hasn't been down (so it's probably a hover) 3061 if (storeIndex < 0) { 3062 return; 3063 } 3064 3065 // update the event in the store 3066 store[storeIndex] = ev; 3067 3068 this.callback(this.manager, eventType, { 3069 pointers: store, 3070 changedPointers: [ev], 3071 pointerType: pointerType, 3072 srcEvent: ev 3073 }); 3074 3075 if (removePointer) { 3076 // remove from the store 3077 store.splice(storeIndex, 1); 3078 } 3079 } 3080}); 3081 3082var SINGLE_TOUCH_INPUT_MAP = { 3083 touchstart: INPUT_START, 3084 touchmove: INPUT_MOVE, 3085 touchend: INPUT_END, 3086 touchcancel: INPUT_CANCEL 3087}; 3088 3089var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; 3090var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; 3091 3092/** 3093 * Touch events input 3094 * @constructor 3095 * @extends Input 3096 */ 3097function SingleTouchInput() { 3098 this.evTarget = SINGLE_TOUCH_TARGET_EVENTS; 3099 this.evWin = SINGLE_TOUCH_WINDOW_EVENTS; 3100 this.started = false; 3101 3102 Input.apply(this, arguments); 3103} 3104 3105inherit(SingleTouchInput, Input, { 3106 handler: function TEhandler(ev) { 3107 var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; 3108 3109 // should we handle the touch events? 3110 if (type === INPUT_START) { 3111 this.started = true; 3112 } 3113 3114 if (!this.started) { 3115 return; 3116 } 3117 3118 var touches = normalizeSingleTouches.call(this, ev, type); 3119 3120 // when done, reset the started state 3121 if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { 3122 this.started = false; 3123 } 3124 3125 this.callback(this.manager, type, { 3126 pointers: touches[0], 3127 changedPointers: touches[1], 3128 pointerType: INPUT_TYPE_TOUCH, 3129 srcEvent: ev 3130 }); 3131 } 3132}); 3133 3134/** 3135 * @this {TouchInput} 3136 * @param {Object} ev 3137 * @param {Number} type flag 3138 * @returns {undefined|Array} [all, changed] 3139 */ 3140function normalizeSingleTouches(ev, type) { 3141 var all = toArray(ev.touches); 3142 var changed = toArray(ev.changedTouches); 3143 3144 if (type & (INPUT_END | INPUT_CANCEL)) { 3145 all = uniqueArray(all.concat(changed), 'identifier', true); 3146 } 3147 3148 return [all, changed]; 3149} 3150 3151var TOUCH_INPUT_MAP = { 3152 touchstart: INPUT_START, 3153 touchmove: INPUT_MOVE, 3154 touchend: INPUT_END, 3155 touchcancel: INPUT_CANCEL 3156}; 3157 3158var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; 3159 3160/** 3161 * Multi-user touch events input 3162 * @constructor 3163 * @extends Input 3164 */ 3165function TouchInput() { 3166 this.evTarget = TOUCH_TARGET_EVENTS; 3167 this.targetIds = {}; 3168 3169 Input.apply(this, arguments); 3170} 3171 3172inherit(TouchInput, Input, { 3173 handler: function MTEhandler(ev) { 3174 var type = TOUCH_INPUT_MAP[ev.type]; 3175 var touches = getTouches.call(this, ev, type); 3176 if (!touches) { 3177 return; 3178 } 3179 3180 this.callback(this.manager, type, { 3181 pointers: touches[0], 3182 changedPointers: touches[1], 3183 pointerType: INPUT_TYPE_TOUCH, 3184 srcEvent: ev 3185 }); 3186 } 3187}); 3188 3189/** 3190 * @this {TouchInput} 3191 * @param {Object} ev 3192 * @param {Number} type flag 3193 * @returns {undefined|Array} [all, changed] 3194 */ 3195function getTouches(ev, type) { 3196 var allTouches = toArray(ev.touches); 3197 var targetIds = this.targetIds; 3198 3199 // when there is only one touch, the process can be simplified 3200 if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { 3201 targetIds[allTouches[0].identifier] = true; 3202 return [allTouches, allTouches]; 3203 } 3204 3205 var i, 3206 targetTouches, 3207 changedTouches = toArray(ev.changedTouches), 3208 changedTargetTouches = [], 3209 target = this.target; 3210 3211 // get target touches from touches 3212 targetTouches = allTouches.filter(function(touch) { 3213 return hasParent(touch.target, target); 3214 }); 3215 3216 // collect touches 3217 if (type === INPUT_START) { 3218 i = 0; 3219 while (i < targetTouches.length) { 3220 targetIds[targetTouches[i].identifier] = true; 3221 i++; 3222 } 3223 } 3224 3225 // filter changed touches to only contain touches that exist in the collected target ids 3226 i = 0; 3227 while (i < changedTouches.length) { 3228 if (targetIds[changedTouches[i].identifier]) { 3229 changedTargetTouches.push(changedTouches[i]); 3230 } 3231 3232 // cleanup removed touches 3233 if (type & (INPUT_END | INPUT_CANCEL)) { 3234 delete targetIds[changedTouches[i].identifier]; 3235 } 3236 i++; 3237 } 3238 3239 if (!changedTargetTouches.length) { 3240 return; 3241 } 3242 3243 return [ 3244 // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' 3245 uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), 3246 changedTargetTouches 3247 ]; 3248} 3249 3250/** 3251 * Combined touch and mouse input 3252 * 3253 * Touch has a higher priority then mouse, and while touching no mouse events are allowed. 3254 * This because touch devices also emit mouse events while doing a touch. 3255 * 3256 * @constructor 3257 * @extends Input 3258 */ 3259 3260var DEDUP_TIMEOUT = 2500; 3261var DEDUP_DISTANCE = 25; 3262 3263function TouchMouseInput() { 3264 Input.apply(this, arguments); 3265 3266 var handler = bindFn(this.handler, this); 3267 this.touch = new TouchInput(this.manager, handler); 3268 this.mouse = new MouseInput(this.manager, handler); 3269 3270 this.primaryTouch = null; 3271 this.lastTouches = []; 3272} 3273 3274inherit(TouchMouseInput, Input, { 3275 /** 3276 * handle mouse and touch events 3277 * @param {Hammer} manager 3278 * @param {String} inputEvent 3279 * @param {Object} inputData 3280 */ 3281 handler: function TMEhandler(manager, inputEvent, inputData) { 3282 var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), 3283 isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); 3284 3285 if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { 3286 return; 3287 } 3288 3289 // when we're in a touch event, record touches to de-dupe synthetic mouse event 3290 if (isTouch) { 3291 recordTouches.call(this, inputEvent, inputData); 3292 } else if (isMouse && isSyntheticEvent.call(this, inputData)) { 3293 return; 3294 } 3295 3296 this.callback(manager, inputEvent, inputData); 3297 }, 3298 3299 /** 3300 * remove the event listeners 3301 */ 3302 destroy: function destroy() { 3303 this.touch.destroy(); 3304 this.mouse.destroy(); 3305 } 3306}); 3307 3308function recordTouches(eventType, eventData) { 3309 if (eventType & INPUT_START) { 3310 this.primaryTouch = eventData.changedPointers[0].identifier; 3311 setLastTouch.call(this, eventData); 3312 } else if (eventType & (INPUT_END | INPUT_CANCEL)) { 3313 setLastTouch.call(this, eventData); 3314 } 3315} 3316 3317function setLastTouch(eventData) { 3318 var touch = eventData.changedPointers[0]; 3319 3320 if (touch.identifier === this.primaryTouch) { 3321 var lastTouch = {x: touch.clientX, y: touch.clientY}; 3322 this.lastTouches.push(lastTouch); 3323 var lts = this.lastTouches; 3324 var removeLastTouch = function() { 3325 var i = lts.indexOf(lastTouch); 3326 if (i > -1) { 3327 lts.splice(i, 1); 3328 } 3329 }; 3330 setTimeout(removeLastTouch, DEDUP_TIMEOUT); 3331 } 3332} 3333 3334function isSyntheticEvent(eventData) { 3335 var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY; 3336 for (var i = 0; i < this.lastTouches.length; i++) { 3337 var t = this.lastTouches[i]; 3338 var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y); 3339 if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { 3340 return true; 3341 } 3342 } 3343 return false; 3344} 3345 3346var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); 3347var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; 3348 3349// magical touchAction value 3350var TOUCH_ACTION_COMPUTE = 'compute'; 3351var TOUCH_ACTION_AUTO = 'auto'; 3352var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented 3353var TOUCH_ACTION_NONE = 'none'; 3354var TOUCH_ACTION_PAN_X = 'pan-x'; 3355var TOUCH_ACTION_PAN_Y = 'pan-y'; 3356var TOUCH_ACTION_MAP = getTouchActionProps(); 3357 3358/** 3359 * Touch Action 3360 * sets the touchAction property or uses the js alternative 3361 * @param {Manager} manager 3362 * @param {String} value 3363 * @constructor 3364 */ 3365function TouchAction(manager, value) { 3366 this.manager = manager; 3367 this.set(value); 3368} 3369 3370TouchAction.prototype = { 3371 /** 3372 * set the touchAction value on the element or enable the polyfill 3373 * @param {String} value 3374 */ 3375 set: function(value) { 3376 // find out the touch-action by the event handlers 3377 if (value == TOUCH_ACTION_COMPUTE) { 3378 value = this.compute(); 3379 } 3380 3381 if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { 3382 this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; 3383 } 3384 this.actions = value.toLowerCase().trim(); 3385 }, 3386 3387 /** 3388 * just re-set the touchAction value 3389 */ 3390 update: function() { 3391 this.set(this.manager.options.touchAction); 3392 }, 3393 3394 /** 3395 * compute the value for the touchAction property based on the recognizer's settings 3396 * @returns {String} value 3397 */ 3398 compute: function() { 3399 var actions = []; 3400 each(this.manager.recognizers, function(recognizer) { 3401 if (boolOrFn(recognizer.options.enable, [recognizer])) { 3402 actions = actions.concat(recognizer.getTouchAction()); 3403 } 3404 }); 3405 return cleanTouchActions(actions.join(' ')); 3406 }, 3407 3408 /** 3409 * this method is called on each input cycle and provides the preventing of the browser behavior 3410 * @param {Object} input 3411 */ 3412 preventDefaults: function(input) { 3413 var srcEvent = input.srcEvent; 3414 var direction = input.offsetDirection; 3415 3416 // if the touch action did prevented once this session 3417 if (this.manager.session.prevented) { 3418 srcEvent.preventDefault(); 3419 return; 3420 } 3421 3422 var actions = this.actions; 3423 var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; 3424 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; 3425 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; 3426 3427 if (hasNone) { 3428 //do not prevent defaults if this is a tap gesture 3429 3430 var isTapPointer = input.pointers.length === 1; 3431 var isTapMovement = input.distance < 2; 3432 var isTapTouchTime = input.deltaTime < 250; 3433 3434 if (isTapPointer && isTapMovement && isTapTouchTime) { 3435 return; 3436 } 3437 } 3438 3439 if (hasPanX && hasPanY) { 3440 // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent 3441 return; 3442 } 3443 3444 if (hasNone || 3445 (hasPanY && direction & DIRECTION_HORIZONTAL) || 3446 (hasPanX && direction & DIRECTION_VERTICAL)) { 3447 return this.preventSrc(srcEvent); 3448 } 3449 }, 3450 3451 /** 3452 * call preventDefault to prevent the browser's default behavior (scrolling in most cases) 3453 * @param {Object} srcEvent 3454 */ 3455 preventSrc: function(srcEvent) { 3456 this.manager.session.prevented = true; 3457 srcEvent.preventDefault(); 3458 } 3459}; 3460 3461/** 3462 * when the touchActions are collected they are not a valid value, so we need to clean things up. * 3463 * @param {String} actions 3464 * @returns {*} 3465 */ 3466function cleanTouchActions(actions) { 3467 // none 3468 if (inStr(actions, TOUCH_ACTION_NONE)) { 3469 return TOUCH_ACTION_NONE; 3470 } 3471 3472 var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); 3473 var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); 3474 3475 // if both pan-x and pan-y are set (different recognizers 3476 // for different directions, e.g. horizontal pan but vertical swipe?) 3477 // we need none (as otherwise with pan-x pan-y combined none of these 3478 // recognizers will work, since the browser would handle all panning 3479 if (hasPanX && hasPanY) { 3480 return TOUCH_ACTION_NONE; 3481 } 3482 3483 // pan-x OR pan-y 3484 if (hasPanX || hasPanY) { 3485 return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; 3486 } 3487 3488 // manipulation 3489 if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { 3490 return TOUCH_ACTION_MANIPULATION; 3491 } 3492 3493 return TOUCH_ACTION_AUTO; 3494} 3495 3496function getTouchActionProps() { 3497 if (!NATIVE_TOUCH_ACTION) { 3498 return false; 3499 } 3500 var touchMap = {}; 3501 var cssSupports = window.CSS && window.CSS.supports; 3502 ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) { 3503 3504 // If css.supports is not supported but there is native touch-action assume it supports 3505 // all values. This is the case for IE 10 and 11. 3506 touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true; 3507 }); 3508 return touchMap; 3509} 3510 3511/** 3512 * Recognizer flow explained; * 3513 * All recognizers have the initial state of POSSIBLE when a input session starts. 3514 * The definition of a input session is from the first input until the last input, with all it's movement in it. * 3515 * Example session for mouse-input: mousedown -> mousemove -> mouseup 3516 * 3517 * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed 3518 * which determines with state it should be. 3519 * 3520 * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to 3521 * POSSIBLE to give it another change on the next cycle. 3522 * 3523 * Possible 3524 * | 3525 * +-----+---------------+ 3526 * | | 3527 * +-----+-----+ | 3528 * | | | 3529 * Failed Cancelled | 3530 * +-------+------+ 3531 * | | 3532 * Recognized Began 3533 * | 3534 * Changed 3535 * | 3536 * Ended/Recognized 3537 */ 3538var STATE_POSSIBLE = 1; 3539var STATE_BEGAN = 2; 3540var STATE_CHANGED = 4; 3541var STATE_ENDED = 8; 3542var STATE_RECOGNIZED = STATE_ENDED; 3543var STATE_CANCELLED = 16; 3544var STATE_FAILED = 32; 3545 3546/** 3547 * Recognizer 3548 * Every recognizer needs to extend from this class. 3549 * @constructor 3550 * @param {Object} options 3551 */ 3552function Recognizer(options) { 3553 this.options = assign({}, this.defaults, options || {}); 3554 3555 this.id = uniqueId(); 3556 3557 this.manager = null; 3558 3559 // default is enable true 3560 this.options.enable = ifUndefined(this.options.enable, true); 3561 3562 this.state = STATE_POSSIBLE; 3563 3564 this.simultaneous = {}; 3565 this.requireFail = []; 3566} 3567 3568Recognizer.prototype = { 3569 /** 3570 * @virtual 3571 * @type {Object} 3572 */ 3573 defaults: {}, 3574 3575 /** 3576 * set options 3577 * @param {Object} options 3578 * @return {Recognizer} 3579 */ 3580 set: function(options) { 3581 assign(this.options, options); 3582 3583 // also update the touchAction, in case something changed about the directions/enabled state 3584 this.manager && this.manager.touchAction.update(); 3585 return this; 3586 }, 3587 3588 /** 3589 * recognize simultaneous with an other recognizer. 3590 * @param {Recognizer} otherRecognizer 3591 * @returns {Recognizer} this 3592 */ 3593 recognizeWith: function(otherRecognizer) { 3594 if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { 3595 return this; 3596 } 3597 3598 var simultaneous = this.simultaneous; 3599 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3600 if (!simultaneous[otherRecognizer.id]) { 3601 simultaneous[otherRecognizer.id] = otherRecognizer; 3602 otherRecognizer.recognizeWith(this); 3603 } 3604 return this; 3605 }, 3606 3607 /** 3608 * drop the simultaneous link. it doesnt remove the link on the other recognizer. 3609 * @param {Recognizer} otherRecognizer 3610 * @returns {Recognizer} this 3611 */ 3612 dropRecognizeWith: function(otherRecognizer) { 3613 if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { 3614 return this; 3615 } 3616 3617 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3618 delete this.simultaneous[otherRecognizer.id]; 3619 return this; 3620 }, 3621 3622 /** 3623 * recognizer can only run when an other is failing 3624 * @param {Recognizer} otherRecognizer 3625 * @returns {Recognizer} this 3626 */ 3627 requireFailure: function(otherRecognizer) { 3628 if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { 3629 return this; 3630 } 3631 3632 var requireFail = this.requireFail; 3633 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3634 if (inArray(requireFail, otherRecognizer) === -1) { 3635 requireFail.push(otherRecognizer); 3636 otherRecognizer.requireFailure(this); 3637 } 3638 return this; 3639 }, 3640 3641 /** 3642 * drop the requireFailure link. it does not remove the link on the other recognizer. 3643 * @param {Recognizer} otherRecognizer 3644 * @returns {Recognizer} this 3645 */ 3646 dropRequireFailure: function(otherRecognizer) { 3647 if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { 3648 return this; 3649 } 3650 3651 otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); 3652 var index = inArray(this.requireFail, otherRecognizer); 3653 if (index > -1) { 3654 this.requireFail.splice(index, 1); 3655 } 3656 return this; 3657 }, 3658 3659 /** 3660 * has require failures boolean 3661 * @returns {boolean} 3662 */ 3663 hasRequireFailures: function() { 3664 return this.requireFail.length > 0; 3665 }, 3666 3667 /** 3668 * if the recognizer can recognize simultaneous with an other recognizer 3669 * @param {Recognizer} otherRecognizer 3670 * @returns {Boolean} 3671 */ 3672 canRecognizeWith: function(otherRecognizer) { 3673 return !!this.simultaneous[otherRecognizer.id]; 3674 }, 3675 3676 /** 3677 * You should use `tryEmit` instead of `emit` directly to check 3678 * that all the needed recognizers has failed before emitting. 3679 * @param {Object} input 3680 */ 3681 emit: function(input) { 3682 var self = this; 3683 var state = this.state; 3684 3685 function emit(event) { 3686 self.manager.emit(event, input); 3687 } 3688 3689 // 'panstart' and 'panmove' 3690 if (state < STATE_ENDED) { 3691 emit(self.options.event + stateStr(state)); 3692 } 3693 3694 emit(self.options.event); // simple 'eventName' events 3695 3696 if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...) 3697 emit(input.additionalEvent); 3698 } 3699 3700 // panend and pancancel 3701 if (state >= STATE_ENDED) { 3702 emit(self.options.event + stateStr(state)); 3703 } 3704 }, 3705 3706 /** 3707 * Check that all the require failure recognizers has failed, 3708 * if true, it emits a gesture event, 3709 * otherwise, setup the state to FAILED. 3710 * @param {Object} input 3711 */ 3712 tryEmit: function(input) { 3713 if (this.canEmit()) { 3714 return this.emit(input); 3715 } 3716 // it's failing anyway 3717 this.state = STATE_FAILED; 3718 }, 3719 3720 /** 3721 * can we emit? 3722 * @returns {boolean} 3723 */ 3724 canEmit: function() { 3725 var i = 0; 3726 while (i < this.requireFail.length) { 3727 if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { 3728 return false; 3729 } 3730 i++; 3731 } 3732 return true; 3733 }, 3734 3735 /** 3736 * update the recognizer 3737 * @param {Object} inputData 3738 */ 3739 recognize: function(inputData) { 3740 // make a new copy of the inputData 3741 // so we can change the inputData without messing up the other recognizers 3742 var inputDataClone = assign({}, inputData); 3743 3744 // is is enabled and allow recognizing? 3745 if (!boolOrFn(this.options.enable, [this, inputDataClone])) { 3746 this.reset(); 3747 this.state = STATE_FAILED; 3748 return; 3749 } 3750 3751 // reset when we've reached the end 3752 if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { 3753 this.state = STATE_POSSIBLE; 3754 } 3755 3756 this.state = this.process(inputDataClone); 3757 3758 // the recognizer has recognized a gesture 3759 // so trigger an event 3760 if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { 3761 this.tryEmit(inputDataClone); 3762 } 3763 }, 3764 3765 /** 3766 * return the state of the recognizer 3767 * the actual recognizing happens in this method 3768 * @virtual 3769 * @param {Object} inputData 3770 * @returns {Const} STATE 3771 */ 3772 process: function(inputData) { }, // jshint ignore:line 3773 3774 /** 3775 * return the preferred touch-action 3776 * @virtual 3777 * @returns {Array} 3778 */ 3779 getTouchAction: function() { }, 3780 3781 /** 3782 * called when the gesture isn't allowed to recognize 3783 * like when another is being recognized or it is disabled 3784 * @virtual 3785 */ 3786 reset: function() { } 3787}; 3788 3789/** 3790 * get a usable string, used as event postfix 3791 * @param {Const} state 3792 * @returns {String} state 3793 */ 3794function stateStr(state) { 3795 if (state & STATE_CANCELLED) { 3796 return 'cancel'; 3797 } else if (state & STATE_ENDED) { 3798 return 'end'; 3799 } else if (state & STATE_CHANGED) { 3800 return 'move'; 3801 } else if (state & STATE_BEGAN) { 3802 return 'start'; 3803 } 3804 return ''; 3805} 3806 3807/** 3808 * direction cons to string 3809 * @param {Const} direction 3810 * @returns {String} 3811 */ 3812function directionStr(direction) { 3813 if (direction == DIRECTION_DOWN) { 3814 return 'down'; 3815 } else if (direction == DIRECTION_UP) { 3816 return 'up'; 3817 } else if (direction == DIRECTION_LEFT) { 3818 return 'left'; 3819 } else if (direction == DIRECTION_RIGHT) { 3820 return 'right'; 3821 } 3822 return ''; 3823} 3824 3825/** 3826 * get a recognizer by name if it is bound to a manager 3827 * @param {Recognizer|String} otherRecognizer 3828 * @param {Recognizer} recognizer 3829 * @returns {Recognizer} 3830 */ 3831function getRecognizerByNameIfManager(otherRecognizer, recognizer) { 3832 var manager = recognizer.manager; 3833 if (manager) { 3834 return manager.get(otherRecognizer); 3835 } 3836 return otherRecognizer; 3837} 3838 3839/** 3840 * This recognizer is just used as a base for the simple attribute recognizers. 3841 * @constructor 3842 * @extends Recognizer 3843 */ 3844function AttrRecognizer() { 3845 Recognizer.apply(this, arguments); 3846} 3847 3848inherit(AttrRecognizer, Recognizer, { 3849 /** 3850 * @namespace 3851 * @memberof AttrRecognizer 3852 */ 3853 defaults: { 3854 /** 3855 * @type {Number} 3856 * @default 1 3857 */ 3858 pointers: 1 3859 }, 3860 3861 /** 3862 * Used to check if it the recognizer receives valid input, like input.distance > 10. 3863 * @memberof AttrRecognizer 3864 * @param {Object} input 3865 * @returns {Boolean} recognized 3866 */ 3867 attrTest: function(input) { 3868 var optionPointers = this.options.pointers; 3869 return optionPointers === 0 || input.pointers.length === optionPointers; 3870 }, 3871 3872 /** 3873 * Process the input and return the state for the recognizer 3874 * @memberof AttrRecognizer 3875 * @param {Object} input 3876 * @returns {*} State 3877 */ 3878 process: function(input) { 3879 var state = this.state; 3880 var eventType = input.eventType; 3881 3882 var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); 3883 var isValid = this.attrTest(input); 3884 3885 // on cancel input and we've recognized before, return STATE_CANCELLED 3886 if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { 3887 return state | STATE_CANCELLED; 3888 } else if (isRecognized || isValid) { 3889 if (eventType & INPUT_END) { 3890 return state | STATE_ENDED; 3891 } else if (!(state & STATE_BEGAN)) { 3892 return STATE_BEGAN; 3893 } 3894 return state | STATE_CHANGED; 3895 } 3896 return STATE_FAILED; 3897 } 3898}); 3899 3900/** 3901 * Pan 3902 * Recognized when the pointer is down and moved in the allowed direction. 3903 * @constructor 3904 * @extends AttrRecognizer 3905 */ 3906function PanRecognizer() { 3907 AttrRecognizer.apply(this, arguments); 3908 3909 this.pX = null; 3910 this.pY = null; 3911} 3912 3913inherit(PanRecognizer, AttrRecognizer, { 3914 /** 3915 * @namespace 3916 * @memberof PanRecognizer 3917 */ 3918 defaults: { 3919 event: 'pan', 3920 threshold: 10, 3921 pointers: 1, 3922 direction: DIRECTION_ALL 3923 }, 3924 3925 getTouchAction: function() { 3926 var direction = this.options.direction; 3927 var actions = []; 3928 if (direction & DIRECTION_HORIZONTAL) { 3929 actions.push(TOUCH_ACTION_PAN_Y); 3930 } 3931 if (direction & DIRECTION_VERTICAL) { 3932 actions.push(TOUCH_ACTION_PAN_X); 3933 } 3934 return actions; 3935 }, 3936 3937 directionTest: function(input) { 3938 var options = this.options; 3939 var hasMoved = true; 3940 var distance = input.distance; 3941 var direction = input.direction; 3942 var x = input.deltaX; 3943 var y = input.deltaY; 3944 3945 // lock to axis? 3946 if (!(direction & options.direction)) { 3947 if (options.direction & DIRECTION_HORIZONTAL) { 3948 direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; 3949 hasMoved = x != this.pX; 3950 distance = Math.abs(input.deltaX); 3951 } else { 3952 direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN; 3953 hasMoved = y != this.pY; 3954 distance = Math.abs(input.deltaY); 3955 } 3956 } 3957 input.direction = direction; 3958 return hasMoved && distance > options.threshold && direction & options.direction; 3959 }, 3960 3961 attrTest: function(input) { 3962 return AttrRecognizer.prototype.attrTest.call(this, input) && 3963 (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input))); 3964 }, 3965 3966 emit: function(input) { 3967 3968 this.pX = input.deltaX; 3969 this.pY = input.deltaY; 3970 3971 var direction = directionStr(input.direction); 3972 3973 if (direction) { 3974 input.additionalEvent = this.options.event + direction; 3975 } 3976 this._super.emit.call(this, input); 3977 } 3978}); 3979 3980/** 3981 * Pinch 3982 * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). 3983 * @constructor 3984 * @extends AttrRecognizer 3985 */ 3986function PinchRecognizer() { 3987 AttrRecognizer.apply(this, arguments); 3988} 3989 3990inherit(PinchRecognizer, AttrRecognizer, { 3991 /** 3992 * @namespace 3993 * @memberof PinchRecognizer 3994 */ 3995 defaults: { 3996 event: 'pinch', 3997 threshold: 0, 3998 pointers: 2 3999 }, 4000 4001 getTouchAction: function() { 4002 return [TOUCH_ACTION_NONE]; 4003 }, 4004 4005 attrTest: function(input) { 4006 return this._super.attrTest.call(this, input) && 4007 (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); 4008 }, 4009 4010 emit: function(input) { 4011 if (input.scale !== 1) { 4012 var inOut = input.scale < 1 ? 'in' : 'out'; 4013 input.additionalEvent = this.options.event + inOut; 4014 } 4015 this._super.emit.call(this, input); 4016 } 4017}); 4018 4019/** 4020 * Press 4021 * Recognized when the pointer is down for x ms without any movement. 4022 * @constructor 4023 * @extends Recognizer 4024 */ 4025function PressRecognizer() { 4026 Recognizer.apply(this, arguments); 4027 4028 this._timer = null; 4029 this._input = null; 4030} 4031 4032inherit(PressRecognizer, Recognizer, { 4033 /** 4034 * @namespace 4035 * @memberof PressRecognizer 4036 */ 4037 defaults: { 4038 event: 'press', 4039 pointers: 1, 4040 time: 251, // minimal time of the pointer to be pressed 4041 threshold: 9 // a minimal movement is ok, but keep it low 4042 }, 4043 4044 getTouchAction: function() { 4045 return [TOUCH_ACTION_AUTO]; 4046 }, 4047 4048 process: function(input) { 4049 var options = this.options; 4050 var validPointers = input.pointers.length === options.pointers; 4051 var validMovement = input.distance < options.threshold; 4052 var validTime = input.deltaTime > options.time; 4053 4054 this._input = input; 4055 4056 // we only allow little movement 4057 // and we've reached an end event, so a tap is possible 4058 if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) { 4059 this.reset(); 4060 } else if (input.eventType & INPUT_START) { 4061 this.reset(); 4062 this._timer = setTimeoutContext(function() { 4063 this.state = STATE_RECOGNIZED; 4064 this.tryEmit(); 4065 }, options.time, this); 4066 } else if (input.eventType & INPUT_END) { 4067 return STATE_RECOGNIZED; 4068 } 4069 return STATE_FAILED; 4070 }, 4071 4072 reset: function() { 4073 clearTimeout(this._timer); 4074 }, 4075 4076 emit: function(input) { 4077 if (this.state !== STATE_RECOGNIZED) { 4078 return; 4079 } 4080 4081 if (input && (input.eventType & INPUT_END)) { 4082 this.manager.emit(this.options.event + 'up', input); 4083 } else { 4084 this._input.timeStamp = now(); 4085 this.manager.emit(this.options.event, this._input); 4086 } 4087 } 4088}); 4089 4090/** 4091 * Rotate 4092 * Recognized when two or more pointer are moving in a circular motion. 4093 * @constructor 4094 * @extends AttrRecognizer 4095 */ 4096function RotateRecognizer() { 4097 AttrRecognizer.apply(this, arguments); 4098} 4099 4100inherit(RotateRecognizer, AttrRecognizer, { 4101 /** 4102 * @namespace 4103 * @memberof RotateRecognizer 4104 */ 4105 defaults: { 4106 event: 'rotate', 4107 threshold: 0, 4108 pointers: 2 4109 }, 4110 4111 getTouchAction: function() { 4112 return [TOUCH_ACTION_NONE]; 4113 }, 4114 4115 attrTest: function(input) { 4116 return this._super.attrTest.call(this, input) && 4117 (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); 4118 } 4119}); 4120 4121/** 4122 * Swipe 4123 * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. 4124 * @constructor 4125 * @extends AttrRecognizer 4126 */ 4127function SwipeRecognizer() { 4128 AttrRecognizer.apply(this, arguments); 4129} 4130 4131inherit(SwipeRecognizer, AttrRecognizer, { 4132 /** 4133 * @namespace 4134 * @memberof SwipeRecognizer 4135 */ 4136 defaults: { 4137 event: 'swipe', 4138 threshold: 10, 4139 velocity: 0.3, 4140 direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, 4141 pointers: 1 4142 }, 4143 4144 getTouchAction: function() { 4145 return PanRecognizer.prototype.getTouchAction.call(this); 4146 }, 4147 4148 attrTest: function(input) { 4149 var direction = this.options.direction; 4150 var velocity; 4151 4152 if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { 4153 velocity = input.overallVelocity; 4154 } else if (direction & DIRECTION_HORIZONTAL) { 4155 velocity = input.overallVelocityX; 4156 } else if (direction & DIRECTION_VERTICAL) { 4157 velocity = input.overallVelocityY; 4158 } 4159 4160 return this._super.attrTest.call(this, input) && 4161 direction & input.offsetDirection && 4162 input.distance > this.options.threshold && 4163 input.maxPointers == this.options.pointers && 4164 abs(velocity) > this.options.velocity && input.eventType & INPUT_END; 4165 }, 4166 4167 emit: function(input) { 4168 var direction = directionStr(input.offsetDirection); 4169 if (direction) { 4170 this.manager.emit(this.options.event + direction, input); 4171 } 4172 4173 this.manager.emit(this.options.event, input); 4174 } 4175}); 4176 4177/** 4178 * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur 4179 * between the given interval and position. The delay option can be used to recognize multi-taps without firing 4180 * a single tap. 4181 * 4182 * The eventData from the emitted event contains the property `tapCount`, which contains the amount of 4183 * multi-taps being recognized. 4184 * @constructor 4185 * @extends Recognizer 4186 */ 4187function TapRecognizer() { 4188 Recognizer.apply(this, arguments); 4189 4190 // previous time and center, 4191 // used for tap counting 4192 this.pTime = false; 4193 this.pCenter = false; 4194 4195 this._timer = null; 4196 this._input = null; 4197 this.count = 0; 4198} 4199 4200inherit(TapRecognizer, Recognizer, { 4201 /** 4202 * @namespace 4203 * @memberof PinchRecognizer 4204 */ 4205 defaults: { 4206 event: 'tap', 4207 pointers: 1, 4208 taps: 1, 4209 interval: 300, // max time between the multi-tap taps 4210 time: 250, // max time of the pointer to be down (like finger on the screen) 4211 threshold: 9, // a minimal movement is ok, but keep it low 4212 posThreshold: 10 // a multi-tap can be a bit off the initial position 4213 }, 4214 4215 getTouchAction: function() { 4216 return [TOUCH_ACTION_MANIPULATION]; 4217 }, 4218 4219 process: function(input) { 4220 var options = this.options; 4221 4222 var validPointers = input.pointers.length === options.pointers; 4223 var validMovement = input.distance < options.threshold; 4224 var validTouchTime = input.deltaTime < options.time; 4225 4226 this.reset(); 4227 4228 if ((input.eventType & INPUT_START) && (this.count === 0)) { 4229 return this.failTimeout(); 4230 } 4231 4232 // we only allow little movement 4233 // and we've reached an end event, so a tap is possible 4234 if (validMovement && validTouchTime && validPointers) { 4235 if (input.eventType != INPUT_END) { 4236 return this.failTimeout(); 4237 } 4238 4239 var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true; 4240 var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; 4241 4242 this.pTime = input.timeStamp; 4243 this.pCenter = input.center; 4244 4245 if (!validMultiTap || !validInterval) { 4246 this.count = 1; 4247 } else { 4248 this.count += 1; 4249 } 4250 4251 this._input = input; 4252 4253 // if tap count matches we have recognized it, 4254 // else it has began recognizing... 4255 var tapCount = this.count % options.taps; 4256 if (tapCount === 0) { 4257 // no failing requirements, immediately trigger the tap event 4258 // or wait as long as the multitap interval to trigger 4259 if (!this.hasRequireFailures()) { 4260 return STATE_RECOGNIZED; 4261 } else { 4262 this._timer = setTimeoutContext(function() { 4263 this.state = STATE_RECOGNIZED; 4264 this.tryEmit(); 4265 }, options.interval, this); 4266 return STATE_BEGAN; 4267 } 4268 } 4269 } 4270 return STATE_FAILED; 4271 }, 4272 4273 failTimeout: function() { 4274 this._timer = setTimeoutContext(function() { 4275 this.state = STATE_FAILED; 4276 }, this.options.interval, this); 4277 return STATE_FAILED; 4278 }, 4279 4280 reset: function() { 4281 clearTimeout(this._timer); 4282 }, 4283 4284 emit: function() { 4285 if (this.state == STATE_RECOGNIZED) { 4286 this._input.tapCount = this.count; 4287 this.manager.emit(this.options.event, this._input); 4288 } 4289 } 4290}); 4291 4292/** 4293 * Simple way to create a manager with a default set of recognizers. 4294 * @param {HTMLElement} element 4295 * @param {Object} [options] 4296 * @constructor 4297 */ 4298function
vendor: 3,853 bytes, lines 4298-4431
4298Hammer(element, options) { 4299 options = options || {}; 4300 options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); 4301 return new Manager(element, options); 4302} 4303 4304/** 4305 * @const {string} 4306 */ 4307Hammer.VERSION = '2.0.7'; 4308 4309/** 4310 * default settings 4311 * @namespace 4312 */ 4313Hammer.defaults = { 4314 /** 4315 * set if DOM events are being triggered. 4316 * But this is slower and unused by simple implementations, so disabled by default. 4317 * @type {Boolean} 4318 * @default false 4319 */ 4320 domEvents: false, 4321 4322 /** 4323 * The value for the touchAction property/fallback. 4324 * When set to `compute` it will magically set the correct value based on the added recognizers. 4325 * @type {String} 4326 * @default compute 4327 */ 4328 touchAction: TOUCH_ACTION_COMPUTE, 4329 4330 /** 4331 * @type {Boolean} 4332 * @default true 4333 */ 4334 enable: true, 4335 4336 /** 4337 * EXPERIMENTAL FEATURE -- can be removed/changed 4338 * Change the parent input target element. 4339 * If Null, then it is being set the to main element. 4340 * @type {Null|EventTarget} 4341 * @default null 4342 */ 4343 inputTarget: null, 4344 4345 /** 4346 * force an input class 4347 * @type {Null|Function} 4348 * @default null 4349 */ 4350 inputClass: null, 4351 4352 /** 4353 * Default recognizer setup when calling `Hammer()` 4354 * When creating a new Manager these will be skipped. 4355 * @type {Array} 4356 */ 4357 preset: [ 4358 // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...] 4359 [RotateRecognizer, {enable: false}], 4360 [PinchRecognizer, {enable: false}, ['rotate']], 4361 [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}], 4362 [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']], 4363 [TapRecognizer], 4364 [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']], 4365 [PressRecognizer] 4366 ], 4367 4368 /** 4369 * Some CSS properties can be used to improve the working of Hammer. 4370 * Add them to this method and they will be set when creating a new Manager. 4371 * @namespace 4372 */ 4373 cssProps: { 4374 /** 4375 * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. 4376 * @type {String} 4377 * @default 'none' 4378 */ 4379 userSelect: 'none', 4380 4381 /** 4382 * Disable the Windows Phone grippers when pressing an element. 4383 * @type {String} 4384 * @default 'none' 4385 */ 4386 touchSelect: 'none', 4387 4388 /** 4389 * Disables the default callout shown when you touch and hold a touch target. 4390 * On iOS, when you touch and hold a touch target such as a link, Safari displays 4391 * a callout containing information about the link. This property allows you to disable that callout. 4392 * @type {String} 4393 * @default 'none' 4394 */ 4395 touchCallout: 'none', 4396 4397 /** 4398 * Specifies whether zooming is enabled. Used by IE10> 4399 * @type {String} 4400 * @default 'none' 4401 */ 4402 contentZooming: 'none', 4403 4404 /** 4405 * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. 4406 * @type {String} 4407 * @default 'none' 4408 */ 4409 userDrag: 'none', 4410 4411 /** 4412 * Overrides the highlight color shown when the user taps a link or a JavaScript 4413 * clickable element in iOS. This property obeys the alpha value, if specified. 4414 * @type {String} 4415 * @default 'rgba(0,0,0,0)' 4416 */ 4417 tapHighlightColor: 'rgba(0,0,0,0)' 4418 } 4419}; 4420 4421var STOP = 1; 4422var FORCED_STOP = 2; 4423 4424/** 4425 * Manager 4426 * @param {HTMLElement} element 4427 * @param {Object} [options] 4428 * @constructor 4429 */ 4430function Manager(element, options) { 4431 this.options = assign({},
vendor: 9,279 bytes, lines 4431-4734
4431Hammer.defaults, options || {}); 4432 4433 this.options.inputTarget = this.options.inputTarget || element; 4434 4435 this.handlers = {}; 4436 this.session = {}; 4437 this.recognizers = []; 4438 this.oldCssProps = {}; 4439 4440 this.element = element; 4441 this.input = createInputInstance(this); 4442 this.touchAction = new TouchAction(this, this.options.touchAction); 4443 4444 toggleCssProps(this, true); 4445 4446 each(this.options.recognizers, function(item) { 4447 var recognizer = this.add(new (item[0])(item[1])); 4448 item[2] && recognizer.recognizeWith(item[2]); 4449 item[3] && recognizer.requireFailure(item[3]); 4450 }, this); 4451} 4452 4453Manager.prototype = { 4454 /** 4455 * set options 4456 * @param {Object} options 4457 * @returns {Manager} 4458 */ 4459 set: function(options) { 4460 assign(this.options, options); 4461 4462 // Options that need a little more setup 4463 if (options.touchAction) { 4464 this.touchAction.update(); 4465 } 4466 if (options.inputTarget) { 4467 // Clean up existing event listeners and reinitialize 4468 this.input.destroy(); 4469 this.input.target = options.inputTarget; 4470 this.input.init(); 4471 } 4472 return this; 4473 }, 4474 4475 /** 4476 * stop recognizing for this session. 4477 * This session will be discarded, when a new [input]start event is fired. 4478 * When forced, the recognizer cycle is stopped immediately. 4479 * @param {Boolean} [force] 4480 */ 4481 stop: function(force) { 4482 this.session.stopped = force ? FORCED_STOP : STOP; 4483 }, 4484 4485 /** 4486 * run the recognizers! 4487 * called by the inputHandler function on every movement of the pointers (touches) 4488 * it walks through all the recognizers and tries to detect the gesture that is being made 4489 * @param {Object} inputData 4490 */ 4491 recognize: function(inputData) { 4492 var session = this.session; 4493 if (session.stopped) { 4494 return; 4495 } 4496 4497 // run the touch-action polyfill 4498 this.touchAction.preventDefaults(inputData); 4499 4500 var recognizer; 4501 var recognizers = this.recognizers; 4502 4503 // this holds the recognizer that is being recognized. 4504 // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED 4505 // if no recognizer is detecting a thing, it is set to `null` 4506 var curRecognizer = session.curRecognizer; 4507 4508 // reset when the last recognizer is recognized 4509 // or when we're in a new session 4510 if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) { 4511 curRecognizer = session.curRecognizer = null; 4512 } 4513 4514 var i = 0; 4515 while (i < recognizers.length) { 4516 recognizer = recognizers[i]; 4517 4518 // find out if we are allowed try to recognize the input for this one. 4519 // 1. allow if the session is NOT forced stopped (see the .stop() method) 4520 // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one 4521 // that is being recognized. 4522 // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. 4523 // this can be setup with the `recognizeWith()` method on the recognizer. 4524 if (session.stopped !== FORCED_STOP && ( // 1 4525 !curRecognizer || recognizer == curRecognizer || // 2 4526 recognizer.canRecognizeWith(curRecognizer))) { // 3 4527 recognizer.recognize(inputData); 4528 } else { 4529 recognizer.reset(); 4530 } 4531 4532 // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the 4533 // current active recognizer. but only if we don't already have an active recognizer 4534 if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { 4535 curRecognizer = session.curRecognizer = recognizer; 4536 } 4537 i++; 4538 } 4539 }, 4540 4541 /** 4542 * get a recognizer by its event name. 4543 * @param {Recognizer|String} recognizer 4544 * @returns {Recognizer|Null} 4545 */ 4546 get: function(recognizer) { 4547 if (recognizer instanceof Recognizer) { 4548 return recognizer; 4549 } 4550 4551 var recognizers = this.recognizers; 4552 for (var i = 0; i < recognizers.length; i++) { 4553 if (recognizers[i].options.event == recognizer) { 4554 return recognizers[i]; 4555 } 4556 } 4557 return null; 4558 }, 4559 4560 /** 4561 * add a recognizer to the manager 4562 * existing recognizers with the same event name will be removed 4563 * @param {Recognizer} recognizer 4564 * @returns {Recognizer|Manager} 4565 */ 4566 add: function(recognizer) { 4567 if (invokeArrayArg(recognizer, 'add', this)) { 4568 return this; 4569 } 4570 4571 // remove existing 4572 var existing = this.get(recognizer.options.event); 4573 if (existing) { 4574 this.remove(existing); 4575 } 4576 4577 this.recognizers.push(recognizer); 4578 recognizer.manager = this; 4579 4580 this.touchAction.update(); 4581 return recognizer; 4582 }, 4583 4584 /** 4585 * remove a recognizer by name or instance 4586 * @param {Recognizer|String} recognizer 4587 * @returns {Manager} 4588 */ 4589 remove: function(recognizer) { 4590 if (invokeArrayArg(recognizer, 'remove', this)) { 4591 return this; 4592 } 4593 4594 recognizer = this.get(recognizer); 4595 4596 // let's make sure this recognizer exists 4597 if (recognizer) { 4598 var recognizers = this.recognizers; 4599 var index = inArray(recognizers, recognizer); 4600 4601 if (index !== -1) { 4602 recognizers.splice(index, 1); 4603 this.touchAction.update(); 4604 } 4605 } 4606 4607 return this; 4608 }, 4609 4610 /** 4611 * bind event 4612 * @param {String} events 4613 * @param {Function} handler 4614 * @returns {EventEmitter} this 4615 */ 4616 on: function(events, handler) { 4617 if (events === undefined) { 4618 return; 4619 } 4620 if (handler === undefined) { 4621 return; 4622 } 4623 4624 var handlers = this.handlers; 4625 each(splitStr(events), function(event) { 4626 handlers[event] = handlers[event] || []; 4627 handlers[event].push(handler); 4628 }); 4629 return this; 4630 }, 4631 4632 /** 4633 * unbind event, leave emit blank to remove all handlers 4634 * @param {String} events 4635 * @param {Function} [handler] 4636 * @returns {EventEmitter} this 4637 */ 4638 off: function(events, handler) { 4639 if (events === undefined) { 4640 return; 4641 } 4642 4643 var handlers = this.handlers; 4644 each(splitStr(events), function(event) { 4645 if (!handler) { 4646 delete handlers[event]; 4647 } else { 4648 handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); 4649 } 4650 }); 4651 return this; 4652 }, 4653 4654 /** 4655 * emit event to the listeners 4656 * @param {String} event 4657 * @param {Object} data 4658 */ 4659 emit: function(event, data) { 4660 // we also want to trigger dom events 4661 if (this.options.domEvents) { 4662 triggerDomEvent(event, data); 4663 } 4664 4665 // no handlers, so skip it all 4666 var handlers = this.handlers[event] && this.handlers[event].slice(); 4667 if (!handlers || !handlers.length) { 4668 return; 4669 } 4670 4671 data.type = event; 4672 data.preventDefault = function() { 4673 data.srcEvent.preventDefault(); 4674 }; 4675 4676 var i = 0; 4677 while (i < handlers.length) { 4678 handlers[i](data); 4679 i++; 4680 } 4681 }, 4682 4683 /** 4684 * destroy the manager and unbinds all events 4685 * it doesn't unbind dom events, that is the user own responsibility 4686 */ 4687 destroy: function() { 4688 this.element && toggleCssProps(this, false); 4689 4690 this.handlers = {}; 4691 this.session = {}; 4692 this.input.destroy(); 4693 this.element = null; 4694 } 4695}; 4696 4697/** 4698 * add/remove the css properties as defined in manager.options.cssProps 4699 * @param {Manager} manager 4700 * @param {Boolean} add 4701 */ 4702function toggleCssProps(manager, add) { 4703 var element = manager.element; 4704 if (!element.style) { 4705 return; 4706 } 4707 var prop; 4708 each(manager.options.cssProps, function(value, name) { 4709 prop = prefixed(element.style, name); 4710 if (add) { 4711 manager.oldCssProps[prop] = element.style[prop]; 4712 element.style[prop] = value; 4713 } else { 4714 element.style[prop] = manager.oldCssProps[prop] || ''; 4715 } 4716 }); 4717 if (!add) { 4718 manager.oldCssProps = {}; 4719 } 4720} 4721 4722/** 4723 * trigger dom event 4724 * @param {String} event 4725 * @param {Object} data 4726 */ 4727function triggerDomEvent(event, data) { 4728 var gestureEvent = document.createEvent('Event'); 4729 gestureEvent.initEvent(event, true, true); 4730 gestureEvent.gesture = data; 4731 data.target.dispatchEvent(gestureEvent); 4732} 4733 4734assign(
vendor: 16,008 bytes, lines 4734-4831
4734Hammer, { 4735 INPUT_START: INPUT_START, 4736 INPUT_MOVE: INPUT_MOVE, 4737 INPUT_END: INPUT_END, 4738 INPUT_CANCEL: INPUT_CANCEL, 4739 4740 STATE_POSSIBLE: STATE_POSSIBLE, 4741 STATE_BEGAN: STATE_BEGAN, 4742 STATE_CHANGED: STATE_CHANGED, 4743 STATE_ENDED: STATE_ENDED, 4744 STATE_RECOGNIZED: STATE_RECOGNIZED, 4745 STATE_CANCELLED: STATE_CANCELLED, 4746 STATE_FAILED: STATE_FAILED, 4747 4748 DIRECTION_NONE: DIRECTION_NONE, 4749 DIRECTION_LEFT: DIRECTION_LEFT, 4750 DIRECTION_RIGHT: DIRECTION_RIGHT, 4751 DIRECTION_UP: DIRECTION_UP, 4752 DIRECTION_DOWN: DIRECTION_DOWN, 4753 DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL, 4754 DIRECTION_VERTICAL: DIRECTION_VERTICAL, 4755 DIRECTION_ALL: DIRECTION_ALL, 4756 4757 Manager: Manager, 4758 Input: Input, 4759 TouchAction: TouchAction, 4760 4761 TouchInput: TouchInput, 4762 MouseInput: MouseInput, 4763 PointerEventInput: PointerEventInput, 4764 TouchMouseInput: TouchMouseInput, 4765 SingleTouchInput: SingleTouchInput, 4766 4767 Recognizer: Recognizer, 4768 AttrRecognizer: AttrRecognizer, 4769 Tap: TapRecognizer, 4770 Pan: PanRecognizer, 4771 Swipe: SwipeRecognizer, 4772 Pinch: PinchRecognizer, 4773 Rotate: RotateRecognizer, 4774 Press: PressRecognizer, 4775 4776 on: addEventListeners, 4777 off: removeEventListeners, 4778 each: each, 4779 merge: merge, 4780 extend: extend, 4781 assign: assign, 4782 inherit: inherit, 4783 bindFn: bindFn, 4784 prefixed: prefixed 4785}); 4786 4787// this prevents errors when Hammer is loaded in the presence of an AMD 4788// style loader but by script tag, not by the loader. 4789var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line 4790freeGlobal.Hammer = Hammer; 4791 4792if (typeof define === 'function' && define.amd) { 4793 define(function() { 4794 return Hammer; 4795 }); 4796} else if (typeof module != 'undefined' && module.exports) { 4797 module.exports = Hammer; 4798} else { 4799 window[exportName] = Hammer; 4800} 4801 4802})(window, document, 'Hammer'); 4803 4804},{}],118:[function(require,module,exports){ 4805 4806},{}],119:[function(require,module,exports){ 4807 4808},{}],120:[function(require,module,exports){ 4809!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Siema",[],t):"object"==typeof exports?exports.Siema=t():e.Siema=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,r){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),l=function(){function e(t){var i=this;if(r(this,e),this.config=e.mergeSettings(t),this.selector="string"==typeof this.config.selector?document.querySelector(this.config.selector):this.config.selector,null===this.selector)throw new Error("Something wrong with your selector ðŸ˜Â");this.resolveSlidesNumber(),this.selectorWidth=this.selector.offsetWidth,this.innerElements=[].slice.call(this.selector.children),this.currentSlide=this.config.loop?this.config.startIndex%this.innerElements.length:Math.max(0,Math.min(this.config.startIndex,this.innerElements.length-this.perPage)),this.transformProperty=e.webkitOrNot(),["resizeHandler","touchstartHandler","touchendHandler","touchmoveHandler","mousedownHandler","mouseupHandler","mouseleaveHandler","mousemoveHandler","clickHandler"].forEach(function(e){i[e]=i[e].bind(i)}),this.init()}return s(e,[{key:"attachEvents",value:function(){window.addEventListener("resize",this.resizeHandler),this.config.draggable&&(this.pointerDown=!1,this.drag={startX:0,endX:0,startY:0,letItGo:null,preventClick:!1},this.selector.addEventListener("touchstart",this.touchstartHandler),this.selector.addEventListener("touchend",this.touchendHandler),this.selector.addEventListener("touchmove",this.touchmoveHandler),this.selector.addEventListener("mousedown",this.mousedownHandler),this.selector.addEventListener("mouseup",this.mouseupHandler),this.selector.addEventListener("mouseleave",this.mouseleaveHandler),this.selector.addEventListener("mousemove",this.mousemoveHandler),this.selector.addEventListener("click",this.clickHandler))}},{key:"detachEvents",value:function(){window.removeEventListener("resize",this.resizeHandler),this.selector.removeEventListener("touchstart",this.touchstartHandler),this.selector.removeEventListener("touchend",this.touchendHandler),this.selector.removeEventListener("touchmove",this.touchmoveHandler),this.selector.removeEventListener("mousedown",this.mousedownHandler),this.selector.removeEventListener("mouseup",this.mouseupHandler),this.selector.removeEventListener("mouseleave",this.mouseleaveHandler),this.selector.removeEventListener("mousemove",this.mousemoveHandler),this.selector.removeEventListener("click",this.clickHandler)}},{key:"init",value:function(){this.attachEvents(),this.selector.style.overflow="hidden",this.selector.style.direction=this.config.rtl?"rtl":"ltr",this.buildSliderFrame(),this.config.onInit.call(this)}},{key:"buildSliderFrame",value:function(){var e=this.selectorWidth/this.perPage,t=this.config.loop?this.innerElements.length+2*this.perPage:this.innerElements.length;this.sliderFrame=document.createElement("div"),this.sliderFrame.style.width=e*t+"px",this.enableTransition(),this.config.draggable&&(this.selector.style.cursor="-webkit-grab");var i=document.createDocumentFragment();if(this.config.loop)for(var r=this.innerElements.length-this.perPage;r<this.innerElements.length;r++){var n=this.buildSliderFrameItem(this.innerElements[r].cloneNode(!0));i.appendChild(n)}for(var s=0;s<this.innerElements.length;s++){var l=this.buildSliderFrameItem(this.innerElements[s]);i.appendChild(l)}if(this.config.loop)for(var o=0;o<this.perPage;o++){var a=this.buildSliderFrameItem(this.innerElements[o].cloneNode(!0));i.appendChild(a)}this.sliderFrame.appendChild(i),this.selector.innerHTML="",this.selector.appendChild(this.sliderFrame),this.slideToCurrent()}},{key:"buildSliderFrameItem",value:function(e){var t=document.createElement("div");return t.style.cssFloat=this.config.rtl?"right":"left",t.style.float=this.config.rtl?"right":"left",t.style.width=(this.config.loop?100/(this.innerElements.length+2*this.perPage):100/this.innerElements.length)+"%",t.appendChild(e),t}},{key:"resolveSlidesNumber",value:function(){if("number"==typeof this.config.perPage)this.perPage=this.config.perPage;else if("object"===n(this.config.perPage)){this.perPage=1;for(var e in this.config.perPage)window.innerWidth>=e&&(this.perPage=this.config.perPage[e])}}},{key:"prev",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments[1];if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;if(this.config.loop){if(this.currentSlide-e<0){this.disableTransition();var r=this.currentSlide+this.innerElements.length,n=this.perPage,s=r+n,l=(this.config.rtl?1:-1)*s*(this.selectorWidth/this.perPage),o=this.config.draggable?this.drag.endX-this.drag.startX:0;this.sliderFrame.style[this.transformProperty]="translate3d("+(l+o)+"px, 0, 0)",this.currentSlide=r-e}else this.currentSlide=this.currentSlide-e}else this.currentSlide=Math.max(this.currentSlide-e,0);i!==this.currentSlide&&(this.slideToCurrent(this.config.loop),this.config.onChange.call(this),t&&t.call(this))}}},{key:"next",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments[1];if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;if(this.config.loop){if(this.currentSlide+e>this.innerElements.length-this.perPage){this.disableTransition();var r=this.currentSlide-this.innerElements.length,n=this.perPage,s=r+n,l=(this.config.rtl?1:-1)*s*(this.selectorWidth/this.perPage),o=this.config.draggable?this.drag.endX-this.drag.startX:0;this.sliderFrame.style[this.transformProperty]="translate3d("+(l+o)+"px, 0, 0)",this.currentSlide=r+e}else this.currentSlide=this.currentSlide+e}else this.currentSlide=Math.min(this.currentSlide+e,this.innerElements.length-this.perPage);i!==this.currentSlide&&(this.slideToCurrent(this.config.loop),this.config.onChange.call(this),t&&t.call(this))}}},{key:"disableTransition",value:function(){this.sliderFrame.style.webkitTransition="all 0ms "+this.config.easing,this.sliderFrame.style.transition="all 0ms "+this.config.easing}},{key:"enableTransition",value:function(){this.sliderFrame.style.webkitTransition="all "+this.config.duration+"ms "+this.config.easing,this.sliderFrame.style.transition="all "+this.config.duration+"ms "+this.config.easing}},{key:"goTo",value:function(e,t){if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;this.currentSlide=this.config.loop?e%this.innerElements.length:Math.min(Math.max(e,0),this.innerElements.length-this.perPage),i!==this.currentSlide&&(this.slideToCurrent(),this.config.onChange.call(this),t&&t.call(this))}}},{key:"slideToCurrent",value:function(e){var t=this,i=this.config.loop?this.currentSlide+this.perPage:this.currentSlide,r=(this.config.rtl?1:-1)*i*(this.selectorWidth/this.perPage);e?requestAnimationFrame(function(){requestAnimationFrame(function(){t.enableTransition(),t.sliderFrame.style[t.transformProperty]="translate3d("+r+"px, 0, 0)"})}):this.sliderFrame.style[this.transformProperty]="translate3d("+r+"px, 0, 0)"}},{key:"updateAfterDrag",value:function(){var e=(this.config.rtl?-1:1)*(this.drag.endX-this.drag.startX),t=Math.abs(e),i=this.config.multipleDrag?Math.ceil(t/(this.selectorWidth/this.perPage)):1,r=e>0&&this.currentSlide-i<0,n=e<0&&this.currentSlide+i>this.innerElements.length-this.perPage;e>0&&t>this.config.threshold&&this.innerElements.length>this.perPage?this.prev(i):e<0&&t>this.config.threshold&&this.innerElements.length>this.perPage&&this.next(i),this.slideToCurrent(r||n)}},{key:"resizeHandler",value:function(){this.resolveSlidesNumber(),this.currentSlide+this.perPage>this.innerElements.length&&(this.currentSlide=this.innerElements.length<=this.perPage?0:this.innerElements.length-this.perPage),this.selectorWidth=this.selector.offsetWidth,this.buildSliderFrame()}},{key:"clearDrag",value:function(){this.drag={startX:0,endX:0,startY:0,letItGo:null,preventClick:this.drag.preventClick}}},{key:"touchstartHandler",value:function(e){-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.target.nodeName)||(e.stopPropagation(),this.pointerDown=!0,this.drag.startX=e.touches[0].pageX,this.drag.startY=e.touches[0].pageY)}},{key:"touchendHandler",value:function(e){e.stopPropagation(),this.pointerDown=!1,this.enableTransition(),this.drag.endX&&this.updateAfterDrag(),this.clearDrag()}},{key:"touchmoveHandler",value:function(e){if(e.stopPropagation(),null===this.drag.letItGo&&(this.drag.letItGo=Math.abs(this.drag.startY-e.touches[0].pageY)<Math.abs(this.drag.startX-e.touches[0].pageX)),this.pointerDown&&this.drag.letItGo){e.preventDefault(),this.drag.endX=e.touches[0].pageX,this.sliderFrame.style.webkitTransition="all 0ms "+this.config.easing,this.sliderFrame.style.transition="all 0ms "+this.config.easing;var t=this.config.loop?this.currentSlide+this.perPage:this.currentSlide,i=t*(this.selectorWidth/this.perPage),r=this.drag.endX-this.drag.startX,n=this.config.rtl?i+r:i-r;this.sliderFrame.style[this.transformProperty]="translate3d("+(this.config.rtl?1:-1)*n+"px, 0, 0)"}}},{key:"mousedownHandler",value:function(e){-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.target.nodeName)||(e.preventDefault(),e.stopPropagation(),this.pointerDown=!0,this.drag.startX=e.pageX)}},{key:"mouseupHandler",value:function(e){e.stopPropagation(),this.pointerDown=!1,this.selector.style.cursor="-webkit-grab",this.enableTransition(),this.drag.endX&&this.updateAfterDrag(),this.clearDrag()}},{key:"mousemoveHandler",value:function(e){if(e.preventDefault(),this.pointerDown){"A"===e.target.nodeName&&(this.drag.preventClick=!0),this.drag.endX=e.pageX,this.selector.style.cursor="-webkit-grabbing",this.sliderFrame.style.webkitTransition="all 0ms "+this.config.easing,this.sliderFrame.style.transition="all 0ms "+this.config.easing;var t=this.config.loop?this.currentSlide+this.perPage:this.currentSlide,i=t*(this.selectorWidth/this.perPage),r=this.drag.endX-this.drag.startX,n=this.config.rtl?i+r:i-r;this.sliderFrame.style[this.transformProperty]="translate3d("+(this.config.rtl?1:-1)*n+"px, 0, 0)"}}},{key:"mouseleaveHandler",value:function(e){this.pointerDown&&(this.pointerDown=!1,this.selector.style.cursor="-webkit-grab",this.drag.endX=e.pageX,this.drag.preventClick=!1,this.enableTransition(),this.updateAfterDrag(),this.clearDrag())}},{key:"clickHandler",value:function(e){this.drag.preventClick&&e.preventDefault(),this.drag.preventClick=!1}},{key:"remove",value:function(e,t){if(e<0||e>=this.innerElements.length)throw new Error("Item to remove doesn't exist ðŸ˜Â");var i=e<this.currentSlide,r=this.currentSlide+this.perPage-1===e;(i||r)&&this.currentSlide--,this.innerElements.splice(e,1),this.buildSliderFrame(),t&&t.call(this)}},{key:"insert",value:function(e,t,i){if(t<0||t>this.innerElements.length+1)throw new Error("Unable to inset it at this index ðŸ˜Â");if(-1!==this.innerElements.indexOf(e))throw new Error("The same item in a carousel? Really? Nope ðŸ˜Â");var r=t<=this.currentSlide>0&&this.innerElements.length;this.currentSlide=r?this.currentSlide+1:this.currentSlide,this.innerElements.splice(t,0,e),this.buildSliderFrame(),i&&i.call(this)}},{key:"prepend",value:function(e,t){this.insert(e,0),t&&t.call(this)}},{key:"append",value:function(e,t){this.insert(e,this.innerElements.length+1),t&&t.call(this)}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments[1];if(this.detachEvents(),this.selector.style.cursor="auto",e){for(var i=document.createDocumentFragment(),r=0;r<this.innerElements.length;r++)i.appendChild(this.innerElements[r]);this.selector.innerHTML="",this.selector.appendChild(i),this.selector.removeAttribute("style")}t&&t.call(this)}}],[{key:"mergeSettings",value:function(e){var t={selector:".siema",duration:200,easing:"ease-out",perPage:1,startIndex:0,draggable:!0,multipleDrag:!0,threshold:20,loop:!1,rtl:!1,onInit:function(){},onChange:function(){}},i=e;for(var r in i)t[r]=i[r];return t}},{key:"webkitOrNot",value:function(){return"string"==typeof document.documentElement.style.transform?"transform":"WebkitTransform"}}]),e}();t.default=l,e.exports=t.default}])}); 4810},{}],121:[function(require,module,exports){ 4811 4812},{}]},{},[78,37,41,40,42,43,38,39,45,50,51,46,47,48,49,54,53,58,59,60,61,62,63,64,65,66,67,68,70,55,56,57,69,52,71,74,76,77,72,73,79,44,80,4,5,6,7,8,9,10,11,12,13,14,15,3]) 4813 4814//# sourceMappingURL=site.js.map 4815 4816 4817// Related page list JS for block click 4818 4819const CONST_ARTICLE_CARD = ".related-page-card"; 4820const CONST_ARTICLE_LINK = ".related-page-card-link"; 4821const CONST_CLICK = "click"; 4822const CONST_ANCHOR_LINK = "a"; 4823const card = Array.from(document.querySelectorAll(CONST_ARTICLE_CARD)); 4824 4825var clickableElements; 4826 4827card.forEach(addListener); 4828 4829function addListener(cardEle) { 4830 cardEle.addEventListener(CONST_CLICK, (cardEvent) => handleClick(cardEvent)); 4831 clickableElements = Array.from(cardEle.querySelectorAll(CONST_ANCHOR_LINK));
4832 clickableElements.forEach((ele) => 4833 ele.addEventListener(CONST_CLICK, (e) => e.stopPropagation()) 4834 ); 4835} 4836function handleClick(event) { 4837 const mainLink = event.currentTarget.querySelector(CONST_ARTICLE_LINK); 4838 const isTextSelected = window.getSelection().toString(); 4839 if (!isTextSelected) { 4840 mainLink.click(); 4841 } 4842} 4843 4844 4845// Swiper Aria-label 4846var swiperAriaList = document.querySelectorAll(".swiper-slide"); 4847for (let i = 0; i < swiperAriaList.length; i++) { 4848 var ariaText = swiperAriaList[i].getAttribute("aria-label"); 4849 ariaText = ariaText.replace("/", "out of"); 4850 swiperAriaList[i].setAttribute("aria-label", ariaText); 4851}; 4852// JavaScript source code 4853$(function () { 4854 4855 $('.multi-list__container #products-toggle').on('click', function () { 4856 if ($('#product-section').is('.hidden')) { 4857 $('#product-section').removeClass('hidden'); 4858 $('#products-toggle svg').css('transform', 'rotate(90deg)'); 4859 } 4860 else { 4861 $('#product-section').addClass('hidden'); 4862 $('#products-toggle svg').css('transform', 'rotate(-90deg)'); 4863 } 4864 }); 4865 4866 $('.secondary-navigation__pages-btn-wrapper ul li a').on('click', function () { 4867 if ($(this).next('.secondary-navigation__sub-menu').is(".show-sub-menu")) { 4868 $(this).next('.secondary-navigation__sub-menu').removeClass("show-sub-menu"); 4869 $(this).removeClass("arrow--up"); 4870 $(this).parent().parent().removeClass("border-none"); 4871 } else { 4872 $(this).next('.secondary-navigation__sub-menu').addClass("show-sub-menu"); 4873 $(this).addClass("arrow--up"); 4874 $(this).parent().parent().addClass("border-none"); 4875 } 4876 }); 4877 4878 4879 function checkSecondaryNavigationLength(){ 4880 var el = $('.secondary-navigation__title'); 4881 if(el.next('ul').find('li').length < 1){ 4882 el.addClass('single-item'); 4883 } 4884 } 4885 4886 checkSecondaryNavigationLength(); 4887 4888 $('.accordion-trigger').on('click', function () { 4889 if ($(this).is(".active")) { 4890 var c1 = $(this); 4891 c1.next('.accordion-view').attr('aria-hidden', 'true'); 4892 var c2 = c1.children(); 4893 c2.attr('aria-expanded', 'false'); 4894 c1.removeClass("active"); 4895 } 4896 else { 4897 $(this).addClass("active"); 4898 var o1 = $('.accordion-trigger.active'); 4899 var o2 = $('.accordion-trigger.active .accordion-trigger__label'); 4900 o1.next('.accordion-view').attr('aria-hidden', 'false'); 4901 o2.attr('aria-expanded', 'true'); 4902 } 4903 4904 }); 4905 4906 $('#open_search_mob').on('click', function () { 4907 $('.primary-navbar__logo').addClass('hide'); 4908 $('.search_field').removeClass('hide'); 4909 $('.search_field').css("visibility", "visible"); 4910 $('#primary-navbar_search').addClass("active"); 4911 $('#open_search_mob').addClass("hide"); 4912 $('#search_mob').removeClass("hide"); 4913 $('.hamburger-menu').addClass("hide"); 4914 $('.primary-navbar__menu-container.close-menu').removeClass("hide"); 4915 }); 4916 4917 $('#search_dsktop').on('click', function () { 4918 $('form.main-navbar__search').trigger("submit"); 4919 }); 4920 4921 $('#open_search_dsktop').on('click', function () { 4922 $('#open_search_dsktop').addClass("hide"); 4923 $('#search_dsktop').addClass("active"); 4924 $('.close_search').addClass("active"); 4925 $('.main-navbar__search-input').addClass("active"); 4926 $('.mega-menu__list').addClass("hidden"); 4927 $('.main-navbar__logo').addClass('hide-sc-logo'); 4928 dropdownConent(); 4929 }); 4930 4931 $('.close_search-btn').on('click', function () { 4932 $('#search_dsktop').removeClass("active"); 4933 $('.close_search').removeClass("active"); 4934 $('#open_search_dsktop').removeClass("hide"); 4935 $('.main-navbar__search-input').removeClass("active"); 4936 $('.mega-menu__list').removeClass("hidden"); 4937 $('.main-navbar__logo').removeClass('hide-sc-logo'); 4938 });
4939 4940 $('.mobile-navigation__mega-level').on('click', function () { 4941 if ($(this).is('.back')) { 4942 targetId = $(this).attr('data-menu-target'); 4943 $('.mobile-navigation__level-2[data-menu-id="' + targetId + '"]').removeClass('slider show-level'); 4944 $(this).children().removeClass('minus--icon').addClass('plus--icon'); 4945 $(this).removeClass('back'); 4946 } 4947 else { 4948 $(this).addClass('back'); 4949 $('.mobile-navigation__mega-level.back span').removeClass('plus--icon').addClass('minus--icon'); 4950 targetId = $(this).attr('data-menu-target'); 4951 $('.mobile-navigation__level-2[data-menu-id="' + targetId + '"]').addClass('slider show-level'); 4952 } 4953 }); 4954 4955 $('.hamburger-menu').on('click', function () { 4956 setMobileNavigation(); 4957 setMobileL2Navigation(); 4958 $('.hamburger-menu').addClass("hide"); 4959 $('.primary-navbar__menu-container.close-menu').removeClass("hide"); 4960 $('.breadcrumbs__wrapper').addClass("hide"); 4961 $('.header-content').addClass("hide"); 4962 $('main.main').addClass("hide"); 4963 // setTimeout(function () { 4964 // $('main.main').addClass("hide"); 4965 // }, 500); 4966 }); 4967 4968 $('.primary-navbar__menu-container.close-menu').on('click', function () { 4969 if ($('.primary-navbar__logo').is(".hide") && $('.mobile-navigation__level-2').is(".show-level") 4970 || $('.primary-navbar__logo').is(".hide") && $('.mobile-navigation__level-1').is(".slider")) { 4971 $('.primary-navbar__logo').removeClass('hide'); 4972 $('.search_field').css("visibility", "hidden"); 4973 // $('.search_field').addClass("hide"); 4974 $('#primary-navbar_search').removeClass("active"); 4975 $('#search_mob').addClass("hide"); 4976 $('#open_search_mob').removeClass("hide"); 4977 $('main.main').removeClass("hide"); 4978 $('.header-content').removeClass("hide"); 4979 $('.breadcrumbs__wrapper').removeClass("hide"); 4980 } 4981 else if ($('.primary-navbar__logo').is(".hide")) { 4982 $('.primary-navbar__logo').removeClass('hide'); 4983 $('.search_field').css("visibility", "hidden"); 4984 // $('.search_field').addClass("hide"); 4985 $('#primary-navbar_search').removeClass("active"); 4986 $('#search_mob').addClass("hide"); 4987 $('#open_search_mob').removeClass("hide"); 4988 $('.primary-navbar__menu-container.close-menu').addClass("hide"); 4989 $('.hamburger-menu').removeClass("hide"); 4990 } 4991 else { 4992 if ($('.mobile-navigation__level-2').is(".show-level")) { 4993 $('.mobile-navigation__level-2.show-level').removeClass('show-level slider'); 4994 } 4995 $('.mobile-navigation__level-1').removeClass("slider show-level"); 4996 $('.mobile-navigation__level-1 > ul').removeClass("slide-out-content"); 4997 $('.primary-navbar__menu-container.close-menu').addClass("hide"); 4998 $('.hamburger-menu').removeClass("hide"); 4999 $('main.main').removeClass("hide"); 5000 $('.header-content').removeClass("hide"); 5001 $('.breadcrumbs__wrapper').removeClass("hide"); 5002 } 5003 }); 5004 5005 $('.mobile-navigation__level-2 ul li a').on('click', function () { 5006 if ($(this).next('.mobile-navigation__sub-menu').is(".show-sub-menu")) { 5007 $(this).next('.mobile-navigation__sub-menu').removeClass("show-sub-menu"); 5008 $(this).removeClass("arrow--up"); 5009 $(this).parent().parent().removeClass("border-none"); 5010 } else { 5011 $(this).next('.mobile-navigation__sub-menu').addClass("show-sub-menu"); 5012 $(this).addClass("arrow--up"); 5013 $(this).parent().parent().addClass("border-none"); 5014 } 5015 }); 5016 5017 5018 //$('.close_search').on('click', function () { 5019 // $('#search_dsktop').removeClass("active"); 5020 // $('.close_search').removeClass("active"); 5021 // $('#open_search_dsktop').removeClass("hide"); 5022 // $('.main-navbar__search-input').removeClass("active"); 5023 // $('.mega-menu__list').removeClass("hidden"); 5024 //}); 5025 5026 $('.mega-menu__item').find('a').on('mouseover', function () { 5027 dropdownConent(); 5028 var targetId = $(this).parent().attr('data-menu-target'); 5029 if (targetId > 0) { 5030 $(this).parent().addClass("active"); 5031 $('.dropdown-content[data-menu-id="' + targetId + '"]').addClass('active'); 5032 } 5033 });
5034 5035 $('.navbar__container').on('mouseleave', function () { 5036 dropdownConent(); 5037 }); 5038 5039 function dropdownConent() { 5040 if ($(".dropdown-content.active").length === 1) { 5041 $(".dropdown-content.active").removeClass("active"); 5042 $(".mega-menu__item.active").removeClass("active"); 5043 } 5044 }; 5045 5046 function setMobileNavigation() { 5047 var breadcrumbItems = $(".breadcrumbs__wrapper:eq(0) .breadcrumbs__item"); 5048 if (breadcrumbItems.length > 0) { 5049 var getProduct = breadcrumbItems.eq(1).find('a').text(); 5050 // var productActive = getProduct === 'Search' ? getProduct : getProduct.split(" ")[0].toLowerCase() + "-" + getProduct.split(" ")[1].toLowerCase(); 5051 5052 var productActive; 5053 if(getProduct.split(" ").length > 1) 5054 { productActive = 5055 getProduct.split(" ")[0].toLowerCase() + 5056 "-" + 5057 getProduct.split(" ")[1].toLowerCase(); 5058 } else 5059 { productActive = 5060 getProduct.split(" ")[0].toLowerCase(); 5061 } 5062 5063 var page = window.location.origin + "/"; 5064 var productURL = page + productActive; 5065 var product = $('.mobile-navigation__level-1 a[href^="' + productURL + '"]'); 5066 if (product.length > 1) { 5067 if ($('.mobile-navigation__mega-level').is('.back')) { 5068 $('.mobile-navigation__mega-level.back span').removeClass('minus--icon').addClass('plus--icon'); 5069 } 5070 var productActive = product.eq(0); 5071 var activeItem = productActive.parent().find('a').eq(1); 5072 activeItem.addClass('back'); 5073 $('.mobile-navigation__mega-level.back span').removeClass('plus--icon').addClass('minus--icon'); 5074 var productTarget = activeItem.data().menuTarget; 5075 var openProduct = $('.mobile-navigation__level-2[data-menu-id="' + productTarget + '"]'); 5076 $('.mobile-navigation__level-1').addClass("slider").removeClass("hide-level"); 5077 openProduct.addClass("slider show-level"); 5078 } 5079 else if (product.length === 1) { 5080 if ($('.mobile-navigation__mega-level').is('.back')) { 5081 $('.mobile-navigation__mega-level.back span').removeClass('minus--icon').addClass('plus--icon'); 5082 } 5083 $('.mobile-navigation__level-1').addClass("slider").removeClass("hide-level"); 5084 var productActive = product.parent().find('a').eq(1); 5085 productActive.addClass('back'); 5086 $('.mobile-navigation__mega-level.back span').removeClass('plus--icon').addClass('minus--icon'); 5087 var productTarget = productActive.data().menuTarget; 5088 var openProduct = $('.mobile-navigation__level-2[data-menu-id="' + productTarget + '"]'); 5089 openProduct.addClass("slider show-level"); 5090 } 5091 else { 5092 if ($('.mobile-navigation__mega-level').is('.back')) { 5093 $('.mobile-navigation__mega-level.back span').removeClass('minus--icon').addClass('plus--icon'); 5094 } 5095 $('.mobile-navigation__level-1') 5096 .addClass("slider") 5097 .removeClass("hide-level") 5098 } 5099 } 5100 else { 5101 if ($('.mobile-navigation__mega-level').is('.back')) { 5102 $('.mobile-navigation__mega-level.back span').removeClass('minus--icon').addClass('plus--icon'); 5103 } 5104 $('.mobile-navigation__level-1').addClass("slider").removeClass("hide-level"); 5105 } 5106 }; 5107 5108 setLeftNavigation(); 5109 5110 function setLeftNavigation() { 5111 if (!$('.secondary-navigation__pages-btn-wrapper a.page-active').parent().parent().is('.show-sub-menu')) { 5112 $('.secondary-navigation__pages-btn-wrapper a.page-active').parent().parent().addClass('show-sub-menu'); 5113 var pList = $('.secondary-navigation__sub-menu.show-sub-menu').parent().find('span.accordion-arrow').eq(0); 5114 pList.parent().addClass('arrow--up'); 5115 5116 if (!$('.secondary-navigation__sub-menu.show-sub-menu').parent().parent().is('.show-sub-menu')) { 5117 $('.secondary-navigation__sub-menu.show-sub-menu').parent().parent().addClass('show-sub-menu border-none'); 5118 var pList = $('.secondary-navigation__sub-menu.show-sub-menu').parent().find('span.accordion-arrow'); 5119 pList.parent().addClass('arrow--up'); 5120 } 5121 } 5122 5123 var pList = $('.secondary-navigation__pages-btn-wrapper a.page-active').parent().find('span.accordion-arrow').eq(0); 5124 if (pList.length === 1) { 5125 pList.trigger("click"); 5126 } 5127 }; 5128 5129 function setMobileL2Navigation() { 5130 if (!$('.mobile-navigation__pages-btn.page-active').parent().parent().is('.show-sub-menu')) { 5131 $('.mobile-navigation__pages-btn.page-active').parent().parent().addClass('show-sub-menu'); 5132 var pList = $('.mobile-navigation__sub-menu.show-sub-menu').parent().find('span.accordion-arrow').eq(0); 5133 pList.parent().addClass('arrow--up'); 5134 5135 if (!$('.mobile-navigation__sub-menu.show-sub-menu').parent().parent().is('.show-sub-menu')) { 5136 $('.mobile-navigation__sub-menu.show-sub-menu').parent().parent().addClass('show-sub-menu border-none'); 5137 var pList = $('.mobile-navigation__sub-menu.show-sub-menu').parent().find('span.accordion-arrow'); 5138 pList.parent().addClass('arrow--up'); 5139 } 5140 } 5141 5142 var pList = $('.mobile-navigation__pages-btn.page-active').parent().find('span.accordion-arrow').eq(0); 5143 if (pList.length === 1) { 5144 pList.trigger("click"); 5145 } 5146 }; 5147 5148 $(document).on("scroll", onScroll) 5149 5150 function onScroll(event) { 5151 if(window.innerWidth > 991){ 5152 if ($('.secondary-navigation__container').length >= 1) { 5153 if (document.documentElement.scrollTop > 500) { 5154 $('.secondary-navigation__container').addClass('sticky--nav'); 5155 } else { $('.secondary-navigation__container').removeClass('sticky--nav'); } 5156 } 5157 } else if ($('.secondary-navigation__container').hasClass('sticky--nav')){ 5158 $('.secondary-navigation__container').removeClass('sticky--nav'); 5159 } 5160 }; 5161 5162 tablePaddingCheck(); 5163 5164 function tablePaddingCheck(){ 5165 var tables = $('.table-container'); 5166 var sidebar = $('.secondary-navigation__container')[0]; 5167 if (sidebar){ 5168 tables.each(function(){ 5169 $(this).addClass('no-padding') 5170 }) 5171 } 5172 } 5173 5174 // accessibility 5175 var a11yStatus = false; 5176 5177 $(document).keydown(function(e){
5178 if(event.key === "Tab" && a11yStatus === false) { 5179 $(document.body).attr("data-a11y", ""); 5180 // Set status to active 5181 a11yStatus = true; 5182 } 5183 }) 5184 5185 $(document).click(function(e){ 5186 if(a11yStatus === true) { 5187 $(document.body).removeAttr("data-a11y"); 5188 a11yStatus = false; 5189 } 5190 }); 5191}); 5192 5193//Diagnostic_Tool// 5194 5195 let callbacks = []; 5196 let ready = false; 5197 5198 const DOMReady = function(callback) { 5199 const dom = this; 5200 dom.callback = callback; 5201 if (callback) { 5202 dom.init(); 5203 } 5204 }; 5205 5206 DOMReady.prototype.init = function() { 5207 const dom = this; 5208 if (ready === false) { 5209 callbacks.push(dom.callback); 5210 } 5211 else { 5212 dom.callback(); 5213 } 5214 }; 5215 5216 DOMReady.prototype.isReady = function() { 5217 return ready; 5218 }; 5219 5220 function listener(event) { 5221 ready = true; 5222 callbacks.forEach(function iterate(callback) { 5223 callback(event); 5224 }); 5225 callbacks = []; 5226 event.preventDefault(); 5227 } 5228 document.addEventListener("DOMContentLoaded", listener, true); 5229 5230 const toArray = function(obj) { 5231 5232 if (obj && obj.length !== undefined) { 5233 return Array.prototype.slice.call(obj, 0); 5234 } 5235 return [obj]; 5236 }; 5237 5238 new DOMReady(()=>{ 5239 const elements = toArray(document.querySelectorAll("[data-diagnostic-tool]")); 5240 5241 elements.forEach((element)=>{ 5242 new DiagnosticTool(element); 5243 }); 5244 }); 5245 5246 const DiagnosticTool = function(container) { 5247 const diagnosticTool = this; 5248 5249 // Elements 5250 diagnosticTool.container = container; 5251 5252 diagnosticTool.init(); 5253}; 5254 5255DiagnosticTool.prototype.init = function() { 5256 5257 const diagnosticTool = this; 5258 diagnosticTool.views = toArray(diagnosticTool.container.querySelectorAll('[data-view')); 5259 5260 diagnosticTool.buttonWrappers = toArray(diagnosticTool.container.querySelectorAll('.axa-diagnostic-tool__selector-btn-wrapper')); 5261 5262 diagnosticTool.iconButtons = toArray(diagnosticTool.container.querySelectorAll('.axa-diagnostic-tool__selector-button--icon')); 5263 diagnosticTool.iconArray = diagnosticTool.mapIconButtons(); 5264 5265 diagnosticTool.attachEvents(); 5266}; 5267 5268DiagnosticTool.prototype.attachEvents = function() { 5269 5270 const diagnosticTool = this; 5271 5272 diagnosticTool.buttonWrappers.forEach(function(el){ 5273 el.addEventListener('click', function(e){ 5274 const buttonIconClicked = e.target.tagName === 'IMG' && e.target.parentNode.classList.contains('axa-diagnostic-tool__selector-button'); 5275 e.target.removeAttribute("aria-expand"); 5276 e.target.setAttribute("aria-expand", "true") 5277 if(e.target.classList.contains('axa-diagnostic-tool__selector-button') || buttonIconClicked){ 5278 5279 diagnosticTool.handleButtonClick(this, buttonIconClicked ? e.target.parentNode : e.target) 5280 } 5281 }); 5282 }); 5283 5284 diagnosticTool.iconArray.forEach(function(button){ 5285 5286 button.el.addEventListener('mouseenter', function(){ 5287 diagnosticTool.setImage(button, 'secondaryImage'); 5288 }) 5289 button.el.addEventListener('mouseleave', function(){ 5290 diagnosticTool.setImage(button, 'primaryImage'); 5291 }) 5292 }) 5293}; 5294 5295DiagnosticTool.prototype.handleButtonClick = function(parent, clickedButton) { 5296 5297 const diagnosticTool = this; 5298 5299 const selectedClass = 'axa-diagnostic-tool__selector-button--selected' 5300 5301 let childButtons = toArray(parent.querySelectorAll('.axa-diagnostic-tool__selector-button')); 5302 const previouslySelectedButton = parent.querySelector('.' + selectedClass); 5303 5304 if(previouslySelectedButton !== clickedButton){ 5305 5306 childButtons.forEach(function(btn){ 5307 if(btn.classList.contains(selectedClass)){ 5308 btn.classList.remove(selectedClass); 5309 btn.setAttribute("aria-expand", "false") 5310 } 5311 }); 5312 5313 childButtons.splice(childButtons.indexOf(clickedButton), 1); 5314 var selection = diagnosticTool.getSelectedView(clickedButton, childButtons); 5315 5316 var clickedImageObject = diagnosticTool.getImageObject(clickedButton) 5317 5318 if(clickedImageObject){ 5319 diagnosticTool.setImage(clickedImageObject, 'secondaryImage'); 5320 } 5321 5322 clickedButton.classList.add(selectedClass); 5323 5324 diagnosticTool.showView(selection.selected); 5325 5326 diagnosticTool.hideViews(selection.unselected); 5327 5328 if(previouslySelectedButton) { 5329 var previousImageObject = diagnosticTool.getImageObject(previouslySelectedButton); 5330 5331 if(previousImageObject){ 5332 diagnosticTool.setImage(previousImageObject, 'primaryImage'); 5333 } 5334 } 5335 5336 } 5337} 5338 5339DiagnosticTool.prototype.showView = function(view) { 5340 5341 const diagnosticTool = this; 5342 5343 if(view.classList.contains('hide')){ 5344 view.classList.remove('hide') 5345 } 5346 5347 view.setAttribute('aria-hidden', false); 5348 5349 diagnosticTool.setFocus(view) 5350}; 5351 5352DiagnosticTool.prototype.getSelectedView = function(selectedButton, buttonArray) { 5353 5354 const diagnosticTool = this; 5355 5356 const result = {}; 5357 result.unselected = []; 5358 5359 result.selected = diagnosticTool.views.find(function(view){ 5360 return view.dataset.view === selectedButton.dataset.viewTrigger; 5361 }) 5362 5363 buttonArray.forEach(function(button){ 5364 var matchingView = diagnosticTool.views.find(function(view){ 5365 return view.dataset.view === button.dataset.viewTrigger 5366 }); 5367 if(matchingView){ 5368 result.unselected.push(matchingView); 5369 } 5370 }) 5371 5372 return result; 5373}; 5374 5375DiagnosticTool.prototype.hideViews = function(unselectedViews) { 5376 5377 const diagnosticTool = this; 5378 5379 unselectedViews.forEach(function(view){ 5380 5381 diagnosticTool.hideView(view); 5382 5383 let childrenViews = [].slice.call(view.querySelectorAll('[data-view]')); 5384 if(childrenViews.length > 0){ 5385 5386 childrenViews.forEach(function(childView){ 5387 diagnosticTool.hideView(childView) 5388 }) 5389 } 5390 }) 5391}; 5392 5393DiagnosticTool.prototype.hideView = function(view) { 5394 5395 const diagnosticTool = this; 5396 const selectedClass = 'axa-diagnostic-tool__selector-button--selected'; 5397 5398 const selectedButton = view.querySelector('.axa-diagnostic-tool__selector-button--selected'); 5399 5400 if(selectedButton){ 5401 selectedButton.classList.remove(selectedClass); 5402 } 5403 5404 var imageObject = diagnosticTool.getImageObject(selectedButton); 5405 5406 if(imageObject){ 5407 diagnosticTool.setImage(imageObject, 'primaryImage'); 5408 } 5409 5410 if(!view.classList.contains('hide')){ 5411 view.classList.add('hide') 5412 } 5413 5414 view.setAttribute('aria-hidden', true); 5415 5416 view.removeAttribute('tabindex'); 5417}; 5418 5419DiagnosticTool.prototype.setFocus = function(view) { 5420 5421 // cache instance 5422 const diagnosticTool = this; 5423 view.setAttribute('tabindex', -1); 5424 5425 view.focus(); 5426}; 5427 5428 5429DiagnosticTool.prototype.setImage = function(button, newImage) { 5430 5431 const diagnosticTool = this; 5432 5433 if(!button.el.classList.contains('axa-diagnostic-tool__selector-button--selected')){ 5434 const oldImage = button.el.querySelector('img'); 5435 button.el.replaceChild(button[newImage], oldImage); 5436 } 5437 5438}; 5439 5440DiagnosticTool.prototype.mapIconButtons = function() { 5441 5442 const diagnosticTool = this; 5443
5444 const iconMap = diagnosticTool.iconButtons.map(function(btn){ 5445 const primaryImage = btn.querySelector('img'); 5446 const secondaryImage = primaryImage.cloneNode(); 5447 secondaryImage.setAttribute('src', primaryImage.dataset.secondarySrc) 5448 return { 5449 el: btn, 5450 primaryImage: primaryImage, 5451 secondaryImage: secondaryImage 5452 } 5453 }); 5454 5455 return iconMap; 5456 5457}; 5458 5459DiagnosticTool.prototype.getImageObject = function(button) { 5460 5461 const diagnosticTool = this; 5462 5463 var imageObject = diagnosticTool.iconArray.find(function(item){ 5464 return item.el === button 5465 }); 5466 5467 return imageObject; 5468 5469}; 5470 5471 5472 5473; 5474 5475 5476function createAlertMessage(element) { 5477 const alertMessage = {}; 5478 5479 alertMessage.element = element; 5480 alertMessage.id = alertMessage.element.id || ''; 5481 alertMessage.closeButton = alertMessage.element.querySelector('[data-alert-message-dismiss-btn]'); 5482 5483 alertMessage.getCookieDetails = function() { 5484 alertMessage.cookieDuration = parseInt(alertMessage.element.dataset.alertMessageDurationContainer) || 1 ; 5485 }; 5486 5487 alertMessage.showBanner = function() { 5488 alertMessage.element.classList.remove('alert-message--hidden'); 5489 }; 5490 5491 alertMessage.hideBanner = function() { 5492 alertMessage.element.classList.add('alert-message--hidden'); 5493 setCookie(`${alertMessage.id}Alert-Message`, 'true', alertMessage.cookieDuration); 5494 }; 5495 5496 alertMessage.addEvents = function() { 5497 alertMessage.closeButton.addEventListener('click', function(){ 5498 alertMessage.hideBanner(); 5499 }); 5500 }; 5501 5502 alertMessage.init = function() { 5503 if(!getCookie(`${alertMessage.id}Alert-Message`)) { 5504 alertMessage.element.classList.remove('alert-message--hidden'); 5505 alertMessage.getCookieDetails(); 5506 alertMessage.showBanner(); 5507 alertMessage.addEvents(); 5508 } 5509 5510 }; 5511 5512 alertMessage.init(); 5513 5514 return alertMessage; 5515} 5516 5517function getCookie(cookie) { 5518 const match = document.cookie.match(cookie + '=([^;]*)'); 5519 return match ? match[1] : undefined; 5520} 5521 5522function setCookie(cookieName, value, exdays, cookieDomain) { 5523 cookieDomain = (typeof cookieDomain === "undefined") ? "" : "domain=" + cookieDomain + ";"; 5524 let exdate = new Date(); 5525 exdate.setDate(exdate.getDate() + exdays); 5526 const cookieValue = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString()); 5527 document.cookie = cookieName + "=" + cookieValue + ";" + cookieDomain + "path=/"; 5528} 5529 5530function initAlertMessage() { 5531 const alertMessages = Array.from(document.querySelectorAll("[data-alert-message-container]")); 5532 5533 if(alertMessages.length > 0) { 5534 alertMessages.forEach(function(currentElement) { 5535 createAlertMessage(currentElement); 5536 }); 5537 } 5538} 5539 5540document.addEventListener("DOMContentLoaded", initAlertMessage);; 5541const CONST_TOOLTIP_BUTTON_CLASS = "tooltip-button"; 5542const CONST_TOOLTIP_BOX_CLASS = "tooltip-box"; 5543const CONST_TOOLTIP_BUTTON_ID_PREFIX = "tooltip-button-"; 5544const CONST_TOOLTIP_BOX_ID_PREFIX = "tooltip-box-"; 5545const CONST_TOOLTIP_BUTTON_SHADOW = "tooltip-button-shadow"; 5546const CONST_TOOLTIP_BOX_HIDE_CLASS = "tooltip-box-hide"; 5547const CONST_TOOLTIP_ARIA_EXPANDED = "aria-expanded"; 5548const CONST_TOOLTIP_ARIA_EXPANDED_TRUE = "true"; 5549const CONST_TOOLTIP_ARIA_EXPANDED_FALSE = "false"; 5550const CONST_TOOLTIP_CLOSE_BUTTON_CLASS = "tooltip-box-close-button"; 5551 5552function contactUsTooltipSC(event, tooltipBoxNo, tooltipBtn) { 5553 resetTooltip( 5554 event.target.parentElement, 5555 tooltipBoxNo 5556 ); 5557 var tooltipBox = document.getElementById( 5558 CONST_TOOLTIP_BOX_ID_PREFIX + tooltipBoxNo 5559 ); 5560 var clsBtn = event.target.parentElement.querySelector(`.${CONST_TOOLTIP_CLOSE_BUTTON_CLASS}`); 5561 tooltipBtn.classList.toggle(CONST_TOOLTIP_BUTTON_SHADOW); 5562 if ( 5563 tooltipBtn.getAttribute(CONST_TOOLTIP_ARIA_EXPANDED) == 5564 CONST_TOOLTIP_ARIA_EXPANDED_TRUE 5565 ) { 5566 tooltipBtn.setAttribute( 5567 CONST_TOOLTIP_ARIA_EXPANDED, 5568 CONST_TOOLTIP_ARIA_EXPANDED_FALSE 5569 ); 5570 clsBtn.setAttribute( 5571 CONST_TOOLTIP_ARIA_EXPANDED, 5572 CONST_TOOLTIP_ARIA_EXPANDED_FALSE 5573 ); 5574 } else { 5575 tooltipBtn.setAttribute( 5576 CONST_TOOLTIP_ARIA_EXPANDED, 5577 CONST_TOOLTIP_ARIA_EXPANDED_TRUE 5578 ); 5579 clsBtn.setAttribute( 5580 CONST_TOOLTIP_ARIA_EXPANDED, 5581 CONST_TOOLTIP_ARIA_EXPANDED_TRUE 5582 ); 5583 } 5584 tooltipBox.classList.toggle(CONST_TOOLTIP_BOX_HIDE_CLASS); 5585} 5586function resetTooltip(tooltipContainer, tooltipBoxNo) { 5587 var tooltipButtonGroup = tooltipContainer.getElementsByClassName( 5588 CONST_TOOLTIP_BUTTON_CLASS 5589 ); 5590 var tooltipBoxGroup = tooltipContainer.getElementsByClassName( 5591 CONST_TOOLTIP_BOX_CLASS 5592 ); 5593 5594 for (let i = 0; i < tooltipButtonGroup.length; i++) { 5595 if ( 5596 CONST_TOOLTIP_BUTTON_ID_PREFIX + tooltipBoxNo != 5597 tooltipButtonGroup[i].getAttribute('data-id') 5598 ) { 5599 if ( 5600 tooltipButtonGroup[i].classList.contains(CONST_TOOLTIP_BUTTON_SHADOW) 5601 ) { 5602 tooltipButtonGroup[i].classList.remove(CONST_TOOLTIP_BUTTON_SHADOW); 5603 } 5604 tooltipButtonGroup[i].setAttribute( 5605 CONST_TOOLTIP_ARIA_EXPANDED, 5606 CONST_TOOLTIP_ARIA_EXPANDED_FALSE 5607 ); 5608 } 5609 } 5610 for (let i = 0; i < tooltipBoxGroup.length; i++) { 5611 if ( 5612 CONST_TOOLTIP_BOX_ID_PREFIX + tooltipBoxNo != 5613 tooltipBoxGroup[i].id 5614 ) { 5615 tooltipBoxGroup[i].classList.add(CONST_TOOLTIP_BOX_HIDE_CLASS); 5616 } 5617 } 5618} 5619 5620function close (clsBtnElement, clsBtnId) { 5621 const btnSplitID = clsBtnId.split('-').pop(); 5622 const tooltipContainer = clsBtnElement.parentElement.parentElement.parentElement 5623 var tooltipBoxGroup = tooltipContainer.querySelector(`.${CONST_TOOLTIP_BOX_CLASS}`) 5624 const btnOfTooltip = tooltipContainer.querySelector(`[data-id='${CONST_TOOLTIP_BUTTON_ID_PREFIX + btnSplitID}']`); 5625 btnOfTooltip.setAttribute(CONST_TOOLTIP_ARIA_EXPANDED, CONST_TOOLTIP_ARIA_EXPANDED_FALSE); 5626 clsBtnElement.setAttribute(CONST_TOOLTIP_ARIA_EXPANDED, CONST_TOOLTIP_ARIA_EXPANDED_FALSE); 5627 tooltipBoxGroup.classList.add(CONST_TOOLTIP_BOX_HIDE_CLASS); 5628} 5629 5630const tooltipBtnList = document.getElementsByClassName(CONST_TOOLTIP_BUTTON_CLASS); 5631for (let i = 0; i < tooltipBtnList.length; i++) {
5632 const toolTipBtnId = tooltipBtnList[i].getAttribute('data-id'); 5633 if(toolTipBtnId){ 5634 const btnIndex = toolTipBtnId.split("-").pop(); 5635 tooltipBtnList[i].addEventListener("click", (event)=> contactUsTooltipSC(event, btnIndex, tooltipBtnList[i])); 5636 } 5637} 5638 5639const tooltipCloseBtnList = document.getElementsByClassName(CONST_TOOLTIP_CLOSE_BUTTON_CLASS); 5640for (let i = 0; i < tooltipCloseBtnList.length; i++) { 5641 const closebtnId = tooltipCloseBtnList[i].getAttribute('aria-controls'); 5642 if(closebtnId){ 5643 tooltipCloseBtnList[i].addEventListener("click", (event)=> close(tooltipCloseBtnList[i], closebtnId)); 5644 } 5645}; 5646const CONST_COLLAPSE_BUTTON_CLASS = "collapse-button"; 5647const CONST_COLLAPSE_BOX_CLASS = "collapse-box"; 5648const CONST_COLLAPSE_BUTTON_ID_PREFIX = "collapse-button-"; 5649const CONST_COLLAPSE_BOX_ID_PREFIX = "collapse-box-"; 5650const CONST_COLLAPSE_BUTTON_SHADOW = "collapse-button-shadow"; 5651const CONST_COLLAPSE_BOX_HIDE = "collapse-box-hide"; 5652const CONST_COLLAPSE_ARIA_EXPANDED = "aria-expanded"; 5653const CONST_COLLAPSE_ARIA_EXPANDED_TRUE = "true"; 5654const CONST_COLLAPSE_ARIA_EXPANDED_FALSE = "false"; 5655 5656function contactUsCollapseSC(event, collapseBoxNo, cButton) { 5657 resetCollapseSC( 5658 event.target.parentElement.parentElement.parentElement, 5659 collapseBoxNo 5660 ); 5661 var collapseBox = document.getElementById( 5662 CONST_COLLAPSE_BOX_ID_PREFIX + collapseBoxNo 5663 ); 5664 cButton.classList.toggle(CONST_COLLAPSE_BUTTON_SHADOW); 5665 if ( 5666 cButton.getAttribute(CONST_COLLAPSE_ARIA_EXPANDED) == 5667 CONST_COLLAPSE_ARIA_EXPANDED_TRUE 5668 ) { 5669 cButton.setAttribute( 5670 CONST_COLLAPSE_ARIA_EXPANDED, 5671 CONST_COLLAPSE_ARIA_EXPANDED_FALSE 5672 ); 5673 } else { 5674 cButton.setAttribute( 5675 CONST_COLLAPSE_ARIA_EXPANDED, 5676 CONST_COLLAPSE_ARIA_EXPANDED_TRUE 5677 ); 5678 } 5679 collapseBox.classList.toggle(CONST_COLLAPSE_BOX_HIDE); 5680} 5681function resetCollapseSC(collapseContainer, collapseBoxNo) { 5682 var collapseButtonGroup = collapseContainer.getElementsByClassName( 5683 CONST_COLLAPSE_BUTTON_CLASS 5684 ); 5685 var collapseBoxGroup = collapseContainer.getElementsByClassName( 5686 CONST_COLLAPSE_BOX_CLASS 5687 ); 5688 5689 for (let i = 0; i < collapseButtonGroup.length; i++) { 5690 if ( 5691 CONST_COLLAPSE_BUTTON_ID_PREFIX + collapseBoxNo != 5692 collapseButtonGroup[i].getAttribute('data-id') 5693 ) { 5694 if ( 5695 collapseButtonGroup[i].classList.contains(CONST_COLLAPSE_BUTTON_SHADOW) 5696 ) { 5697 collapseButtonGroup[i].classList.remove(CONST_COLLAPSE_BUTTON_SHADOW); 5698 } 5699 collapseButtonGroup[i].setAttribute( 5700 CONST_COLLAPSE_ARIA_EXPANDED, 5701 CONST_COLLAPSE_ARIA_EXPANDED_FALSE 5702 ); 5703 } 5704 } 5705 for (let i = 0; i < collapseBoxGroup.length; i++) { 5706 if ( 5707 CONST_COLLAPSE_BOX_ID_PREFIX + collapseBoxNo != 5708 collapseBoxGroup[i].id 5709 ) { 5710 collapseBoxGroup[i].classList.add(CONST_COLLAPSE_BOX_HIDE); 5711 } 5712 } 5713} 5714 5715const collapseBtnList = document.getElementsByClassName(CONST_COLLAPSE_BUTTON_CLASS); 5716for (let i = 0; i < collapseBtnList.length; i++) { 5717 const btnId = collapseBtnList[i].getAttribute('data-id'); 5718 const btnIndex = btnId.split("-").pop(); 5719 collapseBtnList[i].addEventListener("click", (event)=> contactUsCollapseSC(event, btnIndex, collapseBtnList[i])); 5720} 5721; 5722 5723 5724function createNotificationBox(element) { 5725 const notificationBox = {}; 5726 5727 notificationBox.element = element; 5728 notificationBox.id = notificationBox.element.id || ''; 5729 notificationBox.closeButton = notificationBox.element.querySelector('[data-notification-box-dismiss-btn]'); 5730 5731 notificationBox.getCookieDetails = function() { 5732 notificationBox.cookieDuration = parseInt(notificationBox.element.dataset.notificationBoxDurationContainer) || 1 ; 5733 }; 5734 5735 notificationBox.showBanner = function() { 5736 notificationBox.element.classList.remove('notification-box-hide'); 5737 }; 5738 5739 notificationBox.hideBanner = function() { 5740 notificationBox.element.classList.add('notification-box-hide'); 5741 setCookie(`${notificationBox.id}NotificationBox`, 'true', notificationBox.cookieDuration); 5742 }; 5743 5744 notificationBox.addEvents = function() { 5745 notificationBox.closeButton.addEventListener('click', function(){ 5746 notificationBox.hideBanner(); 5747 }); 5748 }; 5749 5750 notificationBox.init = function() { 5751 if(!getCookie(`${notificationBox.id}NotificationBox`)) { 5752 notificationBox.element.classList.remove('notification-box-hide'); 5753 notificationBox.getCookieDetails(); 5754 notificationBox.showBanner(); 5755 notificationBox.addEvents(); 5756 } 5757 5758 }; 5759 5760 notificationBox.init(); 5761 5762 return notificationBox; 5763} 5764 5765function getCookie(cookie) { 5766 const match = document.cookie.match(cookie + '=([^;]*)'); 5767 return match ? match[1] : undefined; 5768} 5769 5770function setCookie(cookieName, value, exdays, cookieDomain) { 5771 cookieDomain = (typeof cookieDomain === "undefined") ? "" : "domain=" + cookieDomain + ";"; 5772 let exdate = new Date(); 5773 exdate.setDate(exdate.getDate() + exdays); 5774 const cookieValue = escape(value) + ((exdays == null) ? "" : "; expires=" + exdate.toUTCString()); 5775 document.cookie = cookieName + "=" + cookieValue + ";" + cookieDomain + "path=/"; 5776} 5777 5778function initNotificationBox() { 5779 const notificationBoxs = Array.from(document.querySelectorAll("[data-notification-box-container]")); 5780 5781 if(notificationBoxs.length > 0) { 5782 notificationBoxs.forEach(function(currentElement) { 5783 createNotificationBox(currentElement); 5784 }); 5785 } 5786} 5787 5788document.addEventListener("DOMContentLoaded", initNotificationBox);; 5789 5790//================================================================================================== 5791// Icon Card Blocks 5792//================================================================================================== 5793/** 5794 * Icon Card Blocks - Click Navigation Handler 5795 * Allows clicking anywhere on the card to navigate to the CTA link 5796 * Prevents navigation when user is selecting text 5797 */ 5798 5799function initIconCardBlocksModule() { 5800 const cardItems = document.querySelectorAll('.icon-card-blocks__card-item'); 5801
5802 cardItems.forEach(function (card) { 5803 card.addEventListener('click', function (e) { 5804 var selection; 5805 var ctaAnchor; 5806 5807 // Check if user has selected text 5808 selection = window.getSelection(); 5809 if (selection && selection.toString().length > 0) { 5810 // User has selected text, don't navigate 5811 return; 5812 } 5813 5814 // Don't navigate if clicking directly on the anchor (let it handle itself) 5815 if (e.target.closest('.card-item--cta')) { 5816 return; 5817 } 5818 5819 // Find the CTA anchor within the card 5820 ctaAnchor = card.querySelector('.icon-card-blocks__card-item--cta .card-item--cta'); 5821 if (ctaAnchor && ctaAnchor.href) { 5822 // Navigate to the href 5823 window.location.href = ctaAnchor.href; 5824 } 5825 }); 5826 }); 5827} 5828 5829document.addEventListener("DOMContentLoaded", initIconCardBlocksModule);; 5830(function($) { 5831 5832 function updateStats() { 5833 var id = pageStatisticsId; 5834 if (id) { 5835 $.ajax({
5836 type: 'POST', 5837 url: '/data/stats?id=' + id, 5838 data: '' 5839 }); 5840 } 5841 } 5842 5843 function initSearch() { 5844 $('#search_mob').click(function () { 5845 $('#primary-navbar_search').submit(); 5846 }); 5847 } 5848 5849 $(document).ready(function() { 5850 updateStats(); 5851 initSearch(); 5852 }); 5853 5854})(jQuery);;
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.