1(function (global, factory) { 2 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 3 typeof define === 'function' && define.amd ? define(['exports'], factory) : 4 (global = global || self, factory(global.seamless = {})); 5}(this, function (exports) { 6 'use strict'; 7 8 /*! ***************************************************************************** 9 Copyright (c) Microsoft Corporation. All rights reserved. 10 Licensed under the Apache License, Version 2.0 (the "License"); you may not use 11 this file except in compliance with the License. You may obtain a copy of the 12 License at http://www.apache.org/licenses/LICENSE-2.0 13 14 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED 16 WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, 17 MERCHANTABLITY OR NON-INFRINGEMENT. 18 19 See the Apache Version 2.0 License for specific language governing permissions 20 and limitations under the License. 21 ***************************************************************************** */ 22 23 var __assign = function () { 24 __assign = Object.assign || function __assign(t) { 25 for (var s, i = 1, n = arguments.length; i < n; i++) { 26 s = arguments[i]; 27 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 28 } 29 return t; 30 }; 31 return __assign.apply(this, arguments); 32 }; 33 34 function __values(o) { 35 var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; 36 if (m) return m.call(o); 37 return { 38 next: function () { 39 if (o && i >= o.length) o = void 0; 40 return {value: o && o[i++], done: !o}; 41 } 42 }; 43 } 44 45 function __read(o, n) { 46 var m = typeof Symbol === "function" && o[Symbol.iterator]; 47 if (!m) return o; 48 var i = m.call(o), r, ar = [], e; 49 try { 50 while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); 51 } catch (error) { 52 e = {error: error}; 53 } finally { 54 try { 55 if (r && !r.done && (m = i["return"])) m.call(i); 56 } finally { 57 if (e) throw e.error; 58 } 59 } 60 return ar; 61 } 62 63 var ease = function (k) { 64 return 0.5 * (1 - Math.cos(Math.PI * k)); 65 }; 66 var DURATION = 500; 67 var now = function () { 68 return (performance || Date).now(); 69 }; 70 var step = function (context) { 71 var currentTime = now(); 72 var elapsed = (currentTime - context.timeStamp) / (context.duration || DURATION); 73 if (elapsed > 1) { 74 context.method(context.targetX, context.targetY); 75 context.callback(); 76 return; 77 } 78 var value = (context.timingFunc || ease)(elapsed); 79 var currentX = context.startX + (context.targetX - context.startX) * value; 80 var currentY = context.startY + (context.targetY - context.startY) * value; 81 context.method(currentX, currentY); 82 context.rafId = requestAnimationFrame(function () { 83 step(context); 84 }); 85 }; 86 87 var originalElementScroll = Element.prototype.scroll || 88 Element.prototype.scrollTo || 89 function (x, y) { 90 this.scrollLeft = x; 91 this.scrollTop = y; 92 }; 93 var elementScroll = function (element, options) { 94 var originalFunc = originalElementScroll.bind(element); 95 if (options.left === undefined && options.top === undefined) { 96 return; 97 } 98 var startX = element.scrollLeft; 99 var startY = element.scrollTop; 100 var _a = options.left, targetX = _a === void 0 ? startX : _a, _b = options.top, 101 targetY = _b === void 0 ? startY : _b; 102 if (options.behavior !== "smooth") { 103 return originalElementScroll.call(element, targetX, startY); 104 } 105 var removeEventListener = function () { 106 window.removeEventListener("wheel", cancelScroll); 107 window.removeEventListener("touchmove", cancelScroll); 108 }; 109 var context = { 110 timeStamp: now(), 111 duration: options.duration, 112 startX: startX, 113 startY: startY, 114 targetX: targetX, 115 targetY: targetY, 116 rafId: 0, 117 method: originalFunc, 118 timingFunc: options.timingFunc, 119 callback: removeEventListener, 120 }; 121 var cancelScroll = function () { 122 cancelAnimationFrame(context.rafId); 123 removeEventListener(); 124 }; 125 window.addEventListener("wheel", cancelScroll, { 126 passive: true, 127 once: true, 128 }); 129 window.addEventListener("touchmove", cancelScroll, { 130 passive: true, 131 once: true, 132 }); 133 step(context); 134 }; 135 var polyfill = function (options) { 136 Element.prototype.scroll = function scroll() { 137 var _a = __read(arguments, 2), _b = _a[0], arg0 = _b === void 0 ? 0 : _b, _c = _a[1],
138 arg1 = _c === void 0 ? 0 : _c; 139 if (typeof arg0 === "number" && typeof arg1 === "number") { 140 return originalElementScroll.call(this, arg0, arg1); 141 } 142 if (Object(arg0) !== arg0) { 143 throw new TypeError("Failed to execute 'scroll' on 'Element': parameter 1 ('options') is not an object."); 144 } 145 return elementScroll(this, __assign({}, arg0, options)); 146 }; 147 }; 148 149 var elementScrollBy = function (elememt, options) { 150 var left = (options.left || 0) + elememt.scrollLeft; 151 var top = (options.top || 0) + elememt.scrollTop; 152 return elementScroll(elememt, __assign({}, options, {left: left, top: top})); 153 }; 154 var polyfill$1 = function (options) { 155 Element.prototype.scrollBy = function scrollBy() { 156 var _a = __read(arguments, 2), _b = _a[0], arg0 = _b === void 0 ? 0 : _b, _c = _a[1], 157 arg1 = _c === void 0 ? 0 : _c; 158 if (typeof arg0 === "number" && typeof arg1 === "number") { 159 return elementScrollBy(this, {left: arg0, top: arg1}); 160 } 161 if (Object(arg0) !== arg0) { 162 throw new TypeError("Failed to execute 'scrollBy' on 'Element': parameter 1 ('options') is not an object."); 163 } 164 return elementScrollBy(this, __assign({}, arg0, options)); 165 }; 166 }; 167 168 var originalWindowScroll = function (x, y) { 169 return (window.scroll || window.scrollTo)(x, y); 170 }; 171 var windowScroll = function (options) { 172 if (options.left === undefined && options.top === undefined) { 173 return; 174 } 175 var startX = window.scrollX || window.pageXOffset; 176 var startY = window.scrollY || window.pageYOffset; 177 var _a = options.left, targetX = _a === void 0 ? startX : _a, _b = options.top, 178 targetY = _b === void 0 ? startY : _b; 179 if (options.behavior !== "smooth") { 180 return originalWindowScroll(targetX, targetY); 181 } 182 var removeEventListener = function () { 183 window.removeEventListener("wheel", cancelScroll); 184 window.removeEventListener("touchmove", cancelScroll); 185 }; 186 var context = { 187 timeStamp: now(), 188 duration: options.duration, 189 startX: startX, 190 startY: startY, 191 targetX: targetX, 192 targetY: targetY, 193 rafId: 0, 194 method: originalWindowScroll, 195 timingFunc: options.timingFunc, 196 callback: removeEventListener, 197 }; 198 var cancelScroll = function () { 199 cancelAnimationFrame(context.rafId); 200 removeEventListener(); 201 }; 202 window.addEventListener("wheel", cancelScroll, { 203 passive: true, 204 once: true, 205 }); 206 window.addEventListener("touchmove", cancelScroll, { 207 passive: true, 208 once: true, 209 }); 210 step(context); 211 }; 212 var polyfill$2 = function (options) { 213 var originalFunc = window.scroll || window.scrollTo; 214 window.scroll = function scroll() { 215 var _a = __read(arguments, 2), _b = _a[0], arg0 = _b === void 0 ? 0 : _b, _c = _a[1], 216 arg1 = _c === void 0 ? 0 : _c; 217 if (typeof arg0 === "number" && typeof arg1 === "number") { 218 return originalFunc.call(this, arg0, arg1); 219 } 220 if (Object(arg0) !== arg0) { 221 throw new TypeError("Failed to execute 'scroll' on 'Window': parameter 1 ('options') is not an object."); 222 } 223 return windowScroll(__assign({}, arg0, options)); 224 }; 225 }; 226 227 var originalFunc = document.documentElement.scrollIntoView; 228 // tslint:disable-next-line: max-line-length 229 // https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/dom/element.cc?l=647-681&rcl=02a6466f4efa021e4e198f373eccda3cfc56142b 230 var toPhysicalAlignment = function (options, axis, isHorizontalWritingMode, isFlippedBlocksMode) { 231 var alignment = (axis === 0 /* HorizontalScroll */ && isHorizontalWritingMode) || 232 (axis === 1 /* VerticalScroll */ && !isHorizontalWritingMode) 233 ? options.inline 234 : options.block; 235 if (alignment === "center") { 236 return 1 /* AlignCenterAlways */; 237 } 238 if (alignment === "nearest") { 239 return 0 /* AlignToEdgeIfNeeded */; 240 } 241 if (alignment === "start") { 242 return axis === 0 /* HorizontalScroll */ 243 ? isFlippedBlocksMode 244 ? 5 /* AlignRightAlways */ 245 : 4 /* AlignLeftAlways */ 246 : 2 /* AlignTopAlways */; 247 } 248 if (alignment === "end") { 249 return axis === 0 /* HorizontalScroll */ 250 ? isFlippedBlocksMode 251 ? 4 /* AlignLeftAlways */ 252 : 5 /* AlignRightAlways */ 253 : 3 /* AlignBottomAlways */; 254 } 255 // Default values 256 if (isHorizontalWritingMode) { 257 return axis === 0 /* HorizontalScroll */ 258 ? 0 /* AlignToEdgeIfNeeded */ 259 : 2 /* AlignTopAlways */; 260 } 261 return axis === 0 /* HorizontalScroll */ 262 ? 4 /* AlignLeftAlways */ 263 : 0 /* AlignToEdgeIfNeeded */; 264 }; 265 // code from stipsan/compute-scroll-into-view 266 // https://github.com/stipsan/compute-scroll-into-view/blob/5396c6b78af5d0bbce11a7c4e93cc3146546fcd3/src/index.ts 267 /** 268 * Find out which edge to align against when logical scroll position is "nearest" 269 * Interesting fact: "nearest" works similarily to "if-needed", if the element is fully visible it will not scroll it 270 * 271 * Legends: 272 * ââââââââââ â â â â â 273 * â target â frame 274 * ââââââââââ â â â â â 275 */ 276 function alignNearest(scrollingEdgeStart, scrollingEdgeEnd, scrollingSize, scrollingBorderStart, scrollingBorderEnd, elementEdgeStart, elementEdgeEnd, elementSize) { 277 /** 278 * If element edge A and element edge B are both outside scrolling box edge A and scrolling box edge B 279 * 280 * ââââ 281 * ââââââââ 282 * â â 283 * â â â â do nothing 284 * â â 285 * ââââââââ 286 * ââââ 287 * 288 * If element edge C and element edge D are both outside scrolling box edge C and scrolling box edge D 289 * 290 * â â â â â â 291 * âââââââââââââ 292 * ââ ââ do nothing 293 * âââââââââââââ 294 * â â â â â â 295 */ 296 if ((elementEdgeStart < scrollingEdgeStart && elementEdgeEnd > scrollingEdgeEnd) || 297 (elementEdgeStart > scrollingEdgeStart && elementEdgeEnd < scrollingEdgeEnd)) { 298 return 0; 299 } 300 /** 301 * If element edge A is outside scrolling box edge A and element height is less than scrolling box he
301ight 302 * 303 * ââââ 304 * ââââââââ ââââââââ 305 * ââââ â â 306 * from â â to â ââââ â 307 * 308 * ââ ââ ââ ââ ââ ââ 309 * 310 * If element edge B is outside scrolling box edge B and element height is greater than scrolling box height 311 * 312 * ââ ââ ââ ââââââââ 313 * â â 314 * from â ââââ â to â â â â 315 * â â â â 316 * ââââââââ ââââââââ 317 * â â ââââ 318 * â â 319 * ââââ 320 * 321 * If element edge C is outside scrolling box edge C and element width is less than scrolling box width 322 * 323 * from to 324 * â â â â â â â â â â â â 325 * âââââ âââââ 326 * â â â â â â â 327 * âââââ âââââ 328 * â â â â â â â â â â â â 329 * 330 * If element edge D is outside scrolling box edge D and element width is greater than scrolling box width 331 * 332 * from to 333 * â â â â â â â â â â â â 334 * âââââââââââââ âââââââââââââ 335 * â â â â â â â 336 * âââââââââââââ âââââââââââââ 337 * â â â â â â â â â â â â 338 */ 339 if ((elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize) || 340 (elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize)) { 341 return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart; 342 } 343 /** 344 * If element edge B is outside scrolling box edge B and element height is less than scrolling box height 345 * 346 * ââ ââ ââ ââ ââ ââ 347 * 348 * from â â to â ââââ â 349 * ââââ â â 350 * ââââââââ ââââââââ 351 * ââââ 352 * 353 * If element edge A is outside scrolling box edge A and element height is greater than scrolling box height 354 * 355 * ââââ 356 * â â 357 * â â ââââ 358 * ââââââââ ââââââââ 359 * â â â â 360 * from â ââââ â to â â â â 361 * â â 362 * ââ ââ ââ ââââââââ 363 * 364 * If element edge C is outside scrolling box edge C and element width is greater than scrolling box width 365 * 366 * from to 367 * â â â â â â â â â â â â 368 * âââââââââââââ âââââââââââââ 369 * â â â â â â â 370 * âââââââââââââ âââââââââââââ 371 * â â â â â â â â â â â â 372 * 373 * If element edge D is outside scrolling box edge D and element width is less than scrolling box width 374 * 375 * from to 376 * â â â â â â â â â â â â 377 * âââââ âââââ 378 * â â â â â â â 379 * âââââ âââââ 380 * â â â â â â â â â â â â 381 * 382 */ 383 if ((elementEdgeEnd > scrollingEdgeEnd && elementSize < scrollingSize) || 384 (elementEdgeStart < scrollingEdgeStart && elementSize > scrollingSize)) { 385 return elementEdgeEnd - scrollingEdgeEnd + scrollingBorderEnd; 386 } 387 return 0; 388 } 389 390 var canOverflow = function (overflow) { 391 return overflow !== "visible" && overflow !== "clip"; 392 }; 393 var isScrollable = function (element) { 394 if (element.clientHeight < element.scrollHeight || element.clientWidth < element.scrollWidth) { 395 var style = getComputedStyle(element); 396 return canOverflow(style.overflowY) || canOverflow(style.overflowX); 397 } 398 return false; 399 }; 400 var parentElement = function (element) { 401 var parentNode = element.parentNode; 402 return (parentNode && 403 (parentNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE 404 ? parentNode.host 405 : parentNode)); 406 }; 407 var elementScrollIntoView = function (element, options) { 408 var e_1, _a; 409 if (!element.ownerDocument.documentElement.contains(element)) { 410 return; 411 } 412 if (options.behavior !== "smooth") { 413 return originalFunc.call(element, options.block !== "end"); 414 } 415 // On Chrome and Firefox, document.scrollingElement will return the <html> element. 416 // Safari, document.scrollingElement will return the <body> element. 417 // On Edge, document.scrollingElement will return the <body> element. 418 // IE11 does not support document.scrollingElement, but you can assume its <html>. 419 // Used to handle the top most element that can be scrolled 420 var scrollingElement = document.scrollingElement || document.documentElement; 421 // Collect all the scrolling boxes, as defined in the spec: https://drafts.csswg.org/cssom-view/#scrolling-box 422 var frames = []; 423 for (var cursor = parentElement(element); cursor !== null; cursor = parentElement(cursor)) { 424 // Stop when we reach the viewport 425 if (cursor === scrollingElement) { 426 frames.push(cursor); 427 break; 428 } 429 // Skip document.body if it's not the scrollingElement and documentElement isn't independently scrollable 430 if (cursor === document.body && isScrollable(cursor) && !isScrollable(document.documentElement)) { 431 continue; 432 } 433 // Now we check if the element is scrollable, 434 // this code only runs if the loop haven't already hit the viewport or a custom boundary 435 if (isScrollable(cursor)) { 436 frames.push(cursor); 437 } 438 }
439 // Support pinch-zooming properly, making sure elements scroll into the visual viewport 440 // Browsers that don't support visualViewport 441 // will report the layout viewport dimensions on document.documentElement.clientWidth/Height 442 // and viewport dimensions on window.innerWidth/Height 443 // https://www.quirksmode.org/mobile/viewports2.html 444 // https://bokand.github.io/viewport/index.html 445 var viewportWidth = window.visualViewport ? window.visualViewport.width : innerWidth; 446 var viewportHeight = window.visualViewport ? window.visualViewport.height : innerHeight; 447 // Newer browsers supports scroll[X|Y], page[X|Y]Offset is 448 var viewportX = window.scrollX || window.pageXOffset; 449 var viewportY = window.scrollY || window.pageYOffset; 450 var _b = element.getBoundingClientRect(), targetHeight = _b.height, targetWidth = _b.width, targetTop = _b.top, 451 targetRight = _b.right, targetBottom = _b.bottom, targetLeft = _b.left; 452 var writingMode = getComputedStyle(element).writingMode; 453 var isHorizontalWritingMode = writingMode === "horizontal-tb"; 454 var isFlippedBlocksWritingMode = writingMode === "vertical-rl"; 455 var alignX = toPhysicalAlignment(options, 0 /* HorizontalScroll */, isHorizontalWritingMode, isFlippedBlocksWritingMode); 456 var alignY = toPhysicalAlignment(options, 1 /* VerticalScroll */, isHorizontalWritingMode, isFlippedBlocksWritingMode); 457 var targetBlock = (function () { 458 switch (alignY) { 459 case 2 /* AlignTopAlways */ 460 : 461 case 0 /* AlignToEdgeIfNeeded */ 462 : 463 return targetTop; 464 case 3 /* AlignBottomAlways */ 465 : 466 return targetBottom; 467 // case ScrollAlignment.AlignCenterAlways: 468 default: 469 return targetTop + targetHeight / 2; 470 } 471 })(); 472 var targetInline = (function () { 473 switch (alignX) { 474 case 1 /* AlignCenterAlways */ 475 : 476 return targetLeft + targetWidth / 2; 477 case 5 /* AlignRightAlways */ 478 : 479 return targetRight; 480 // case ScrollAlignment.AlignLeftAlways: 481 // case ScrollAlignment.AlignToEdgeIfNeeded: 482 default: 483 return targetLeft; 484 } 485 })(); 486 var actions = []; 487 var _loop_1 = function (frame) { 488 var _a = frame.getBoundingClientRect(), height = _a.height, width = _a.width, top_1 = _a.top, 489 right = _a.right, bottom = _a.bottom, left = _a.left; 490 var frameStyle = getComputedStyle(frame); 491 var borderLeft = parseInt(frameStyle.borderLeftWidth, 10); 492 var borderTop = parseInt(frameStyle.borderTopWidth, 10); 493 var borderRight = parseInt(frameStyle.borderRightWidth, 10); 494 var borderBottom = parseInt(frameStyle.borderBottomWidth, 10); 495 var blockScroll = 0; 496 var inlineScroll = 0; 497 // The property existance checks for offfset[Width|Height] is because only HTMLElement objects have them, 498 // but any Element might pass by here 499 // @TODO find out if the "as HTMLElement" overrides can be dropped 500 var scrollbarWidth = "offsetWidth" in frame 501 ? frame.offsetWidth - frame.clientWidth - borderLeft - borderRight 502 : 0; 503 var scrollbarHeight = "offsetHeight" in frame 504 ? frame.offsetHeight - frame.clientHeight - borderTop - borderBottom 505 : 0; 506 if (scrollingElement === frame) { 507 // Handle viewport logic (document.documentElement or document.body) 508 switch (alignY) { 509 case 2 /* AlignTopAlways */ 510 : { 511 blockScroll = targetBlock; 512 break; 513 } 514 case 3 /* AlignBottomAlways */ 515 : {
516 blockScroll = targetBlock - viewportHeight; 517 break; 518 } 519 case 1 /* AlignCenterAlways */ 520 : { 521 blockScroll = targetBlock - viewportHeight / 2; 522 break; 523 } 524 case 0 /* AlignToEdgeIfNeeded */ 525 : { 526 blockScroll = alignNearest(viewportY, viewportY + viewportHeight, viewportHeight, borderTop, borderBottom, viewportY + targetBlock, viewportY + targetBlock + targetHeight, targetHeight); 527 break; 528 } 529 } 530 switch (alignX) { 531 case 4 /* AlignLeftAlways */ 532 : { 533 inlineScroll = targetInline; 534 break; 535 } 536 case 5 /* AlignRightAlways */ 537 : { 538 inlineScroll = targetInline - viewportWidth; 539 break; 540 } 541 case 1 /* AlignCenterAlways */ 542 : { 543 inlineScroll = targetInline - viewportWidth / 2; 544 break; 545 } 546 case 0 /* AlignToEdgeIfNeeded */ 547 : { 548 inlineScroll = alignNearest(viewportX, viewportX + viewportWidth, viewportWidth, borderLeft, borderRight, viewportX + targetInline, viewportX + targetInline + targetWidth, targetWidth); 549 break; 550 } 551 } 552 // Apply scroll position offsets and ensure they are within bounds 553 blockScroll = Math.max(0, blockScroll + viewportY); 554 inlineScroll = Math.max(0, inlineScroll + viewportX); 555 actions.push(function () { 556 return windowScroll(__assign({}, options, {top: blockScroll, left: inlineScroll})); 557 }); 558 } else { 559 // Handle each scrolling frame that might exist between the target and the viewport 560 switch (alignY) { 561 case 2 /* AlignTopAlways */ 562 : { 563 blockScroll = targetBlock - top_1 - borderTop; 564 break; 565 } 566 case 3 /* AlignBottomAlways */ 567 : { 568 blockScroll = targetBlock - bottom + borderBottom + scrollbarHeight; 569 break; 570 } 571 case 1 /* AlignCenterAlways */ 572 : { 573 blockScroll = targetBlock - (top_1 + height / 2) + scrollbarHeight / 2; 574 break; 575 } 576 case 0 /* AlignToEdgeIfNeeded */ 577 : { 578 blockScroll = alignNearest(top_1, bottom, height, borderTop, borderBottom + scrollbarHeight, targetBlock, targetBlock + targetHeight, targetHeight); 579 break; 580 } 581 } 582 switch (alignX) { 583 case 4 /* AlignLeftAlways */ 584 : { 585 inlineScroll = targetInline - left - borderLeft; 586 break; 587 } 588 case 5 /* AlignRightAlways */ 589 : { 590 inlineScroll = targetInline - right + borderRight + scrollbarWidth; 591 break; 592 } 593 case 1 /* AlignCenterAlways */ 594 : { 595 inlineScroll = targetInline - (left + width / 2) + scrollbarWidth / 2; 596 break; 597 } 598 case 0 /* AlignToEdgeIfNeeded */ 599 : { 600 inlineScroll = alignNearest(left, right, width, borderLeft, borderRight + scrollbarWidth, targetInline, targetInline + targetWidth, targetWidth);
601 break; 602 } 603 } 604 var scrollLeft = frame.scrollLeft, scrollTop = frame.scrollTop; 605 // Ensure scroll coordinates are not out of bounds while applying scroll offsets 606 blockScroll = Math.max(0, Math.min(scrollTop + blockScroll, frame.scrollHeight - height + scrollbarHeight)); 607 inlineScroll = Math.max(0, Math.min(scrollLeft + inlineScroll, frame.scrollWidth - width + scrollbarWidth)); 608 // Cache the offset so that parent frames can scroll this into view correctly 609 targetBlock += scrollTop - blockScroll; 610 targetInline += scrollLeft - inlineScroll; 611 actions.push(function () { 612 return elementScroll(frame, __assign({}, options, {top: blockScroll, left: inlineScroll})); 613 }); 614 } 615 }; 616 try { 617 for (var frames_1 = __values(frames), frames_1_1 = frames_1.next(); !frames_1_1.done; frames_1_1 = frames_1.next()) { 618 var frame = frames_1_1.value; 619 _loop_1(frame); 620 } 621 } catch (e_1_1) { 622 e_1 = {error: e_1_1}; 623 } finally { 624 try { 625 if (frames_1_1 && !frames_1_1.done && (_a = frames_1.return)) _a.call(frames_1); 626 } finally { 627 if (e_1) throw e_1.error; 628 } 629 } 630 actions.forEach(function (run) { 631 return run(); 632 }); 633 }; 634 var polyfill$3 = function (options) { 635 Element.prototype.scrollIntoView = function scrollIntoView(arg) { 636 if (typeof arg === "boolean") { 637 return originalFunc.call(this, arg); 638 } 639 if (Object(arg) !== arg) { 640 throw new TypeError("Failed to execute 'scrollIntoView' on 'Element': parameter 1 ('options') is not an object."); 641 } 642 return elementScrollIntoView(this, __assign({}, arg, options)); 643 }; 644 }; 645 646 var polyfill$4 = function (options) { 647 Element.prototype.scrollTo = function scrollTo() { 648 var _a = __read(arguments, 2), _b = _a[0], arg0 = _b === void 0 ? 0 : _b, _c = _a[1], 649 arg1 = _c === void 0 ? 0 : _c; 650 if (typeof arg0 === "number" && typeof arg1 === "number") { 651 return originalElementScroll.call(this, arg0, arg1); 652 } 653 if (Object(arg0) !== arg0) { 654 throw new TypeError("Failed to execute 'scrollTo' on 'Element': parameter 1 ('options') is not an object."); 655 } 656 return elementScroll(this, __assign({}, arg0, options)); 657 }; 658 }; 659 660 var windowScrollBy = function (options) { 661 var left = (options.left || 0) + (window.scrollX || window.pageXOffset); 662 var top = (options.top || 0) + (window.scrollY || window.pageYOffset); 663 if (options.behavior !== "smooth") { 664 return originalWindowScroll(left, top); 665 } 666 return windowScroll(__assign({}, options, {left: left, top: top})); 667 }; 668 var polyfill$5 = function (options) { 669 var originalFunc = window.scrollBy; 670 window.scrollBy = function scrollBy() { 671 var _a = __read(arguments, 2), _b = _a[0], arg0 = _b === void 0 ? 0 : _b, _c = _a[1], 672 arg1 = _c === void 0 ? 0 : _c; 673 if (typeof arg0 === "number" && typeof arg1 === "number") { 674 return originalFunc(arg0, arg1); 675 } 676 if (Object(arg0) !== arg0) { 677 throw new TypeError("Failed to execute 'scrollBy' on 'Window': parameter 1 ('options') is not an object."); 678 } 679 return windowScrollBy(__assign({}, arg0, options)); 680 }; 681 }; 682 683 var polyfill$6 = function (options) { 684 var originalFunc = window.scrollTo || window.scroll; 685 window.scrollTo = function scrollTo() { 686 var _a = __read(arguments, 2), _b = _a[0], arg0 = _b === void 0 ? 0 : _b, _c = _a[1],
687 arg1 = _c === void 0 ? 0 : _c; 688 if (typeof arg0 === "number" && typeof arg1 === "number") { 689 return originalFunc.call(this, arg0, arg1); 690 } 691 if (Object(arg0) !== arg0) { 692 throw new TypeError("Failed to execute 'scrollTo' on 'Window': parameter 1 ('options') is not an object."); 693 } 694 return windowScroll(__assign({}, arg0, options)); 695 }; 696 }; 697 698 var polyfill$7 = function (options) { 699 if ("scrollBehavior" in document.documentElement.style) { 700 return; 701 } 702 polyfill$2(options); 703 polyfill$6(options); 704 polyfill$5(options); 705 polyfill(options); 706 polyfill$4(options); 707 polyfill$1(options); 708 polyfill$3(options); 709 }; 710 711 exports.elementScroll = elementScroll; 712 exports.elementScrollBy = elementScrollBy; 713 exports.elementScrollIntoView = elementScrollIntoView; 714 exports.elementScrollTo = elementScroll; 715 exports.polyfill = polyfill$7; 716 exports.seamless = polyfill$7; 717 exports.windowScroll = windowScroll; 718 exports.windowScrollBy = windowScrollBy; 719 exports.windowScrollTo = windowScroll; 720 721 Object.defineProperty(exports, '__esModule', {value: true}); 722 723})); 724//# sourceMappingURL=seamless.js.map 725if (document.getElementsByClassName("bpb_wrapper").length > 0) { 726 document.getElementsByClassName("bpb_wrapper")[0].style.display = "none"; 727} 728(function ($) { 729 'use strict'; 730 731 function isMobile() { 732 let check = false; 733 (function (a) { 734 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true; 735 })(navigator.userAgent || navigator.vendor || window.opera); 736 return check; 737 } 738 739 function scrollWindow() { 740 if (isMobile()) { 741 //seamless.elementScrollBy(window, {left: 0, top: -50}); 742 seamless.windowScrollBy(0, -50); 743 } else { 744 seamless.windowScrollBy(0 - 130); 745 //window.scrollBy(0, -130); 746 } 747 } 748 749 //if (isMobile()) { 750 //document.getElementsByClassName("bpb_wrapper")[0].style.display = "none"; 751 // } 752 $(function () { 753 //jQuery(document.body).trigger('wc_fragment_refresh'); 754 //jQuery(document.body).on('wc_fragments_refreshed', function () { 755 jQuery('[data-countdown]').each(function () { 756 var $this = jQuery(this), finalDate = jQuery(this).data('countdown'); 757 $this.countdown(finalDate, function (event) { 758 $this.html(event.strftime('%M:%S')); 759 }).on('finish.countdown', function (event) { 760 //jQuery(document.body).trigger('wc_fragment_refresh'); 761 location.reload(); 762 }); 763 }); 764 // }); 765 jQuery('.categoryd').on('change', function () { 766 window.location.href = jQuery(this).val(); 767 }); 768 jQuery('body').on('click', '.b_about_show', function () { 769 //jQuery('.b_about_show').on('click', function () { 770 seamless.elementScrollIntoView(document.querySelector('.column_product_inner'), { 771 behavior: 'smooth', 772 inline: 'center', 773 block: 'center' 774 }); 775 scrollWindow(); 776 }); 777 778 if (isMobile()) { 779 780 jQuery('.bpb_wrapper').clone().attr('id', 'bpbwp').css('margin-top', '20px').css('margin-bottom', '20px').css('position', 'relative').css('top', '140px').insertAfter('.bpp_wrapper'); 781 jQuery('#bpbwp').prev().css('position', 'relative').css('top', '140px'); 782 jQuery('.product_row_image').next().css('margin-top', '120px'); 783 jQuery('.bpb_wrapper').css('display', 'flex'); 784 jQuery('.bpb_wrapper').first().css('display', 'none'); 785 } else { 786 jQuery('.bpb_wrapper').css('display', 'flex'); 787 } 788 /*if (!isMobile()) { 789 jQuery('.around_icons_shopping').on('click', function (ev) { 790 ev.preventDefault(); 791 jQuery(document.body).trigger('wc_fragment_refresh'); 792 }); 793 }*/ 794 795 jQuery('.around_icons_shopping').on('mouseenter', function (ev) { 796 if (!jQuery('.around_icons_shopping').hasClass('been_refreshed')) { 797 jQuery(document.body).trigger('wc_fragment_refresh'); 798 jQuery('.around_icons_shopping').addClass('been_refreshed'); 799 } 800 }); 801 802 jQuery('.navbar-hamburger img.header-left-icon-containerimg, .header-left-icon-container img.header-left-icon-containerimg').on('click', function () { 803 jQuery('#hamburger-section').show(); 804 }); 805 jQuery('.navbar-hamburger img.closeimg, .header-left-icon-container img.closeimg').on('click', function () { 806 jQuery('#hamburger-section').hide(); 807 }); 808 809 jQuery(document).on("updated_checkout", function () {
810 jQuery('.woocommerce-additional-fields__field-wrapper').hide(); 811 jQuery('#bb_add_order_notes').on('change', function () { 812 if (jQuery(this).is(':checked')) { 813 jQuery('.woocommerce-additional-fields__field-wrapper').show(); 814 } else { 815 jQuery('.woocommerce-additional-fields__field-wrapper').hide(); 816 } 817 }); 818 jQuery('[data-countdown]').each(function () { 819 var $this = jQuery(this), finalDate = jQuery(this).data('countdown'); 820 $this.countdown(finalDate, function (event) { 821 $this.html(event.strftime('%M:%S')); 822 }).on('finish.countdown', function (event) { 823 //jQuery(document.body).trigger('wc_fragment_refresh'); 824 location.reload(); 825 }); 826 }); 827 }); 828 829 jQuery(document.body).on('click', '.couponbtn', function () { 830 var $form = jQuery('.wc-block-components-totals-coupon .checkout_coupon'); 831 832 if ($form.is('.processing')) { 833 return false; 834 } 835 836 $form.addClass('processing').block({ 837 message: null, 838 overlayCSS: { 839 background: '#fff', 840 opacity: 0.6 841 } 842 }); 843 844 var data = { 845 security: wc_checkout_params.apply_coupon_nonce, 846 coupon_code: $form.find('#bb_couponcode').val() 847 }; 848 849 jQuery.ajax({ 850 type: 'POST', 851 url: wc_checkout_params.wc_ajax_url.toString().replace('%%endpoint%%', 'apply_coupon'), 852 data: data, 853 success: function (code) { 854 jQuery('.woocommerce-error, .woocommerce-message').remove(); 855 $form.removeClass('processing').unblock(); 856 857 if (code) { 858 $form.before(code); 859 $form.slideUp(); 860 861 jQuery(document.body).trigger('applied_coupon_in_checkout', [data.coupon_code]); 862 jQuery(document.body).trigger('update_checkout', {update_shipping_method: false}); 863 } 864 }, 865 dataType: 'html' 866 }); 867 }); 868 /*jQuery('.theme-porto .img-thumbnail .inner img').on('click', function () { 869 jQuery('.zoom').trigger('click'); 870 }); 871 jQuery('.theme-porto a.button').addClass('btn'); 872 jQuery('.theme-porto .single_add_to_cart_button').addClass('btn'); 873 $('.bb_view_calendar').on('click', function () { 874 if ($(this).hasClass('bbselected')) { 875 deselect($(this)); 876 } else { 877 $(this).addClass('bbselected'); 878 $('.bb_calendar_pop').slideFadeToggle(); 879 } 880 return false; 881 }); 882 883 tippy('.quickviewb'); 884 tippy('.tinvwl-tooltip'); 885 tippy('.tinvwl-icon-heart.no-txt'); 886 887 $('.bb_calendar_close').on('click', function () { 888 deselect($('.bb_view_calendar')); 889 return false; 890 }); 891 892 $('.bb_view_widget').on('click', function () { 893 if ($(this).hasClass('bbselected')) { 894 deselectw($(this)); 895 } else { 896 $(this).addClass('bbselected'); 897 $('.bb_calendarw_pop').slideFadeToggle(); 898 } 899 return false; 900 }); 901 902 $('.bb_calendarw_close').on('click', function () { 903 deselectw($('.bb_view_widget')); 904 return false; 905 }); 906 907 $('.bb_view_detailsc').on('click', function () { 908 if ($(this).hasClass('bbselected')) { 909 deselectc($(this)); 910 } else { 911 $(this).addClass('bbselected'); 912 $('.bb_customer_pop').slideFadeToggle(); 913 } 914 return false; 915 }); 916 917 $('.bb_customer_close').on('click', function () { 918 deselectc($('.bb_view_detailsc')); 919 return false; 920 }); 921 //$('<a class="">More Info</a>').insertAfter($('#wc_checkout_add_ons .description')); 922 $(document.body).on('updated_checkout', function () { 923 $('#wc_checkout_add_ons .description').each(function (el) { 924 let label = $(this).next('label').first(); 925 let toolt = $('<a class="mytooltip"><i class="fas fa-question"></i></a>'); 926 toolt.appendTo(label); 927 toolt.prop('title', $(this).html()); 928 $(this).html(''); 929 tippy('.mytooltip', { 930 theme: 'lightcustom', 931 }); 932 //$('.mytooltip').tooltip(); 933 }); 934 });*/ 935 });
936 937 function deselect(e) { 938 $('.bb_calendar_pop').slideFadeToggle(function () { 939 e.removeClass('bbselected'); 940 }); 941 } 942 943 function deselectw(e) { 944 $('.bb_calendarw_pop').slideFadeToggle(function () { 945 e.removeClass('bbselected'); 946 }); 947 } 948 949 function deselectc(e) { 950 $('.bb_customer_pop').slideFadeToggle(function () { 951 e.removeClass('bbselected'); 952 }); 953 } 954 955 $.fn.slideFadeToggle = function (easing, callback) { 956 return this.animate({opacity: 'toggle', height: 'toggle'}, 'fast', easing, callback); 957 }; 958 959 960})(jQuery, window);
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.