1/******/ (() => { // webpackBootstrap 2/******/ "use strict"; 3/******/ var __webpack_modules__ = ([ 4/* 0 */, 5/* 1 */ 6/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 7 8__webpack_require__.r(__webpack_exports__); 9/* harmony export */ __webpack_require__.d(__webpack_exports__, { 10/* harmony export */ csGetCookie: () => (/* binding */ csGetCookie), 11/* harmony export */ csSetCookie: () => (/* binding */ csSetCookie), 12/* harmony export */ csco: () => (/* binding */ csco), 13/* harmony export */ isInViewport: () => (/* binding */ isInViewport), 14/* harmony export */ slideDown: () => (/* binding */ slideDown), 15/* harmony export */ slideToggle: () => (/* binding */ slideToggle), 16/* harmony export */ slideUp: () => (/* binding */ slideUp) 17/* harmony export */ }); 18// Create csco object. 19var csco = { 20 addAction: function ( x, y, z ) { 21 return; 22 } 23}; 24 25if ( 'undefined' !== typeof wp && 'undefined' !== typeof wp.hooks ) { 26 csco.addAction = wp.hooks.addAction; 27} 28 29/** 30 * isInViewport 31 */ 32 33function isInViewport(element) { 34 const rect = element.getBoundingClientRect(); 35 const windowHeight = (window.innerHeight || document.documentElement.clientHeight); 36 const windowWidth = (window.innerWidth || document.documentElement.clientWidth); 37 38 return (rect.top <= windowHeight && rect.top + rect.height >= 0) && (rect.left <= windowWidth && rect.left + rect.width >= 0); 39} 40 41/** 42 * slideDown \ slideUp \ slideToggle 43 */ 44 45function slideDown(element, duration = 350) { 46 element.style.display = 'block'; 47 element.style.overflow = 'hidden'; 48 let height = element.scrollHeight; 49 element.style.height = 0; 50 setTimeout(() => { 51 element.style.transition = `height ${duration}ms`; 52 element.style.height = height + 'px'; 53 element.addEventListener('transitionend', function te() { 54 element.removeEventListener('transitionend', te); 55 element.style.removeProperty('height'); 56 element.style.removeProperty('transition'); 57 element.style.removeProperty('overflow'); 58 }); 59 }, 0); 60} 61 62function slideUp(element, duration = 350) { 63 element.style.height = element.offsetHeight + 'px'; 64 element.style.overflow = 'hidden'; 65 setTimeout(() => { 66 element.style.transition = `height ${duration}ms`; 67 element.style.height = '0'; 68 element.addEventListener('transitionend', function te() { 69 element.removeEventListener('transitionend', te); 70 if (element.style.height === '0px') { 71 element.style.display = 'none'; 72 } 73 element.style.removeProperty('height'); 74 element.style.removeProperty('transition'); 75 element.style.removeProperty('overflow'); 76 }); 77 }, 0); 78} 79 80function slideToggle(element, duration = 350) { 81 if (window.getComputedStyle(element).display === 'none') { 82 return slideDown(element, duration); 83 } else { 84 return slideUp(element, duration); 85 } 86} 87 88/** 89 * Cookies 90 */ 91function csGetCookie( name ) { 92 let matches = document.cookie.match( new RegExp( 93 "(?:^|; )" + name.replace( /([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1' ) + "=([^;]*)" 94 ) ); 95 return matches ? decodeURIComponent( matches[ 1 ] ) : undefined; 96} 97 98function csSetCookie( name, value, props = {} ) { 99 100 props = { 101 path: '/' 102 }; 103 104 if ( props.expires instanceof Date ) { 105 props.expires = props.expires.toUTCString(); 106 } 107 108 let updatedCookie = encodeURIComponent( name ) + "=" + encodeURIComponent( value ); 109 110 for ( let optionKey in props ) { 111 updatedCookie += "; " + optionKey; 112 let optionValue = props[ optionKey ]; 113 if ( optionValue !== true ) { 114 updatedCookie += "=" + optionValue; 115 } 116 } 117 118 document.cookie = updatedCookie; 119} 120 121 122 123 124/***/ }) 125/******/ ]); 126/************************************************************************/ 127/******/ // The module cache 128/******/ var __webpack_module_cache__ = {}; 129/******/ 130/******/ // The require function 131/******/ function __webpack_require__(moduleId) { 132/******/ // Check if module is in cache 133/******/ var cachedModule = __webpack_module_cache__[moduleId]; 134/******/ if (cachedModule !== undefined) { 135/******/ return cachedModule.exports; 136/******/ } 137/******/ // Create a new module (and put it into the cache) 138/******/ var module = __webpack_module_cache__[moduleId] = { 139/******/ // no module.id needed 140/******/ // no module.loaded needed 141/******/ exports: {} 142/******/ }; 143/******/ 144/******/ // Execute the module function 145/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 146/******/ 147/******/ // Return the exports of the module 148/******/ return module.exports; 149/******/ } 150/******/ 151/************************************************************************/ 152/******/ /* webpack/runtime/define property getters */ 153/******/ (() => { 154/******/ // define getter functions for harmony exports 155/******/ __webpack_require__.d = (exports, definition) => { 156/******/ for(var key in definition) { 157/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 158/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 159/******/ } 160/******/ } 161/******/ }; 162/******/ })(); 163/******/ 164/******/ /* webpack/runtime/hasOwnProperty shorthand */ 165/******/ (() => { 166/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 167/******/ })(); 168/******/ 169/******/ /* webpack/runtime/make namespace object */ 170/******/ (() => { 171/******/ // define __esModule on exports 172/******/ __webpack_require__.r = (exports) => { 173/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 174/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 175/******/ } 176/******/ Object.defineProperty(exports, '__esModule', { value: true }); 177/******/ }; 178/******/ })(); 179/******/ 180/************************************************************************/ 181var __webpack_exports__ = {}; 182// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 183(() => { 184var __webpack_exports__ = {}; 185__webpack_require__.r(__webpack_exports__); 186/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 187/** ---------------------------------------------------------------------------- 188 * Header Bottombar Carousel */ 189 190 191 192(function () { 193 194 const sliders = document.querySelectorAll(`.cs-header-bottombar-carou
194sel .cs-header-bottombar__nav-menu`); 195 196 if (sliders.length === 0) { 197 return; 198 } 199 200 const initSwiper = function() { 201 sliders.forEach(slider => { 202 203 // Swiper settings 204 const wrapperClass = `cs-header-bottombar__nav`; 205 const slideClass = `menu-item`; 206 const prevEl = slider.querySelector(`.cs-header-bottombar__button-prev`); 207 const nextEl = slider.querySelector(`.cs-header-bottombar__button-next`); 208 209 new Swiper(slider, { 210 scrollbar: false, 211 wrapperClass: wrapperClass, 212 slideClass: slideClass, 213 direction: 'horizontal', 214 loop: false, 215 rewind: true, 216 speed: 250, 217 parallax: false, 218 autoplay: false, 219 slidesPerView: 'auto', 220 spaceBetween: 0, 221 navigation: { 222 nextEl: nextEl, 223 prevEl: prevEl, 224 }, 225 }); 226 }); 227 }; 228 229 document.addEventListener('DOMContentLoaded', () => { 230 initSwiper(); 231 }); 232 233})(); 234 235})(); 236 237// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 238(() => { 239var __webpack_exports__ = {}; 240__webpack_require__.r(__webpack_exports__); 241/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 242/** ---------------------------------------------------------------------------- 243 * Header Bottombar Marquee */ 244 245 246 247(function () { 248 249 const section = 'cs-header-bottombar__marquee'; 250 const sliders = document.querySelectorAll(`.${section}`); 251 252 if (sliders.length === 0) { 253 return; 254 } 255 256 const initSwiper = function() {
257 sliders.forEach(slider => { 258 259 const speedValue = slider.getAttribute('data-cs-slide-speed'); 260 261 // Swiper settings. 262 const wrapperClass = `${section}-wrapper`; 263 const slideClass = `${section}-item`; 264 const speed = !isNaN(parseInt(speedValue)) ? parseInt(speedValue) : 8000; 265 266 const swiperInstance = new Swiper(slider, { 267 wrapperClass: wrapperClass, 268 slideClass: slideClass, 269 scrollbar: false, 270 direction: 'horizontal', 271 slidesPerView: 'auto', 272 speed: speed, 273 initialSlide: 0, 274 loop: true, 275 parallax: false, 276 spaceBetween: 0, 277 allowTouchMove: false, 278 waitForTransition: false, 279 watchSlidesProgress: false, 280 autoplay: { 281 delay: 0, 282 disableOnInteraction: false, 283 }, 284 }); 285 286 // Pause when out of view. 287 const observer = new IntersectionObserver((entries) => { 288 entries.forEach(entry => { 289 if (!entry.isIntersecting) { 290 swiperInstance.autoplay.stop(); 291 } else { 292 swiperInstance.autoplay.start(); 293 } 294 }); 295 }, { threshold: 0 }); 296 297 observer.observe(slider); 298 }); 299 }; 300 301 document.addEventListener('DOMContentLoaded', () => { 302 initSwiper(); 303 }); 304 305})(); 306 307})(); 308 309// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 310(() => { 311var __webpack_exports__ = {}; 312__webpack_require__.r(__webpack_exports__); 313/** ---------------------------------------------------------------------------- 314 * Comments Toggle */ 315 316(function () { 317 318 if ( ! document.body.classList.contains('single') ) { 319 return; 320 } 321 322 // Attach a delegated event listener on the container that holds all posts. 323 const container = document.querySelector('.cs-site-primary') || document; 324 325 container.addEventListener('click', function (e) { 326 327 // Handle Header Toggle. 328 const headToggle = e.target.closest('.cs-meta-comments'); 329 330 if (headToggle) { 331 332 // Only proceed if this toggle is located within a cs-entry__header. 333 const headerContainer = headToggle.closest('.cs-entry__header'); 334 if (headerContainer && headerContainer.closest('.cs-site-content')) { 335 336 e.preventDefault(); 337 338 // Instead of relying on a common post wrapper, use the cs-site-content container. 339 const siteContent = headToggle.closest('.cs-site-content'); 340 if (!siteContent) { 341 return; 342 } 343 344 // Get all comment sections within this site-content. 345 const allComments = Array.from(siteContent.querySelectorAll('.cs-entry__comments')); 346 if (!allComments.length) { 347 return; 348 } 349 350 // Find the comment section that is positioned immediately below the header toggle. 351 const headRect = headToggle.getBoundingClientRect(); 352 let candidate = null; 353 let minDistance = Infinity; 354 allComments.forEach(cc => { 355 const ccRect = cc.getBoundingClientRect(); 356 357 // Consider only those below the header toggle. 358 if (ccRect.top >= headRect.bottom) { 359 const distance = ccRect.top - headRect.bottom; 360 if (distance < minDistance) { 361 minDistance = distance; 362 candidate = cc; 363 } 364 } 365 }); 366 367 // If none is found below, pick the first one. 368 if (!candidate) { 369 candidate = allComments[0]; 370 } 371 372 candidate.classList.add('cs-entry__comments-visible'); 373 candidate.scrollIntoView({ behavior: 'smooth' }); 374 return; 375 } 376 } 377 378 // Handle regular comments toggle. 379 const commentsToggle = e.target.closest('.cs-entry__comments-toggle'); 380 if (commentsToggle) { 381 e.preventDefault(); 382 383 const siteContent = commentsToggle.closest('.cs-site-content'); 384 if (!siteContent) { 385 return; 386 } 387 388 const allComments = Array.from(siteContent.querySelectorAll('.cs-entry__comments')); 389 if (!allComments.length) { 390 return; 391 } 392 393 const toggleRect = commentsToggle.getBoundingClientRect(); 394 let candidate = null; 395 let minDistance = Infinity; 396 allComments.forEach(cc => { 397 const ccRect = cc.getBoundingClientRect(); 398 if (ccRect.top >= toggleRect.bottom) { 399 const distance = ccRect.top - toggleRect.bottom; 400 if (distance < minDistance) { 401 minDistance = distance; 402 candidate = cc; 403 } 404 } 405 }); 406 407 if (!candidate) { 408 candidate = allComments[0]; 409 } 410
411 candidate.classList.toggle('cs-entry__comments-visible'); 412 return; 413 } 414 }); 415 416 // Auto-open via URL Hash on Page Load. 417 window.addEventListener('load', function () { 418 if (window.location.hash && window.location.hash !== "#") { 419 const target = document.querySelector(window.location.hash); 420 if (target && target.classList.contains('cs-entry__comments')) { 421 target.classList.add('cs-entry__comments-visible'); 422 } 423 } 424 }); 425})(); 426 427})(); 428 429// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 430(() => { 431var __webpack_exports__ = {}; 432__webpack_require__.r(__webpack_exports__); 433/** ---------------------------------------------------------------------------- 434 * Floating Header */ 435 436( function() { 437 438 const section = 'cs-floating-header'; 439 const activeClass = 'is-active'; 440 const offset = 300; 441 442 const root = document.documentElement; 443 const floatingHeader = document.querySelector(`.${section}`); 444 const progressbar = document.querySelector(`.${section}__progress-bar`); 445 446 if (floatingHeader && progressbar) { 447 const updateProgress = function () { 448 const scroll = window.scrollY || window.scrollTop || document.documentElement.scrollTop; 449 const docHeight = Math.max( 450 document.body.scrollHeight, 451 document.documentElement.scrollHeight, 452 document.body.offsetHeight, 453 document.documentElement.offsetHeight, 454 document.body.clientHeight, 455 document.documentElement.clientHeight 456 ); 457 const windowHeight = Math.max( 458 document.documentElement.clientHeight, 459 window.innerHeight || 0 460 ); 461 const height = docHeight - windowHeight; 462 const progress = (scroll / height) * 100; 463 progressbar.style.width = `${progress}%`; 464 }; 465 466 updateProgress(); 467 468 window.addEventListener('scroll', () => { 469 updateProgress(); 470 471 const scrollPos = window.scrollY || window.scrollTop || document.getElementsByTagName('html')[0].scrollTop; 472 if (scrollPos > offset) { 473 floatingHeader.classList.add(activeClass); 474 root.style.setProperty('--cs-floating-header-height', `${floatingHeader.offsetHeight}px`); 475 } else { 476 floatingHeader.classList.remove(activeClass); 477 root.style.setProperty('--cs-floating-header-height', `0px`); 478 } 479 }); 480 } 481 482} )(); 483 484})(); 485 486// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 487(() => { 488var __webpack_exports__ = {}; 489__webpack_require__.r(__webpack_exports__); 490/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 491/** ---------------------------------------------------------------------------- 492 * Footer Nav Menu */ 493 494 495 496(function () { 497 498 HTMLElement.prototype.responsiveNav = function () { 499 this.classList.remove('menu-item-expanded'); 500 let previousElement = this.previousElementSibling; 501 502 if (previousElement && previousElement.classList.contains('submenu-visible')) { 503 previousElement.classList.remove('submenu-visible'); 504 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideUp)(previousElement); 505 this.parentElement.classList.remove('menu-item-expanded'); 506 } else { 507 let parentOfParent = this.parentElement.parentElement; 508 509 parentOfParent.querySelectorAll('.menu-item .sub-menu').forEach(subMenu => { 510 subMenu.classList.remove('submenu-visible'); 511 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideUp)(subMenu); 512 }); 513 514 parentOfParent.querySelectorAll('.menu-item-expanded').forEach(item => { 515 item.classList.remove('menu-item-expanded'); 516 }); 517 518 if (previousElement) { 519 previousElement.classList.toggle('submenu-visible'); 520 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideToggle)(previousElement); 521 } 522 523 this.parentElement.classList.toggle('menu-item-expanded'); 524 } 525 }; 526 527 document.addEventListener('DOMContentLoaded', function () { 528 let menuItems = document.querySelectorAll('.cs-footer-columns__nav .menu-item-has-children'); 529
530 menuItems.forEach(menuItem => { 531 let span = document.createElement('span'); 532 menuItem.appendChild(span); 533 534 span.addEventListener('click', function (e) { 535 e.preventDefault(); 536 this.responsiveNav(); 537 }); 538 }); 539 }); 540 541})(); 542 543})(); 544 545// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 546(() => { 547var __webpack_exports__ = {}; 548__webpack_require__.r(__webpack_exports__); 549/** ---------------------------------------------------------------------------- 550 * Section toggles header panels and overlay */ 551 552(function () { 553 const body = document.body; 554 const headerElement = document.querySelector('.cs-header'); 555 const headerOverlay = document.querySelector('.cs-header-overlay'); 556 const searchToggles = document.querySelectorAll('.cs-header__search-toggle, .cs-search__close'); 557 const burgerToggles = document.querySelectorAll('.cs-header__burger-toggle'); 558 const moreToggles = document.querySelectorAll('.cs-header__more-toggle'); 559 560 searchToggles.forEach(searchToggle => { 561 searchToggle.addEventListener('click', function (e) { 562 e.preventDefault(); 563 564 if (body.classList.contains('cs-offcanvas-active')) { 565 body.classList.remove('cs-offcanvas-active'); 566 } 567 568 if (headerElement.classList.contains('cs-burger-visible')) { 569 headerElement.classList.remove('cs-burger-visible'); 570 body.classList.remove('cs-burger-active'); 571 } 572 573 if (headerElement.classList.contains('cs-more-visible')) { 574 headerElement.classList.remove('cs-more-visible'); 575 body.classList.remove('cs-more-active'); 576 } 577 578 headerElement.classList.toggle('cs-search-visible'); 579 body.classList.toggle('cs-search-active'); 580 }); 581 }); 582 583 burgerToggles.forEach(burgerToggle => { 584 burgerToggle.addEventListener('click', function (e) { 585 e.preventDefault(); 586 587 if (body.classList.contains('cs-offcanvas-active')) { 588 body.classList.remove('cs-offcanvas-active'); 589 } 590 591 if (headerElement.classList.contains('cs-search-visible')) { 592 headerElement.classList.remove('cs-search-visible'); 593 body.classList.remove('cs-search-active'); 594 } 595 596 if (headerElement.classList.contains('cs-more-visible')) { 597 headerElement.classList.remove('cs-more-visible'); 598 body.classList.remove('cs-more-active'); 599 } 600 601 headerElement.classList.toggle('cs-burger-visible'); 602 body.classList.toggle('cs-burger-active'); 603 }); 604 }); 605 606 moreToggles.forEach(moreToggle => { 607 moreToggle.addEventListener('click', function (e) { 608 e.preventDefault(); 609 610 if (body.classList.contains('cs-offcanvas-active')) { 611 body.classList.remove('cs-offcanvas-active'); 612 } 613 614 if (headerElement.classList.contains('cs-search-visible')) { 615 headerElement.classList.remove('cs-search-visible'); 616 body.classList.remove('cs-search-active'); 617 } 618 619 if (headerElement.classList.contains('cs-burger-visible')) { 620 headerElement.classList.remove('cs-burger-visible'); 621 body.classList.remove('cs-burger-active'); 622 } 623 624 headerElement.classList.toggle('cs-more-visible'); 625 body.classList.toggle('cs-more-active'); 626 }); 627 }); 628 629 if ( headerOverlay ) { 630 headerOverlay.addEventListener('click', function (e) { 631 e.preventDefault(); 632 633 if (headerElement.classList.contains('cs-search-visible')) { 634 headerElement.classList.remove('cs-search-visible'); 635 body.classList.remove('cs-search-active'); 636 } 637 638 if (headerElement.classList.contains('cs-burger-visible')) { 639 headerElement.classList.remove('cs-burger-visible'); 640 body.classList.remove('cs-burger-active'); 641 } 642 643 if (headerElement.classList.contains('cs-more-visible')) { 644 headerElement.classList.remove('cs-more-visible'); 645 body.classList.remove('cs-more-active'); 646 } 647 }); 648 } 649 650})(); 651 652})(); 653 654// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 655(() => { 656var __webpack_exports__ = {}; 657__webpack_require__.r(__webpack_exports__); 658/** ---------------------------------------------------------------------------- 659 * Header Scroll Scheme */ 660 661document.addEventListener('DOMContentLoaded', function () { 662 663 let transitionTimer; 664 665 document.addEventListener('nav-stick', function (event) { 666 if (document.body.classList.contains('cs-display-header-overlay')) { 667 668 let headerSmart = document.querySelector('.cs-navbar-smart-enabled .cs-header, .cs-navbar-sticky-enabled .cs-header'); 669 let headerAlt = headerSmart.querySelector('.cs-container'); 670 671 headerAlt.classList.add("cs-header-elements-no-transition"); 672 673 clearTimeout(transitionTimer); 674 675 transitionTimer = setTimeout(function () { 676 headerAlt.classList.remove("cs-header-elements-no-transition"); 677 }, 300); 678 } 679 }); 680 681 document.addEventListener('nav-unstick', function (event) { 682 if (document.body.classList.contains('cs-display-header-overlay')) { 683 684 let headerSmart = document.querySelector('.cs-navbar-smart-enabled .cs-header, .cs-navbar-sticky-enabled .cs-header'); 685 let headerAlt = headerSmart.querySelector('.cs-container'); 686 687 headerAlt.classList.add("cs-header-elements-no-transition"); 688 689 clearTimeout(transitionTimer); 690 691 transitionTimer = setTimeout(function () { 692 headerAlt.classList.remove("cs-header-elements-no-transition"); 693 }, 300); 694 } 695 }); 696 697}); 698 699}
699)(); 700 701// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 702(() => { 703var __webpack_exports__ = {}; 704__webpack_require__.r(__webpack_exports__); 705/** ---------------------------------------------------------------------------- 706 * Header Smart Streatch */ 707 708document.addEventListener('DOMContentLoaded', function () { 709 710 document.addEventListener('header-smart-stretch-scroll-sticky-scroll-init', function (event) { 711 let headerParams = event.detail; 712 713 window.addEventListener('scroll', function () { 714 let scrolled = window.scrollY; 715 716 let headerSmart = document.querySelector('.cs-navbar-smart-enabled .cs-header, .cs-navbar-sticky-enabled .cs-header'); 717 headerParams.headerSmartPosition = headerSmart ? headerSmart.offsetTop : 0; 718 719 if (scrolled > headerParams.smartStart + headerParams.scrollPoint + 10 && scrolled > headerParams.scrollPrev) { 720 if (scrolled > headerParams.smartStart + headerParams.headerLargeHeight + 200) { 721 document.dispatchEvent(new CustomEvent('sticky-nav-hide', { detail: headerParams })); 722 } 723 } else { 724 if (headerParams.scrollUpAmount >= headerParams.scrollPoint || scrolled === 0) { 725 document.dispatchEvent(new CustomEvent('sticky-nav-visible', { detail: headerParams })); 726 } 727 } 728 729 if (scrolled > headerParams.smartStart + headerParams.headerLargeHeight) { 730 document.dispatchEvent(new CustomEvent('nav-stick', { detail: headerParams })); 731 } else if (headerParams.headerSmartPosition <= headerParams.smartStart) { 732 document.dispatchEvent(new CustomEvent('nav-unstick', { detail: headerParams })); 733 } 734 735 if (scrolled < headerParams.scrollPrev) { 736 headerParams.scrollUpAmount += headerParams.scrollPrev - scrolled; 737 } else { 738 headerParams.scrollUpAmount = 0; 739 } 740 741 let wpAdminBar = document.querySelector('#wpadminbar'); 742 if (wpAdminBar && window.innerWidth <= 600 && scrolled >= headerParams.wpAdminBarHeight) { 743 document.dispatchEvent(new CustomEvent('adminbar-mobile-scrolled', { detail: headerParams })); 744 } else { 745 document.dispatchEvent(new CustomEvent('adminbar-mobile-no-scrolled', { detail: headerParams })); 746 } 747 748 headerParams.scrollPrev = scrolled; 749 }); 750 751 }); 752 753}); 754 755})(); 756 757// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 758(() => { 759var __webpack_exports__ = {}; 760__webpack_require__.r(__webpack_exports__); 761/** 762 * AJAX Load More. 763 * 764 * Contains functions for AJAX Load More. 765 */ 766 767if (typeof window.load_more_query === 'undefined') { 768 window.load_more_query = []; 769} 770 771// Get next posts 772function csco_ajax_get_posts(object) { 773 let container = object.closest('.cs-posts-area'); 774 let settings = JSON.parse(object.dataset.settings); 775 let page = parseInt(object.dataset.page); 776 777 object.dataset.loading = true; 778 779 // Set button text to Loading. 780 let innerSpan = object.querySelector('span'); 781 if (innerSpan) { 782 innerSpan.childNodes[0].textContent = settings.translation.loading; 783 innerSpan.childNodes[1].textContent = settings.translation.loading; 784 } 785 786 let data = { 787 action: 'csco_ajax_load_more', 788 page: page, 789 posts_per_page: settings.posts_per_page, 790 query_data: settings.query_data, 791 attributes: settings.attributes, 792 options: settings.options, 793 _ajax_nonce: settings.nonce, 794 }; 795 796 if ( settings.hasOwnProperty('current_lang') && settings.current_lang ) { 797 data.current_lang = settings.current_lang; 798 } 799 if ( settings.hasOwnProperty('current_locale') && settings.current_locale ) { 800 data.current_locale = settings.current_locale; 801 } 802 803 // Request Url. 804 let csco_pagination_url = (settings.type === 'ajax_restapi') ? settings.rest_url : settings.url; 805 806 function encodeFormData(data) { 807 return Object.keys(data).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])).join('&'); 808 } 809 810 fetch(csco_pagination_url, { 811 method: 'POST', 812 body: encodeFormData(data), 813 headers: { 814 'Content-Type': 'application/x-www-form-urlencoded' 815 } 816 }) 817 .then(response => response.json()) 818 .then(res => { 819 if (res.success) { 820 let dataContent = document.createElement('div'); 821 dataContent.innerHTML = res.data.content; 822 823 if (dataContent.children.length) { 824 // WP Post Load trigger. This might need more logic for your specific use-case. 825 document.body.dispatchEvent(new Event('post-load')); 826 827 // Reinit Facebook widgets. 828 if (document.querySelector('#fb-root') && typeof FB !== 'undefined') { 829 FB.XFBML.parse(); 830 } 831 832 // Set button text to Load More. 833 if (innerSpan) { 834 innerSpan.childNodes[0].textContent = settings.translation.load_more; 835 innerSpan.childNodes[1].textContent = settings.translation.load_more; 836 } 837 838 // Increment a page. 839 page += 1; 840 841 object.dataset.page = page.toString(); 842 843 // Reset the loading state. 844 object.dataset.loading = "false"; 845 846 // Append new content to the container 847 let mainContainer = container.querySelector('.cs-posts-area__main'); 848 while (dataContent.firstChild) { 849 mainContainer.appendChild(dataContent.firstChild); 850 } 851 } 852 853 // Remove Button on Posts End. 854 if (res.data.posts_end) { 855 // Remove Load More button. 856 object.parentNode.removeChild(object); 857 } 858 } 859 }) 860 .catch(error => { 861 console.error('Error fetching posts:', error); 862 }); 863} 864 865function csco_load_more_init(infinite) { 866 let areas = document.querySelectorAll('.cs-posts-area'); 867 areas.forEach(area => { 868 if (area.dataset.init) { 869 return; 870 } 871 872 let csco_ajax_settings; 873 let archive_data = area.dataset.postsArea; 874 875 if (archive_data) { 876 csco_ajax_settings = JSON.parse(window.atob(archive_data)); 877 } else if (typeof csco_ajax_pagination !== 'undefined' && typeof archive_data === 'undefined') { 878 csco_ajax_settings = csco_ajax_pagination; 879 } 880 881 if (csco_ajax_settings) { 882 if (!infinite && csco_ajax_settings.infinite_load) { 883 return; 884 } 885 886 let pagination = document.createElement('div'); 887 pagination.className = 'cs-posts-area__pagination'; 888 889 let btn = document.createElement('button'); 890 891 // Render animated button. 892 btn.className = 'cs-load-more cs-button-animated'; 893 let innerSpan = document.createElement('span'); 894 let textSpan = document.createElement('span'); 895 textSpan.textContent = csco_ajax_settings.translation.load_more; 896 innerSpan.appendChild(textSpan); 897 innerSpan.appendChild(textSpan.cloneNode(true)); 898 btn.appendChild(innerSpan); 899 900 pagination.appendChild(btn); 901 area.appendChild(pagination); 902 903 btn.dataset.settings = JSON.stringify(csco_ajax_settings); 904 btn.dataset.page = '2'; 905 btn.dataset.loading = "false"; 906 btn.dataset.scrollHandling = JSON.stringify({ 907 allow: JSON.parse(csco_ajax_settings.infinite_load), 908 delay: 400 909 }); 910 } 911 912 area.dataset.init = true; 913 }); 914} 915 916csco_load_more_init(true); 917 918// Elementor Init 919window.addEventListener('elementor/frontend/init', function () { 920 csco_load_more_init(true); 921}); 922 923// On Scroll Event. 924window.addEventListener('scroll', function () { 925 let buttons = document.querySelectorAll('.cs-posts-area .cs-load-more'); 926 buttons.forEach(btn => { 927 let loading = btn.dataset.loading === "true"; 928 let scrollHandling = JSON.parse(btn.dataset.scrollHandling || '{}'); 929 930 if (loading || !scrollHandling.allow) { 931 return; 932 } 933 934 scrollHandling.allow = false;
935 btn.dataset.scrollHandling = JSON.stringify(scrollHandling); 936 937 setTimeout(function () { 938 scrollHandling.allow = true; 939 940 btn.dataset.scrollHandling = JSON.stringify(scrollHandling); 941 }, scrollHandling.delay); 942 943 let offset = btn.getBoundingClientRect().top - window.innerHeight; 944 945 if (offset < 4000) { 946 csco_ajax_get_posts(btn); 947 } 948 }); 949}); 950 951// On Click Event. 952document.body.addEventListener('click', function (event) { 953 if (event.target.classList.contains('cs-load-more')) { 954 let loading = event.target.dataset.loading === "true"; 955 956 if (!loading) { 957 csco_ajax_get_posts(event.target); 958 } 959 } 960}); 961 962})(); 963 964// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 965(() => { 966var __webpack_exports__ = {}; 967__webpack_require__.r(__webpack_exports__); 968/** 969 * AJAX Load Nextpost. 970 * 971 * Contains functions for AJAX Load Nextpost. 972 */ 973 974if (typeof csco_ajax_nextpost !== 'undefined') { 975 976 var objNextparent = document.querySelector('.cs-site-primary > .cs-site-content'); 977 var objNextsect = '.cs-nextpost-section'; 978 var objNextpost = null; 979 var currentNTitle = document.title; 980 var currentNLink = window.location.href; 981 var loadingNextpost = false; 982 var scrollNextpost = { 983 allow: true, 984 reallow: function () { 985 scrollNextpost.allow = true; 986 }, 987 delay: 400 //(milliseconds) adjust to the highest acceptable value 988 }; 989 990 // Init. 991 if (csco_ajax_nextpost.next_post) { 992 objNextparent.insertAdjacentHTML('afterend', '<div class="cs-nextpost-inner"></div>'); 993 objNextpost = document.querySelector('.cs-nextpost-inner'); 994 } 995 996 // Remove previous & next post elements from the Floating Header. 997 var floatingHeader = document.querySelector('.cs-floating-header__content'); 998 if (floatingHeader) { 999 var nextElement = floatingHeader.querySelector('.cs-floating-header__next'); 1000 if (nextElement) { 1001 nextElement.remove(); 1002 } 1003 var prevElement = floatingHeader.querySelector('.cs-floating-header__prev'); 1004 if (prevElement) { 1005 prevElement.remove(); 1006 } 1007 var currentElement = floatingHeader.querySelector('.cs-floating-header__current'); 1008 if (currentElement) { 1009 currentElement.classList.add('fullwidth'); 1010 } 1011 } 1012} 1013 1014/** 1015 * Update Floating Header 1016 */ 1017function updateFloatingHeader(title) { 1018 var floatingHeader = document.querySelector('.cs-floating-header__content'); 1019 1020 if (floatingHeader && title) { 1021 var currentPostTitle = floatingHeader.querySelector('.cs-floating-header__current span'); 1022 if (currentPostTitle) { 1023 currentPostTitle.textContent = title || ''; // Fallback to empty string if title is missing 1024 } 1025 } 1026} 1027 1028/** 1029 * Get next post 1030 */ 1031function csco_ajax_get_nextpost() { 1032 loadingNextpost = true; 1033 1034 // Set class loading. 1035 var data = { 1036 action: 'csco_ajax_load_nextpost', 1037 not_in: csco_ajax_nextpost.not_in, 1038 current_user: csco_ajax_nextpost.current_user, 1039 nonce: csco_ajax_nextpost.nonce, 1040 next_post: csco_ajax_nextpost.next_post, 1041 }; 1042 1043 if ( csco_ajax_nextpost.hasOwnProperty('current_lang') && csco_ajax_nextpost.current_lang ) { 1044 data.current_lang = csco_ajax_nextpost.current_lang; 1045 } 1046 if ( csco_ajax_nextpost.hasOwnProperty('current_locale') && csco_ajax_nextpost.current_locale ) { 1047 data.current_locale = csco_ajax_nextpost.current_locale; 1048 } 1049 1050 // Request Url. 1051 var csco_ajax_nextpost_url; 1052 if ('ajax_restapi' === csco_ajax_nextpost.type) { 1053 csco_ajax_nextpost_url = csco_ajax_nextpost.rest_url; 1054 } else { 1055 csco_ajax_nextpost_url = csco_ajax_nextpost.url; 1056 } 1057 1058 function encodeFormData(data) { 1059 return Object.keys(data).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])).join('&'); 1060 } 1061 1062 // Send Request. 1063 fetch(csco_ajax_nextpost_url, { 1064 method: 'POST', 1065 body: encodeFormData(data), 1066 headers: { 1067 'Content-Type': 'application/x-www-form-urlencoded' 1068 } 1069 }) 1070 .then(response => response.json()) 1071 .then(res => { 1072 csco_ajax_nextpost.next_post = false; 1073 1074 if (res.success) { 1075 // Get the posts. 1076 var tempDiv = document.createElement('div'); 1077 tempDiv.innerHTML = res.data.content; 1078 var newPosts = Array.from(tempDiv.children); 1079 1080 // Check if there're any posts. 1081 if (newPosts.length) { 1082 // Set the loading state. 1083 loadingNextpost = false;
1084 1085 // Set not_in. 1086 csco_ajax_nextpost.not_in = res.data.not_in; 1087 1088 // Set next data. 1089 csco_ajax_nextpost.next_post = res.data.next_post; 1090 1091 // Remove loader. 1092 var loadingElement = objNextpost.nextElementSibling; 1093 if (loadingElement && loadingElement.classList.contains('cs-nextpost-loading')) { 1094 loadingElement.remove(); 1095 } 1096 1097 // Append new post. 1098 newPosts.forEach(post => objNextpost.appendChild(post.cloneNode(true))); 1099 1100 // Update Floating Header with the new title. 1101 if (objNextpost.children.length === newPosts.length) { 1102 updateFloatingHeader(res.data.title || ''); 1103 } 1104 1105 if (document.getElementById('fb-root') && typeof FB === 'object') { 1106 FB.XFBML.parse(); 1107 } 1108 1109 document.body.dispatchEvent(new Event('post-load')); 1110 } 1111 } else { 1112 // console.log(res); 1113 } 1114 }) 1115 .catch(error => { 1116 // console.log(error); 1117 }); 1118} 1119 1120/** 1121 * Check if Load Nextpost is defined by the wp_localize_script 1122 */ 1123if (typeof csco_ajax_nextpost !== 'undefined') { 1124 1125 // On Scroll Event. 1126 window.addEventListener('scroll', function () { 1127 var scrollTop = window.scrollY || window.pageYOffset; 1128 1129 // Init nextpost. 1130 if (csco_ajax_nextpost.next_post) { 1131 1132 if (objNextpost && !loadingNextpost && scrollNextpost.allow) { 1133 scrollNextpost.allow = false; 1134 setTimeout(scrollNextpost.reallow, scrollNextpost.delay); 1135 // Calc current offset. 1136 var offset = objNextpost.offsetTop + objNextpost.offsetHeight - scrollTop; 1137 // Load nextpost. 1138 if (4000 > offset) { 1139 objNextpost.insertAdjacentHTML('afterend', '<div class="cs-nextpost-loading"></div>'); 1140 1141 csco_ajax_get_nextpost(); 1142 } 1143 } 1144 } 1145 1146 // Reset browser data link. 1147 var objFirst = document.querySelector(objNextsect + ':first-child'); 1148 1149 if (objFirst) { 1150 var firstTop = objFirst.offsetTop; 1151 // If there has been a change. 1152 if (scrollTop < firstTop && window.location.href !== currentNLink) { 1153 document.title = currentNTitle; 1154 history.pushState(null, currentNTitle, currentNLink); 1155 updateFloatingHeader(currentNTitle); // Update header when scrolling back to the top 1156 } 1157 } 1158 1159 // Set browser data link. 1160 document.querySelectorAll(objNextsect).forEach(function (elem) { 1161 var elemTop = elem.offsetTop; 1162 var elemHeight = elem.offsetHeight; 1163 1164 if (scrollTop > elemTop && scrollTop < elemTop + elemHeight) { 1165 // If there has been a change. 1166 if (window.location.href !== elem.dataset.url) { 1167 // New title. 1168 document.title = elem.dataset.title; 1169 // New link. 1170 history.pushState(null, elem.dataset.title, elem.dataset.url); 1171 1172 // Update Floating Header with the new title. 1173 updateFloatingHeader(elem.dataset.title); 1174 1175 // Google Analytics. 1176 if (typeof gtag === 'function' && typeof window.gaData === 'object') { 1177 var trackingId = Object.keys(window.gaData)[0]; 1178 if (trackingId) { 1179 gtag('config', trackingId, { 1180 'page_title': elem.dataset.title, 1181 'page_location': elem.dataset.url 1182 }); 1183 1184 gtag('event', 'page_view', { 1185 'send_to': trackingId 1186 }); 1187 } 1188 } 1189 } 1190 } 1191 }); 1192 }); 1193} 1194 1195})(); 1196 1197// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1198(() => { 1199var __webpack_exports__ = {}; 1200__webpack_require__.r(__webpack_exports__); 1201/** ---------------------------------------------------------------------------- 1202 * MailerLite Notification */ 1203 1204document.addEventListener('DOMContentLoaded', function() { 1205 // Check for mailerlite forms on the page 1206 document.querySelectorAll('.cs-subscribe__form').forEach(function(form) { 1207 var actionUrl = form.getAttribute('action'); 1208 1209 // Apply only to MailerLite forms 1210 if (actionUrl && actionUrl.indexOf('assets.mailerlite.com') !== -1) { 1211 // Create notification element 1212 var notification = document.createElement('div'); 1213 notification.className = 'cs-form-notification'; 1214 notification.style.display = 'none'; 1215 form.parentNode.insertBefore(notification, form.nextSibling); 1216 1217 // Add submit event listener 1218 form.addEventListener('submit', function(e) { 1219 e.preventDefault(); 1220 1221 // Disable form elements during submission
1222 Array.from(form.elements).forEach(el => el.disabled = true); 1223 1224 // Show processing message 1225 notification.textContent = csLocalize.subscribeProcess; 1226 notification.style.display = 'block'; 1227 notification.className = 'cs-form-notification cs-form-processing'; 1228 1229 // Get form data - special handling for MailerLite 1230 var formData = new FormData(); 1231 1232 // Find the email input and add it with correct name 1233 var emailInput = form.querySelector('input[type="email"]'); 1234 if (emailInput) { 1235 formData.append('fields[email]', emailInput.value); 1236 } 1237 1238 // Add all other form fields 1239 Array.from(form.elements).forEach(el => { 1240 if (el.name && el.name !== 'email' && el.name !== 'fields[email]' && el.type !== 'submit') { 1241 formData.append(el.name, el.value); 1242 } 1243 }); 1244 1245 // Send form data 1246 fetch(actionUrl, { 1247 method: 'POST', 1248 body: formData 1249 }) 1250 .then(response => response.json()) 1251 .then(data => { 1252 // Re-enable form elements 1253 Array.from(form.elements).forEach(el => el.disabled = false); 1254 1255 if (data.success) { 1256 // Success case 1257 form.reset(); 1258 notification.textContent = csLocalize.subscribeSuccess; 1259 notification.className = 'cs-form-notification cs-form-success'; 1260 1261 setTimeout(() => { 1262 notification.classList.add('hide'); 1263 }, 1500); 1264 1265 setTimeout(() => { 1266 notification.remove(); 1267 }, 2000); 1268 } else { 1269 // Error case with response details 1270 var errorMsg = csLocalize.subscribeError; 1271 1272 // Try to extract error message if available 1273 if (data.errors && data.errors.fields) { 1274 var fieldErrors = []; 1275 for (var field in data.errors.fields) { 1276 if (data.errors.fields[field] && data.errors.fields[field].length) { 1277 fieldErrors.push(data.errors.fields[field][0]); 1278 } 1279 } 1280 if (fieldErrors.length) { 1281 errorMsg = fieldErrors.join(', '); 1282 } 1283 } 1284 1285 notification.textContent = errorMsg; 1286 notification.className = 'cs-form-notification cs-form-error'; 1287 console.log('Form error:', data); 1288 } 1289 }) 1290 .catch(error => { 1291 // Re-enable form elements 1292 Array.from(form.elements).forEach(el => el.disabled = false); 1293 1294 // General error handling 1295 notification.textContent = csLocalize.subscribeError; 1296 notification.className = 'cs-form-notification cs-form-error'; 1297 console.error('Error:', error); 1298 }); 1299 }); 1300 } 1301 }); 1302}); 1303 1304})(); 1305 1306// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1307(() => { 1308var __webpack_exports__ = {}; 1309__webpack_require__.r(__webpack_exports__); 1310/** ---------------------------------------------------------------------------- 1311 * Mega Menu */ 1312 1313document.addEventListener('DOMContentLoaded', function () { 1314 function loadMenuPosts(menuItem) { 1315 var dataTerm = menuItem.children[0].dataset.term, 1316 dataPosts = menuItem.children[0].dataset.posts, 1317 dataNumberposts = menuItem.children[0].dataset.numberposts, 1318 menuContainer, 1319 postsContainer; 1320 1321 // Containers. 1322 if (menuItem.classList.contains('cs-mega-menu-term') || menuItem.classList.contains('cs-mega-menu-posts')) { 1323 menuContainer = menuItem; 1324 postsContainer = menuContainer.querySelector('.cs-mm__posts'); 1325 } 1326 1327 if (menuItem.classList.contains('cs-mega-menu-child-term')) { 1328 menuContainer = menuItem.closest('.sub-menu'); 1329 postsContainer = menuContainer.querySelector('.cs-mm__posts[data-term="' + dataTerm + '"]'); 1330 } 1331 1332 // Check Menu Container. 1333 if (!menuContainer || typeof menuContainer === 'undefined') { 1334 return false; 1335 } 1336 1337 // Check Container. 1338 if (!postsContainer || typeof postsContainer === 'undefined') { 1339 return false; 1340 } 1341 1342 // Set Active. 1343 menuContainer.querySelectorAll('.menu-item, .cs-mm__posts').forEach(function (el) { 1344 el.classList.remove('cs-active-item'); 1345 }); 1346 1347 menuItem.classList.add('cs-active-item'); 1348 if (postsContainer) { 1349 postsContainer.classList.add('cs-active-item'); 1350 } 1351 1352 // Check Loading. 1353 if (menuItem.classList.contains('cs-mm-loading') || menuItem.classList.contains('loaded')) { 1354 return false; 1355 } 1356 1357 // Create Data. 1358 var data = { 1359 'term': dataTerm, 1360 'posts': dataPosts, 1361 'per_page': dataNumberposts 1362 }; 1363 1364 if (typeof csco_mega_menu === 'undefined') { 1365 return; 1366 } 1367 1368 // Get Results using fetch. 1369 menuItem.classList.add('cs-mm-loading'); 1370 postsContainer.classList.add('cs-mm-loading'); 1371 1372 function encodeFormData(data) { 1373 return Object.keys(data).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])).join('&'); 1374 } 1375 1376 // fetch(csco_mega_menu.rest_url) 1377 fetch(csco_mega_menu.rest_url, { 1378 method: 'POST', 1379 body: encodeFormData(data), 1380 headers: { 1381 'Content-Type': 'application/x-www-form-urlencoded' 1382 } 1383 }) 1384 .then(response => response.json()) 1385 .then(res => { 1386 if (res.status && 'success' === res.status) { 1387 // Set the loaded state. 1388 menuItem.classList.add('loaded'); 1389 postsContainer.classList.add('loaded'); 1390 1391 // Check if there're any posts. 1392 if (res.content && res.content.length) { 1393 postsContainer.innerHTML = res.content; 1394 imagesLoaded(postsContainer, function () { 1395 // Append Data. 1396 }); 1397 } 1398 } 1399 }) 1400 .catch(error => { 1401 // Handle errors. 1402 }) 1403 .finally(() => { 1404 // Set the loading state. 1405 menuItem.classList.remove('cs-mm-loading'); 1406 postsContainer.classList.remove('cs-mm-loading'); 1407 }); 1408 } 1409 1410 function getFirstTab(container) { 1411 var firstTab = false;
1412 1413 container.querySelectorAll('.cs-mega-menu-child').forEach(function (el) { 1414 if ( ! firstTab && el.classList.contains('cs-mega-menu-child')) { 1415 firstTab = el; 1416 } 1417 }); 1418 1419 return firstTab; 1420 } 1421 1422 function handleMenuHover(event) { 1423 var menuItem = event.currentTarget; 1424 1425 if (menuItem.classList.contains('cs-mega-menu-posts') || 1426 menuItem.classList.contains('cs-mega-menu-term') || 1427 menuItem.classList.contains('cs-mega-menu-child')) { 1428 loadMenuPosts(menuItem); 1429 } 1430 } 1431 1432 function handleTermsHover(event) { 1433 var menuItem = event.currentTarget; 1434 var tab = getFirstTab(menuItem); 1435 1436 if (tab) { 1437 loadMenuPosts(tab); 1438 } 1439 } 1440 1441 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-posts').forEach(function (menuItem) { 1442 menuItem.addEventListener('mouseenter', handleMenuHover); 1443 }); 1444 1445 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-term').forEach(function (menuItem) { 1446 menuItem.addEventListener('mouseenter', handleMenuHover); 1447 }); 1448 1449 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-child').forEach(function (menuItem) { 1450 menuItem.addEventListener('mouseenter', handleMenuHover); 1451 }); 1452 1453 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-terms').forEach(function (menuItem) { 1454 menuItem.addEventListener('mouseenter', handleTermsHover); 1455 }); 1456 1457 // Load First Tab on Navbar Ready. 1458 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-terms').forEach(function (menuItem) { 1459 var tab = getFirstTab(menuItem); 1460 1461 if (tab) { 1462 loadMenuPosts(tab); 1463 } 1464 }); 1465 1466 // Autoload Posts. 1467 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-posts').forEach(function (menuItem) { 1468 loadMenuPosts(menuItem); 1469 }); 1470 1471 // Autoload Term. 1472 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-term').forEach(function (menuItem) { 1473 loadMenuPosts(menuItem); 1474 }); 1475}); 1476 1477})(); 1478 1479// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1480(() => { 1481var __webpack_exports__ = {}; 1482__webpack_require__.r(__webpack_exports__); 1483/** ---------------------------------------------------------------------------- 1484 * Woocommerce Myaccount Tabs */ 1485 1486( function() { 1487 1488 document.addEventListener('DOMContentLoaded', function() { 1489 const accountLinks = document.querySelectorAll('.woocommerce-account-no-logged .woocommerce-MyAccount-navigation a'); 1490 const loginForm = document.querySelector('.woocommerce-form-login'); 1491 const registerForm = document.querySelector('.woocommerce-form-register'); 1492 1493 accountLinks.forEach(link => { 1494 link.addEventListener('click', function(e) { 1495 e.preventDefault(); 1496 1497 accountLinks.forEach(l => l.parentElement.classList.remove('is-active')); 1498 1499 link.parentElement.classList.add('is-active'); 1500 1501 // Toggle forms based on the clicked link's href attribute. 1502 if (link.getAttribute('href') === '#register') { 1503 loginForm.style.display = 'none'; 1504 registerForm.style.display = 'block'; 1505 } else { 1506 loginForm.style.display = 'block'; 1507 registerForm.style.display = 'none'; 1508 } 1509 }); 1510 }); 1511 }); 1512 1513} )(); 1514 1515})(); 1516 1517// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1518(() => { 1519var __webpack_exports__ = {}; 1520__webpack_require__.r(__webpack_exports__); 1521/** ---------------------------------------------------------------------------- 1522 * Navigation */ 1523 1524class CscoNavigation { 1525 constructor() { 1526 this.headerParams = { 1527 headerLargeHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-initial-height')), 1528 headerCompactHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height')), 1529 headerSmart: document.querySelector('.cs-navbar-smart-enabled .cs-header, .cs-navbar-sticky-enabled .cs-header'), 1530 wpAdminBar: document.querySelector('#wpadminbar'), 1531 headerBefore: document.querySelector('.cs-header-before'), 1532 headerStretch: document.querySelector('.cs-navbar-smart-enabled .cs-header-stretch'), 1533 wpAdminBarHeight: null, 1534 smartStart: null, 1535 scrollPoint: 200, 1536 scrollPrev: 200, 1537 scrollUpAmount: 0, 1538 headerSmartPosition: 0 1539 }; 1540 1541 this.initialize(); 1542 } 1543 1544 initialize() { 1545 if (document.body.classList.contains('wp-admin')) { 1546 return; 1547 } 1548 this.bindEvents(); 1549 } 1550 1551 bindEvents() { 1552 document.addEventListener('DOMContentLoaded', () => { 1553 this.smartLevels(); 1554 this.adaptTablet(); 1555 this.stickyScroll(); 1556 this.headerClassesChange(); 1557 }); 1558 1559 window.addEventListener('resize', () => { 1560 this.smartLevels(); 1561 this.adaptTablet(); 1562 this.stickyScroll(); 1563 }); 1564 } 1565 1566 smartLevels() { 1567 let windowWidth = window.innerWidth; 1568 1569 // Reset Calc. 1570 document.querySelectorAll('.cs-header__nav-inner li').forEach(el => { 1571 el.classList.remove('cs-sm__level', 'cs-sm-position-left', 'cs-sm-position-right'); 1572 }); 1573 document.querySelectorAll('.cs-header__nav-inner li .sub-menu').forEach(el => { 1574 el.classList.remove('cs-mm__position-init'); 1575 }); 1576 1577 // Set Settings. 1578 document.querySelectorAll('.cs-header__nav-inner > li.menu-item:not(.cs-mm)').forEach(parent => { 1579 let position = 'cs-sm-position-right'; //default 1580 let objPrevWidth = 0; 1581 1582 parent.querySelectorAll('.sub-menu').forEach(el => { 1583 // Reset child levels. 1584 if (el.parentElement.nextElementSibling) { 1585 el.parentElement.nextElementSibling.classList.add('cs-sm__level'); 1586 } 1587 1588 if (el.parentElement.classList.contains('cs-sm__level')) { 1589 el.parentElement.classList.remove('cs-mm-level'); 1590 position = 'cs-sm-position-right'; //reset 1591 objPrevWidth = 0; 1592 } 1593 1594 // Find out position items. 1595 let offset = el.getBoundingClientRect().left; 1596 1597 if (position === 'cs-sm-position-right' && el.offsetWidth + offset > windowWidth) { 1598 position = 'cs-sm-position-left'; 1599 } 1600 1601 if (position === 'cs-sm-position-left' && offset - (el.offsetWidth + objPrevWidth) < 0) { 1602 position = 'cs-sm-position-right'; 1603 } 1604 1605 objPrevWidth = el.offsetWidth; 1606 1607 el.classList.add('cs-sm-position-init'); 1608 el.parentElement.classList.add(position); 1609 }); 1610 }); 1611 } 1612 1613 adaptTablet() { 1614 // Click outside. 1615 document.addEventListener('touchstart', (e) => { 1616 if (!e.target.closest('.cs-header__nav-inner')) { 1617 document.querySelectorAll('.cs-header__nav-inner .menu-item-has-children').forEach(el => { 1618 el.classList.remove('submenu-visible'); 1619 }); 1620 } else { 1621 let parentMenuItem = e.target.closest('.menu-item'); 1622 if (parentMenuItem) { 1623 if (parentMenuItem.previousElementSibling) { 1624 parentMenuItem.previousElementSibling.querySelectorAll('.menu-item').forEach(el => { 1625 el.classList.remove('submenu-visible'); 1626 }); 1627 } 1628 if (parentMenuItem.nextElementSibling) { 1629 parentMenuItem.nextElementSibling.classList.remove('submenu-visible'); 1630 } 1631 } 1632 } 1633 }); 1634 1635 document.querySelectorAll('.cs-header__nav-inner .menu-item-has-children').forEach(el => { 1636 // Reset class. 1637 el.classList.remove('submenu-visible'); 1638 1639 // Remove expanded if exists. 1640 let expandedElem = el.querySelector('a > .expanded'); 1641 if (expandedElem) { 1642 expandedElem.remove(); 1643 } 1644 1645 // Add a caret. 1646 if ('ontouchstart' in document.documentElement) { 1647 let aTag = el.querySelector('a'); 1648 if (aTag) { 1649 let span = document.createElement('span'); 1650 span.className = 'expanded'; 1651 aTag.appendChild(span); 1652 } 1653 } 1654 1655 // Check touch device. 1656 if ('ontouchstart' in document.documentElement) { 1657 el.classList.add('touch-device'); 1658 } 1659 1660 let expandedElement = el.querySelector('a .expanded'); 1661 if (expandedElement) { 1662 expandedElement.addEventListener('touchstart', (e) => { 1663 e.preventDefault(); 1664 el.classList.toggle('submenu-visible'); 1665 }, { passive: false }); 1666 } 1667 1668 let anchor = el.querySelector('a'); 1669 if (anchor && anchor.getAttribute('href') === '#') { 1670 anchor.addEventListener('touchstart', (e) => { 1671 e.preventDefault(); 1672 if (!e.target.classList.contains('expanded')) { 1673 el.classList.toggle('submenu-visible'); 1674 } 1675 }, { passive: false }); 1676 } 1677 }); 1678 } 1679 1680 stickyScroll() { 1681 this.headerParams = { 1682 headerLargeHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-initial-height')), 1683 headerCompactHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height')), 1684 headerSmart: document.querySelector('.cs-navbar-smart-enabled .cs-header, .cs-navbar-sticky-enabled .cs-header'), 1685 wpAdminBar: document.querySelector('#wpadminbar'), 1686 headerBefore: document.querySelector('.cs-header-before'), 1687 headerStretch: document.querySelector('.cs-navbar-smart-enabled .cs-header-stretch'), 1688 wpAdminBarHeight: null, 1689 smartStart: null, 1690 scrollPoint: 200, 1691 scrollPrev: 200, 1692 scrollUpAmount: 0, 1693 headerSmartPosition: 0 1694 }; 1695 1696 this.headerParams.wpAdminBarHeight = this.headerParams.wpAdminBar ? this.headerParams.wpAdminBar.offsetHeight : 0; 1697 1698 if (this.headerParams.headerBefore) { 1699 this.headerParams.smartStart = this.headerParams.headerBefore.offsetTop; 1700 } else { 1701 this.headerParams.smartStart = this.headerParams.wpAdminBarHeight + (this.headerParams.headerSmart ? this.headerParams.headerSmart.offsetTop : 0); 1702 } 1703 1704 window.addEventListener('scroll', () => { 1705 let scrolled = window.scrollY; 1706 this.headerParams.headerSmartPosition = this.headerParams.headerSmart ? this.headerParams.headerSmart.offsetTop : 0; 1707 1708 if (scrolled > this.headerParams.smartStart + this.headerParams.scrollPoint + 10 && scrolled > this.headerParams.scrollPrev) { 1709 if (scrolled > this.headerParams.smartStart + this.headerParams.headerCompactHeight + 200) { 1710 document.dispatchEvent(new Event('sticky-nav-hide')); 1711 } 1712 } else { 1713 if (this.headerParams.scrollUpAmount >= this.headerParams.scrollPoint || scrolled === 0) { 1714 document.dispatchEvent(new Event('sticky-nav-visible')); 1715 } 1716 } 1717 1718 if ( this.headerParams.headerSmart ) { 1719 if ( scrolled > this.headerParams.smartStart + this.headerParams.headerCompactHeight ) { 1720 1721 document.dispatchEvent(new Event('nav-stick', { detail: this.headerParams })); 1722 1723 } else if ( this.headerParams.headerSmartPosition <= this.headerParams.smartStart ) { 1724 document.dispatchEvent(new Event('nav-unstick', { detail: this.headerParams })); 1725 } 1726 } 1727 1728 if (scrolled < this.headerParams.scrollPrev) { 1729 this.headerParams.scrollUpAmount += this.headerParams.scrollPrev - scrolled; 1730 } else { 1731 this.headerParams.scrollUpAmount = 0; 1732 } 1733 1734 if (this.headerParams.wpAdminBar && window.innerWidth <= 600 && scrolled >= this.headerParams.wpAdminBarHeight) { 1735 document.dispatchEvent(new Event('adminbar-mobile-scrolled')); 1736 } else { 1737 document.dispatchEvent(new Event('adminbar-mobile-no-scrolled')); 1738 } 1739 1740 this.headerParams.scrollPrev = scrolled; 1741 }); 1742 } 1743 1744 headerClassesChange() { 1745 document.addEventListener("sticky-nav-visible", event => { 1746 this.headerParams.headerSmart.classList.add('cs-header-smart-visible'); 1747 }); 1748 1749 document.addEventListener("sticky-nav-hide", event => { 1750 this.headerParams.headerSmart.classList.remove('cs-header-smart-visible'); 1751 }); 1752 1753 document.addEventListener("nav-stick", event => { 1754 this.headerParams.headerSmart.classList.add('cs-scroll-sticky'); 1755 }); 1756 1757 document.addEventListener("nav-unstick", event => { 1758 this.headerParams.headerSmart.classList.remove('cs-scroll-sticky', 'cs-header-smart-visible'); 1759 }); 1760 1761 document.addEventListener("adminbar-mobile-scrolled", event => { 1762 document.body.classList.add('cs-adminbar-mobile-scrolled'); 1763 }); 1764 1765 document.addEventListener("adminbar-mobile-no-scrolled", event => { 1766 document.body.classList.remove('cs-adminbar-mobile-scrolled'); 1767 }); 1768 } 1769} 1770 1771new CscoNavigation(); 1772 1773})(); 1774 1775// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1776(() => { 1777var __webpack_exports__ = {}; 1778__webpack_require__.r(__webpack_exports__); 1779/** ---------------------------------------------------------------------------- 1780 * Offcanvas */ 1781 1782(function () { 1783 const body = document.body; 1784 const headerElement = document.querySelector('.cs-header'); 1785 const offcanvasToggles = document.querySelectorAll('.cs-header__offcanvas-toggle, .cs-site-overlay, .cs-offcanvas__close-toggle'); 1786
1787 offcanvasToggles.forEach(offcanvasToggle => { 1788 offcanvasToggle.addEventListener('click', function (e) { 1789 e.preventDefault(); 1790 1791 if (headerElement.classList.contains('cs-search-visible')) { 1792 headerElement.classList.remove('cs-search-visible'); 1793 body.classList.remove('cs-search-active'); 1794 } 1795 1796 if (headerElement.classList.contains('cs-burger-visible')) { 1797 headerElement.classList.remove('cs-burger-visible'); 1798 body.classList.remove('cs-burger-active'); 1799 } 1800 1801 if (!body.classList.contains('cs-offcanvas-active')) { 1802 body.classList.add('cs-offcanvas-transition'); 1803 } else { 1804 setTimeout(() => { 1805 body.classList.remove('cs-offcanvas-transition'); 1806 }, 400); 1807 } 1808 1809 body.classList.toggle('cs-offcanvas-active'); 1810 }); 1811 }); 1812 1813})(); 1814 1815})(); 1816 1817// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1818(() => { 1819var __webpack_exports__ = {}; 1820__webpack_require__.r(__webpack_exports__); 1821/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 1822/** ---------------------------------------------------------------------------- 1823 * Post Carousel */ 1824 1825 1826 1827(function () { 1828 1829 const section = 'cs-post-carousel'; 1830 const sliders = document.querySelectorAll(`.${section}`); 1831 1832 if (sliders.length === 0) { 1833 return; 1834 } 1835 1836 let executed = false; 1837 1838 const isSwiperScriptLoaded = function() { 1839 return typeof Swiper !== 'undefined'; 1840 }; 1841 1842 const initSwiper = function() {
1843 sliders.forEach(slider => { 1844 1845 // Section settings. 1846 const sectionType = slider.getAttribute('data-cs-type'); 1847 const slidesPerView = 'horizontal' === sectionType ? [1, 1, 2, 3, 3, 4] : [1, 2, 3, 3, 4, 4]; 1848 const spaceBetween = 'horizontal' === sectionType ? [0, 0, 24, 24, 24, 24] : [0, 20, 16, 24, 24, 24]; 1849 const loopValue = slider.getAttribute('data-cs-loop'); 1850 1851 // Swiper settings. 1852 const wrapperClass = `${section}__grid`; 1853 const slideClass = `${section}__item`; 1854 const prevEl = slider.querySelector(`.${section}__button-prev`); 1855 const nextEl = slider.querySelector(`.${section}__button-next`); 1856 let number = 0; 1857 let loop = false; 1858 let rewind = false; 1859 1860 const wrapper = slider.querySelector(`.${wrapperClass}`); 1861 1862 if (wrapper) { 1863 const slides = wrapper.querySelectorAll(`.${slideClass}`); 1864 number = slides.length; 1865 } 1866 1867 if ( 'true' === loopValue ) { 1868 if ( number > 7) { 1869 loop = true; 1870 } else { 1871 rewind = true; 1872 } 1873 } 1874 1875 new Swiper(slider, { 1876 scrollbar: false, 1877 wrapperClass: wrapperClass, 1878 slideClass: slideClass, 1879 direction: 'horizontal', 1880 loop: loop, 1881 rewind: rewind, 1882 speed: 250, 1883 parallax: false, 1884 autoplay: false, 1885 navigation: { 1886 nextEl: nextEl, 1887 prevEl: prevEl, 1888 }, 1889 breakpoints: { 1890 320: { 1891 slidesPerView: slidesPerView[0], 1892 spaceBetween: spaceBetween[0] 1893 }, 1894 576: { 1895 slidesPerView: slidesPerView[1], 1896 spaceBetween: spaceBetween[1] 1897 }, 1898 768: { 1899 slidesPerView: slidesPerView[2], 1900 spaceBetween: spaceBetween[2] 1901 }, 1902 992: { 1903 slidesPerView: slidesPerView[3], 1904 spaceBetween: spaceBetween[3] 1905 }, 1906 1200: { 1907 slidesPerView: slidesPerView[4], 1908 spaceBetween: spaceBetween[4] 1909 }, 1910 1448: { 1911 slidesPerView: slidesPerView[5], 1912 spaceBetween: spaceBetween[5] 1913 }, 1914 }, 1915 }); 1916 }); 1917 }; 1918 1919 const initSection = function () { 1920 if (!executed) { 1921 const options = { 1922 root: null, 1923 threshold: 0.5 1924 }; 1925 1926 const observer = new IntersectionObserver((entries) => { 1927 entries.forEach(entry => { 1928 if (entry.isIntersecting) { 1929 executed = true; 1930 initSwiper(); 1931 observer.disconnect(); 1932 } 1933 }); 1934 }, options); 1935
1936 sliders.forEach(slider => { 1937 observer.observe(slider); 1938 }); 1939 } 1940 }; 1941 1942 document.addEventListener('DOMContentLoaded', () => { 1943 initSection(); 1944 }); 1945 1946})(); 1947 1948})(); 1949 1950// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1951(() => { 1952var __webpack_exports__ = {}; 1953__webpack_require__.r(__webpack_exports__); 1954/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 1955/** ---------------------------------------------------------------------------- 1956 * Posts Slider */ 1957 1958 1959 1960(function () { 1961 1962 const section = 'cs-post-slider'; 1963 const sliders = document.querySelectorAll(`.${section}__slider`); 1964 1965 if (sliders.length === 0) { 1966 return; 1967 } 1968 1969 let executed = false; 1970 1971 const initSection = function() { 1972 if (!executed && (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.isInViewport)(sliders[0])) { 1973 executed = true; 1974 1975 sliders.forEach(slider => { 1976 // Section data 1977 const sectionType = slider.getAttribute('data-cs-type'); 1978 const autoplayValue = slider.getAttribute('data-cs-autoplay'); 1979 const autoplayDelayValue = slider.getAttribute('data-cs-autoplay-delay'); 1980 1981 // Swiper settings 1982 const wrapperClass = `${section}__wrapper`; 1983 const slideClass = `${section}__item`; 1984 const prevEl = slider.querySelector(`.${section}__button-prev span`); 1985 const nextEl = slider.querySelector(`.${section}__button-next span`); 1986 let paginationContainer = slider.querySelector(`.${section}__pagination`); 1987 const bulletClass = `${section}__pagination-bullet`; 1988 const bulletClassActive = `${section}__pagination-bullet-active`; 1989 const slidesPerView = 'type-1' === sectionType ? 1 : 1.37; 1990 const gap320 = 'type-1' === sectionType ? 0 : 0; 1991 const gap576 = 'type-1' === sectionType ? 24 : 0; 1992 const gap992 = 'type-1' === sectionType ? 24 : -2; 1993 const autoplayDelay = !isNaN(parseInt(autoplayDelayValue)) ? parseInt(autoplayDelayValue) : 5000; 1994 const autoplay = autoplayValue ? { delay: autoplayDelay, disableOnInteraction: false, pauseOnMouseEnter: true, } : false; 1995 1996 // Remove pagination container for screens 992px and above 1997 if (window.innerWidth >= 992 && paginationContainer) { 1998 paginationContainer.remove(); 1999 paginationContainer = null; 2000 } 2001 2002 new Swiper(slider, { 2003 scrollbar: false, 2004 wrapperClass: wrapperClass, 2005 slideClass: slideClass, 2006 direction: 'horizontal', 2007 loop: true, 2008 speed: 800, 2009 parallax: false, 2010 autoplay: autoplay, 2011 a11y: { 2012 slideRole: 'article', 2013 slideLabelMessage: 'Slide {{index}} of {{slidesLength}}' 2014 }, 2015 navigation: { 2016 nextEl: nextEl, 2017 prevEl: prevEl, 2018 }, 2019 breakpoints: { 2020 320: { 2021 slidesPerView: 1, 2022 spaceBetween: gap320, 2023 pagination: { 2024 el: paginationContainer, 2025 clickable: false, 2026 bulletElement: 'span', 2027 bulletClass: bulletClass, 2028 bulletActiveClass: bulletClassActive, 2029 }, 2030 }, 2031 576: { 2032 slidesPerView: 1, 2033 spaceBetween: gap576, 2034 pagination: { 2035 el: paginationContainer, 2036 clickable: false, 2037 bulletElement: 'span', 2038 bulletClass: bulletClass, 2039 bulletActiveClass: bulletClassActive, 2040 }, 2041 }, 2042 992: { 2043 slidesPerView: slidesPerView, 2044 spaceBetween: gap992, 2045 pagination: { 2046 el: null, 2047 } 2048 }, 2049 }, 2050 }); 2051 }); 2052 2053 } 2054 }; 2055 2056 document.addEventListener('DOMContentLoaded', () => { 2057 initSection(); 2058 }); 2059 2060 window.addEventListener('resize', () => { 2061 initSection(); 2062 }); 2063 2064 window.addEventListener('scroll', () => { 2065 initSection(); 2066 }); 2067 2068})(); 2069 2070})(); 2071 2072// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2073(() => { 2074var __webpack_exports__ = {}; 2075__webpack_require__.r(__webpack_exports__); 2076/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 2077/** ---------------------------------------------------------------------------- 2078 * Product Carousel */ 2079 2080 2081 2082(function () { 2083
2084 const section = 'cs-product-carousel'; 2085 const sliders = document.querySelectorAll(`.${section}`); 2086 2087 if (sliders.length === 0) { 2088 return; 2089 } 2090 2091 let executed = false; 2092 2093 const isSwiperScriptLoaded = function() { 2094 return typeof Swiper !== 'undefined'; 2095 }; 2096 2097 const initSwiper = function() { 2098 sliders.forEach(slider => { 2099 2100 // Section settings. 2101 const slidesPerView = [1, 2, 3, 3, 4]; 2102 const spaceBetween = [0, 20, 16, 24, 24]; 2103 const loopValue = slider.getAttribute('data-cs-loop'); 2104 2105 // Swiper settings. 2106 const wrapperClass = 'products'; 2107 const slideClass = 'cs-entry'; 2108 const prevEl = slider.querySelector(`.${section}__button-prev`); 2109 const nextEl = slider.querySelector(`.${section}__button-next`); 2110 let number = 0; 2111 let loop = false; 2112 let rewind = false; 2113 2114 const wrapper = slider.querySelector(`.${wrapperClass}`); 2115 2116 if (wrapper) { 2117 const slides = wrapper.querySelectorAll(`.${slideClass}`); 2118 number = slides.length; 2119 } 2120 2121 if ( 'true' === loopValue ) { 2122 if ( number > 7) { 2123 loop = true; 2124 } else { 2125 rewind = true; 2126 } 2127 } 2128 2129 new Swiper(slider, { 2130 scrollbar: false, 2131 wrapperClass: wrapperClass, 2132 slideClass: slideClass, 2133 direction: 'horizontal', 2134 loop: loop, 2135 rewind: rewind, 2136 speed: 250, 2137 parallax: false, 2138 autoplay: false, 2139 navigation: { 2140 nextEl: nextEl, 2141 prevEl: prevEl, 2142 }, 2143 breakpoints: { 2144 320: { 2145 slidesPerView: slidesPerView[0], 2146 spaceBetween: spaceBetween[0] 2147 }, 2148 576: { 2149 slidesPerView: slidesPerView[1], 2150 spaceBetween: spaceBetween[1] 2151 }, 2152 768: { 2153 slidesPerView: slidesPerView[2], 2154 spaceBetween: spaceBetween[2] 2155 }, 2156 992: { 2157 slidesPerView: slidesPerView[3], 2158 spaceBetween: spaceBetween[3] 2159 }, 2160 1200: { 2161 slidesPerView: slidesPerView[4], 2162 spaceBetween: spaceBetween[4] 2163 }, 2164 }, 2165 }); 2166 }); 2167 }; 2168 2169 const initSection = function () { 2170 if (!executed) { 2171 const options = { 2172 root: null, 2173 threshold: 0.5 2174 }; 2175 2176 const observer = new IntersectionObserver((entries) => { 2177 entries.forEach(entry => { 2178 if (entry.isIntersecting) { 2179 executed = true; 2180 initSwiper(); 2181 observer.disconnect(); 2182 } 2183 }); 2184 }, options); 2185
2186 sliders.forEach(slider => { 2187 observer.observe(slider); 2188 }); 2189 } 2190 }; 2191 2192 document.addEventListener('DOMContentLoaded', () => { 2193 initSection(); 2194 }); 2195 2196})(); 2197 2198})(); 2199 2200// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2201(() => { 2202var __webpack_exports__ = {}; 2203__webpack_require__.r(__webpack_exports__); 2204/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 2205/** ---------------------------------------------------------------------------- 2206 * Read Next */ 2207 2208 2209 2210(function () { 2211 2212 const section = 'cs-read-next'; 2213 const sliders = document.querySelectorAll(`.${section}`); 2214 2215 if (sliders.length === 0) { 2216 return; 2217 } 2218 2219 let executed = false; 2220 2221 const isSwiperScriptLoaded = function() { 2222 return typeof swiper !== 'undefined'; 2223 }; 2224 2225 const initSwiper = function() { 2226 sliders.forEach(slider => { 2227 2228 // Section settings. 2229 const slidesPerView = [1, 2, 3, 3, 4]; 2230 const spaceBetween = [0, 20, 16, 24, 24]; 2231 const loopValue = slider.getAttribute('data-cs-loop'); 2232 2233 // Swiper settings. 2234 const wrapperClass = `${section}__grid`; 2235 const slideClass = `${section}__item`; 2236 const prevEl = slider.querySelector(`.${section}__button-prev`); 2237 const nextEl = slider.querySelector(`.${section}__button-next`); 2238 const wrapper = slider.querySelector(`.${wrapperClass}`); 2239 let number = 0; 2240 let loop = false; 2241 let rewind = false; 2242 2243 if ( wrapper ) { 2244 const slides = wrapper.querySelectorAll(`.${slideClass}`); 2245 number = slides.length; 2246 } 2247 2248 if ( 'true' === loopValue ) { 2249 if ( number > 7) { 2250 loop = true; 2251 } else { 2252 rewind = true; 2253 } 2254 } 2255 2256 new Swiper(slider, { 2257 scrollbar: false, 2258 wrapperClass: wrapperClass, 2259 slideClass: slideClass, 2260 direction: 'horizontal', 2261 loop: loop, 2262 rewind: rewind, 2263 speed: 250, 2264 parallax: false, 2265 autoplay: false, 2266 navigation: { 2267 nextEl: nextEl, 2268 prevEl: prevEl, 2269 }, 2270 breakpoints: { 2271 320: { 2272 slidesPerView: slidesPerView[0], 2273 spaceBetween: spaceBetween[0] 2274 }, 2275 576: { 2276 slidesPerView: slidesPerView[1], 2277 spaceBetween: spaceBetween[1] 2278 }, 2279 768: { 2280 slidesPerView: slidesPerView[2], 2281 spaceBetween: spaceBetween[2] 2282 }, 2283 992: { 2284 slidesPerView: slidesPerView[3], 2285 spaceBetween: spaceBetween[3] 2286 }, 2287 1200: { 2288 slidesPerView: slidesPerView[4], 2289 spaceBetween: spaceBetween[4] 2290 }, 2291 }, 2292 }); 2293 }); 2294 }; 2295 2296 const initSection = function () { 2297 if (!executed) { 2298 const options = { 2299 root: null, 2300 threshold: 0.5 2301 }; 2302 2303 const observer = new IntersectionObserver((entries) => { 2304 entries.forEach(entry => { 2305 if (entry.isIntersecting) { 2306 executed = true; 2307 initSwiper(); 2308 observer.disconnect(); 2309 } 2310 }); 2311 }, options); 2312
2313 sliders.forEach(slider => { 2314 observer.observe(slider); 2315 }); 2316 } 2317 }; 2318 2319 document.addEventListener('DOMContentLoaded', () => { 2320 initSection(); 2321 }); 2322 2323})(); 2324 2325})(); 2326 2327// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2328(() => { 2329var __webpack_exports__ = {}; 2330__webpack_require__.r(__webpack_exports__); 2331/** ---------------------------------------------------------------------------- 2332 * Responsive Embeds */ 2333 2334(function () { 2335 /** 2336 * Add max-width & max-height to <iframe> elements, depending on their width & height props. 2337 */ 2338 function initResponsiveEmbeds() { 2339 let proportion, parentWidth; 2340 let iframes = document.querySelectorAll('.entry-content iframe'); 2341 2342 // Loop through iframe elements. 2343 iframes.forEach(iframe => { 2344 // Don't handle if the parent automatically resizes itself. 2345 if (iframe.closest('div[data-video-start], div[data-video-end]')) { 2346 return; 2347 } 2348 // Only continue if the iframe has a width & height defined. 2349 if (iframe.width && iframe.height) { 2350 // Calculate the proportion/ratio based on the width & height. 2351 proportion = parseFloat(iframe.width) / parseFloat(iframe.height); 2352 // Get the parent element's width. 2353 parentWidth = parseFloat(window.getComputedStyle(iframe.parentElement).width); 2354 // Set the max-width & height. 2355 iframe.style.maxWidth = '100%'; 2356 iframe.style.maxHeight = Math.round(parentWidth / proportion) + 'px'; 2357 } 2358 }); 2359 } 2360 2361 // Document ready. 2362 document.addEventListener('DOMContentLoaded', function () { 2363 initResponsiveEmbeds(); 2364 }); 2365 2366 // Post load. This assumes you have an event "post-load" being dispatched on the body element. 2367 document.body.addEventListener('post-load', function () { 2368 initResponsiveEmbeds(); 2369 }); 2370 2371 // Window resize. 2372 window.addEventListener('resize', function () { 2373 initResponsiveEmbeds(); 2374 }); 2375 2376 // Run on initial load. 2377 initResponsiveEmbeds(); 2378 2379})(); 2380 2381})(); 2382 2383// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2384(() => { 2385var __webpack_exports__ = {}; 2386__webpack_require__.r(__webpack_exports__); 2387/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 2388/** ---------------------------------------------------------------------------- 2389 * Color Scheme Toogle */ 2390 2391 2392 2393const cscoDarkMode = { 2394 init: function () { 2395 this.initMode(); 2396 2397 window.matchMedia('(prefers-color-scheme: dark)').addListener((e) => { 2398 this.initMode(); 2399 }); 2400 2401 document.querySelectorAll('.cs-site-scheme-toggle').forEach(toggle => { 2402 toggle.onclick = () => { 2403 if ('dark' === document.body.getAttribute('data-scheme')) { 2404 this.changeScheme('light', true); 2405 } else { 2406 this.changeScheme('dark', true); 2407 } 2408 }; 2409 }); 2410 }, 2411 2412 detectColorScheme: function (color) { 2413 var level = 190; 2414 var alpha = 1; 2415 var rgba = [255, 255, 255]; 2416 var color_rgba = false; 2417 2418 color = color.trim(); 2419 2420 // Excludes. 2421 if ( ['#0e131a'].includes( color ) ) { 2422 return 'dark'; 2423 } 2424 2425 if ('#' === color[0]) { 2426 color = color.replace('#', '').trim(); 2427 2428 if (3 === color.length) { 2429 color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2]; 2430 } 2431 2432 rgba[0] = parseInt(color.substr(0, 2), 16); 2433 rgba[1] = parseInt(color.substr(2, 2), 16); 2434 rgba[2] = parseInt(color.substr(4, 2), 16); 2435 } else if ((color_rgba = color.replace(/\s/g, '').match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i))) { 2436 rgba[0] = parseInt(color_rgba[1]); 2437 rgba[1] = parseInt(color_rgba[2]); 2438 rgba[2] = parseInt(color_rgba[3]); 2439 2440 if (color_rgba[4] !== undefined) { 2441 alpha = parseFloat(color_rgba[4]); 2442 } 2443 } 2444 2445 rgba.forEach(function myFunction(channel, key, stack) { 2446 stack[key] = String(channel + Math.ceil((255 - channel) * (1 - alpha))).padStart(2, '0'); 2447 }); 2448 2449 var scheme = 'light'; 2450 2451 var brightness = ((rgba[0] * 299) + (rgba[1] * 587) + (rgba[2] * 114)) / 1000; 2452 2453 if (rgba[0] === rgba[1] && rgba[1] === rgba[2]) { 2454 if (brightness < level) { 2455 scheme = 'dark'; 2456 } 2457 } else { 2458 if (brightness < level) { 2459 scheme = 'inverse'; 2460 } 2461 } 2462 2463 return scheme; 2464 }, 2465 2466 setIndividualScheme: function () { 2467 var list = { 2468 '.cs-header': '--cs-header-background', 2469 '.cs-header__nav-inner .sub-menu': '--cs-header-submenu-background', 2470 '.cs-burger-menu': '--cs-header-submenu-background', 2471 '.cs-floating-header' : '--cs-header-submenu-background', 2472 '.cs-header-topbar__top': '--cs-header-topbar-background', 2473 '.cs-offcanvas': '--cs-offcanvas-background', 2474 '.cs-footer': '--cs-footer-background', 2475 }; 2476 2477 function createClosure(key) { 2478 return function (element) { 2479 var color = getComputedStyle(element).getPropertyValue(list[key]); 2480 var scheme = cscoDarkMode.detectColorScheme(color); 2481 element.setAttribute('data-scheme', scheme); 2482 }; 2483 } 2484 2485 for (var key in list) { 2486 if (list.hasOwnProperty(key)) { 2487 var elements = document.querySelectorAll(key); 2488 2489 if (elements.length <= 0) { 2490 continue; 2491 } 2492
2493 elements.forEach(createClosure(key)); 2494 } 2495 } 2496 }, 2497 2498 initMode: function () { 2499 let siteScheme = false; 2500 2501 switch (csLocalize.siteSchemeMode) { 2502 case 'dark': 2503 siteScheme = 'dark'; 2504 break; 2505 case 'light': 2506 siteScheme = 'light'; 2507 break; 2508 case 'system': 2509 siteScheme = 'auto'; 2510 break; 2511 } 2512 2513 if (csLocalize.siteSchemeToogle) { 2514 if ('light' === (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.csGetCookie)('_color_schema')) { 2515 siteScheme = 'light'; 2516 } 2517 if ('dark' === (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.csGetCookie)('_color_schema')) { 2518 siteScheme = 'dark'; 2519 } 2520 } 2521 2522 this.setIndividualScheme(); 2523 2524 if (siteScheme && siteScheme !== document.body.getAttribute('data-scheme')) { 2525 this.changeScheme(siteScheme, false); 2526 } 2527 }, 2528 2529 changeScheme: function (siteScheme, cookie) { 2530 document.body.classList.add('cs-scheme-toggled'); 2531 document.body.setAttribute('data-scheme', siteScheme); 2532 2533 this.setIndividualScheme(); 2534 2535 if (cookie) { 2536 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.csSetCookie)('_color_schema', siteScheme, { expires: 2592000 }); 2537 } 2538 2539 setTimeout(() => { 2540 document.body.classList.remove('cs-scheme-toggled'); 2541 }, 100); 2542 } 2543}; 2544 2545cscoDarkMode.init(); 2546 2547})(); 2548 2549// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2550(() => { 2551var __webpack_exports__ = {}; 2552__webpack_require__.r(__webpack_exports__); 2553/** ---------------------------------------------------------------------------- 2554 * Scroll to top */ 2555 2556( function() { 2557 2558 const section = 'cs-scroll-top'; 2559 const activeClass = 'is-active'; 2560 const offset = 300; 2561 2562 const scrollToTop = () => { 2563 window.scrollTo({ top: 0, behavior: 'smooth' }); 2564 }; 2565 2566 const scrollToTopButton = document.querySelector(`.${section}`); 2567 2568 if (scrollToTopButton) { 2569 const progressPath = scrollToTopButton.querySelector(`.${section}-progress path`); 2570 const pathLength = progressPath.getTotalLength(); 2571 2572 progressPath.style.transition = progressPath.style.WebkitTransition = 'none'; 2573 progressPath.style.strokeDasharray = `${pathLength} ${pathLength}`; 2574 progressPath.style.strokeDashoffset = pathLength; 2575 progressPath.getBoundingClientRect(); 2576 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 2577 2578 const updateProgress = function () { 2579 const scroll = window.scrollY || window.scrollTop || document.documentElement.scrollTop; 2580 const docHeight = Math.max( 2581 document.body.scrollHeight, 2582 document.documentElement.scrollHeight, 2583 document.body.offsetHeight, 2584 document.documentElement.offsetHeight, 2585 document.body.clientHeight, 2586 document.documentElement.clientHeight 2587 ); 2588 const windowHeight = Math.max( 2589 document.documentElement.clientHeight, 2590 window.innerHeight || 0 2591 ); 2592 const height = docHeight - windowHeight; 2593 var progress = pathLength - (scroll * pathLength) / height; 2594 progressPath.style.strokeDashoffset = progress; 2595 }; 2596 2597 updateProgress(); 2598 2599 scrollToTopButton.addEventListener('click', scrollToTop); 2600 2601 window.addEventListener('scroll', () => { 2602 updateProgress(); 2603 2604 const scrollPos = window.scrollY || window.scrollTop || document.getElementsByTagName('html')[0].scrollTop; 2605 if (scrollPos > offset) { 2606 scrollToTopButton.classList.add(activeClass); 2607 } else { 2608 scrollToTopButton.classList.remove(activeClass); 2609 } 2610 }); 2611 } 2612 2613} )(); 2614 2615})(); 2616 2617// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2618(() => { 2619var __webpack_exports__ = {}; 2620__webpack_require__.r(__webpack_exports__); 2621/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 2622/** ---------------------------------------------------------------------------- 2623 * Metabar Share copy link */ 2624 2625 2626 2627(function () { 2628 function copyToClipboard(str) { 2629 const area = document.createElement('textarea'); 2630 document.body.appendChild(area); 2631 area.value = str; 2632 area.select(); 2633 document.execCommand('copy'); 2634 document.body.removeChild(area); 2635 } 2636 2637 function showTooltip(button, message) { 2638 const tooltip = document.createElement('div'); 2639 tooltip.className = 'cs-share__copy-link-tooltip'; 2640 tooltip.textContent = message; 2641 button.appendChild(tooltip); 2642 2643 setTimeout(() => { 2644 tooltip.classList.add('hide'); 2645 }, 1500); 2646 2647 setTimeout(() => { 2648 button.removeChild(tooltip); 2649 }, 2000); 2650 } 2651 2652 const copyButtons = document.querySelectorAll('.cs-share__copy-link'); 2653 2654 copyButtons.forEach(button => { 2655 button.addEventListener('click', function(event) { 2656 event.preventDefault(); 2657 2658 const pageURL = this.getAttribute('href'); 2659 2660 copyToClipboard(pageURL); 2661 2662 showTooltip(this, 'URL copied'); 2663 }); 2664 }); 2665})(); 2666 2667})(); 2668 2669// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2670(() => { 2671var __webpack_exports__ = {}; 2672__webpack_require__.r(__webpack_exports__); 2673/** ---------------------------------------------------------------------------- 2674 * Shop Minicart */ 2675 2676(function () { 2677 2678 const body = document.body; 2679 const cartToggles = document.querySelectorAll('.cs-header__cart-toggle, .cs-shop-minicart__toggle, .cs-shop-minicart-overlay'); 2680
2681 cartToggles.forEach(cartToggle => { 2682 cartToggle.addEventListener('click', function (e) { 2683 e.preventDefault(); 2684 2685 body.classList.toggle('cs-shop-minicart-active'); 2686 }); 2687 }); 2688 2689})(); 2690 2691})(); 2692 2693// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2694(() => { 2695var __webpack_exports__ = {}; 2696__webpack_require__.r(__webpack_exports__); 2697/** ---------------------------------------------------------------------------- 2698 * Shop Offcanvas */ 2699 2700(function () { 2701 2702 const body = document.body; 2703 const filterToggles = document.querySelectorAll('.cs-shop-offcanvas__toggle, .cs-shop-offcanvas__close, .cs-shop-offcanvas-overlay'); 2704 2705 filterToggles.forEach(filterToggle => { 2706 filterToggle.addEventListener('click', function (e) { 2707 e.preventDefault(); 2708 2709 body.classList.toggle('cs-shop-offcanvas-active'); 2710 }); 2711 }); 2712 2713})(); 2714 2715})(); 2716 2717// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2718(() => { 2719var __webpack_exports__ = {}; 2720__webpack_require__.r(__webpack_exports__); 2721/** ---------------------------------------------------------------------------- 2722 * Sticky Sidebar */ 2723 2724(function() { 2725 let stickyElementsSmart = [], 2726 stickyElements = []; 2727 2728 stickyElementsSmart.push( 2729 '.cs-navbar-smart-enabled.cs-stick-to-top .cs-single-product .entry-summary', 2730 '.cs-sticky-sidebar-enabled.cs-navbar-smart-enabled.cs-stick-to-top .cs-sidebar__inner', 2731 '.cs-sticky-sidebar-enabled.cs-navbar-smart-enabled.cs-stick-last .cs-sidebar__inner .widget:last-child' 2732 ); 2733 2734 stickyElements.push( 2735 '.cs-navbar-sticky-enabled.cs-stick-to-top .cs-single-product .entry-summary', 2736 '.cs-sticky-sidebar-enabled.cs-navbar-sticky-enabled.cs-stick-to-top .cs-sidebar__inner', 2737 '.cs-sticky-sidebar-enabled.cs-navbar-sticky-enabled.cs-stick-last .cs-sidebar__inner .widget:last-child' 2738 ); 2739 2740 document.addEventListener("DOMContentLoaded", function() { 2741 let headerStick = document.querySelector('.cs-header'), 2742 wpAdminBar = document.querySelector('#wpadminbar'), 2743 floatingHeader = document.querySelector('.cs-floating-header__content'), 2744 headerStickHeight = headerStick ? headerStick.offsetHeight : 0, 2745 wpAdminBarHeight = wpAdminBar ? wpAdminBar.offsetHeight : 0, 2746 floatingHeaderHeight = floatingHeader ? floatingHeader.offsetHeight + 2 : 0, 2747 headerStretch = document.querySelector('.cs-header-stretch'), 2748 headerStretchHeight = headerStretch ? headerStretch.offsetHeight : 0, 2749 allHeight = headerStickHeight + wpAdminBarHeight + floatingHeaderHeight + 20, 2750 windowWidth = window.innerWidth; 2751 2752 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 2753 stickyElementsSmart.push('.cs-sticky-sidebar-enabled.cs-stick-to-bottom .cs-sidebar__inner'); 2754 stickyElements.push('.cs-sticky-sidebar-enabled.cs-stick-to-bottom .cs-sidebar__inner'); 2755 } 2756 2757 stickyElementsSmart = stickyElementsSmart.join(','); 2758 stickyElements = stickyElements.join(','); 2759 2760 document.addEventListener('sticky-nav-visible', function() { 2761 headerStickHeight = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height')); 2762 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + (floatingHeaderHeight || 0) + 20; 2763 2764 document.querySelectorAll(stickyElementsSmart).forEach(el => { 2765 el.style.top = allHeight + 'px'; 2766 }); 2767 }); 2768 2769 document.addEventListener('sticky-nav-hide', function() { 2770 headerStickHeight = 0; 2771 allHeight = (headerStickHeight || 0) + (wpAdminBarHeight || 0) + (floatingHeaderHeight || 0) + 20; 2772 2773 document.querySelectorAll(stickyElementsSmart).forEach(el => { 2774 el.style.top = allHeight + 'px'; 2775 }); 2776 }); 2777 2778 document.addEventListener('stretch-nav-to-small', function() { 2779 headerStretchHeight = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height'));
2780 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + (floatingHeaderHeight || 0) + 20; 2781 2782 if (headerStretch && headerStretch.classList.contains("cs-scroll-sticky") && !headerStretch.classList.contains("cs-scroll-active")) { 2783 document.querySelectorAll(stickyElementsSmart).forEach(el => { 2784 el.style.top = allHeight + 'px'; 2785 }); 2786 } 2787 }); 2788 2789 document.addEventListener('stretch-nav-to-big', function() { 2790 headerStretchHeight = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-initial-height')); 2791 }); 2792 2793 if (document.body.classList.contains('cs-navbar-smart-enabled') && windowWidth >= 1020) { 2794 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + (floatingHeaderHeight || 0) + 20; 2795 2796 document.querySelectorAll(stickyElementsSmart).forEach(el => { 2797 el.style.top = allHeight + 'px'; 2798 }); 2799 } else if (document.body.classList.contains('cs-navbar-sticky-enabled') && windowWidth >= 1020) { 2800 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + (floatingHeaderHeight || 0) + 20; 2801 2802 document.querySelectorAll(stickyElements).forEach(el => { 2803 el.style.top = allHeight + 'px'; 2804 }); 2805 } 2806 2807 window.addEventListener('resize', function() { 2808 let windowWidthResize = window.innerWidth; 2809 if (windowWidthResize < 1020) { 2810 document.querySelectorAll(stickyElements).forEach(el => { 2811 el.removeAttribute('style'); 2812 }); 2813 document.querySelectorAll(stickyElementsSmart).forEach(el => { 2814 el.removeAttribute('style'); 2815 }); 2816 } 2817 }); 2818 }); 2819})(); 2820 2821})(); 2822 2823// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2824(() => { 2825var __webpack_exports__ = {}; 2826__webpack_require__.r(__webpack_exports__); 2827/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 2828/** ---------------------------------------------------------------------------- 2829 * Video Background */ 2830 2831 2832 2833(function () { 2834 var initAPI = false; 2835 var process = false; 2836 var contex = []; 2837 var players = []; 2838 var attrs = []; 2839 2840 // Create deferred object 2841 var YTdeferred = new Promise(function (resolve) { 2842 window.onYouTubePlayerAPIReady = function () { 2843 resolve(window.YT); 2844 }; 2845 }); 2846 2847 // Embedding youtube iframe api. 2848 function embedYoutubeAPI() { 2849 document.querySelectorAll('.cs-video-inner').forEach(function (el) { 2850 if ( (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.isInViewport)(el) ) { 2851 var tag = document.createElement('script'); 2852 tag.src = 'https://www.youtube.com/iframe_api'; 2853 var firstScriptTag = document.getElementsByTagName('script')[0]; 2854 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2855 initAPI = true; 2856 } 2857 }); 2858 } 2859 2860 // Video rescale. 2861 function rescaleVideoBackground() { 2862 document.querySelectorAll('.cs-video-init').forEach(function (el) { 2863 var w = el.parentElement.offsetWidth; 2864 var h = el.parentElement.offsetHeight; 2865 var hideControl = 400; 2866 var id = el.getAttribute('data-uid'); 2867 2868 if (w / h > 16 / 9) { 2869 players[id].setSize(w, w / 16 * 9 + hideControl); 2870 } else { 2871 players[id].setSize(h / 9 * 16, h + hideControl); 2872 } 2873 }); 2874 } 2875 2876 // Init video background. 2877 function initVideoBackground() { 2878 if (document.body.classList.contains('wp-admin')) { 2879 return; 2880 } 2881 2882 if (process) { 2883 return; 2884 } 2885 2886 process = true; 2887 2888 // Smart init API. 2889 if (!initAPI) { 2890 var elements = document.querySelectorAll('.cs-video-wrapper[data-vi
2890deo-id]'); 2891 2892 if (elements.length) { 2893 embedYoutubeAPI(); 2894 } 2895 } 2896 2897 if (!initAPI) { 2898 process = false; 2899 return; 2900 } 2901 2902 // Whenever youtube callback was called = deferred resolved 2903 // your custom function will be executed with YT as an argument. 2904 YTdeferred.then(function (YT) { 2905 document.querySelectorAll('.cs-video-inner').forEach(function (el) { 2906 var isInit = el.classList.contains('cs-video-init'); 2907 var id = null; 2908 2909 if (!isInit) { 2910 id = Math.random().toString(36).substr(2, 9); 2911 } else { 2912 id = el.getAttribute('data-uid'); 2913 } 2914 2915 contex[id] = el; 2916 var isActive = contex[id].classList.contains('active'); 2917 var isInView = (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.isInViewport)(contex[id]); 2918 2919 if (isInView && !isInit) { 2920 contex[id].classList.add('cs-video-init'); 2921 contex[id].setAttribute('data-uid', id); 2922 2923 var videoID = contex[id].parentElement.dataset.videoId; 2924 var videoStart = contex[id].parentElement.dataset.videoStart; 2925 var videoEnd = contex[id].parentElement.dataset.videoEnd; 2926 2927 if (typeof videoID === 'undefined' || !videoID) { 2928 return; 2929 } 2930 2931 attrs[id] = { 2932 'videoId': videoID, 2933 'startSeconds': videoStart, 2934 'endSeconds': videoEnd, 2935 'suggestedQuality': 'hd720' 2936 }; 2937 2938 players[id] = new YT.Player(contex[id], { 2939 playerVars: { 2940 autoplay: 0, 2941 autohide: 1, 2942 modestbranding: 1, 2943 rel: 0, 2944 showinfo: 0, 2945 controls: 0, 2946 disablekb: 1, 2947 enablejsapi: 0, 2948 iv_load_policy: 3, 2949 playsinline: 1, 2950 loop: 1 2951 }, 2952 events: { 2953 'onReady': function () { 2954 players[id].loadVideoById(attrs[id]); 2955 players[id].mute(); 2956 }, 2957 'onStateChange': function (e) { 2958 if (e.data === 1) { 2959 var parentElement = contex[id].closest('.cs-overlay, .cs-video-wrap'); 2960 2961 if (parentElement) { 2962 parentElement.classList.add('cs-video-bg-init'); 2963 } 2964 2965 contex[id].classList.add('active'); 2966 } else if (e.data === 0) { 2967 players[id].seekTo(attrs[id].startSeconds); 2968 } 2969 } 2970 } 2971 }); 2972 rescaleVideoBackground(); 2973 } 2974 2975 var parentElement = contex[id].closest('.cs-overlay, .cs-video-wrap'); 2976 if (isActive && isInit && !parentElement.querySelector('.cs-player-state').classList.contains('cs-player-upause')) { 2977 var control = parentElement.querySelector('.cs-player-state'); 2978 2979 if (control) { 2980 if (isInView && control.classList.contains('cs-player-play')) { 2981 control.classList.remove('cs-player-play'); 2982 control.classList.add('cs-player-pause'); 2983 players[id].playVideo(); 2984 } 2985 2986 if (!isInView && control.classList.contains('cs-player-pause')) { 2987 control.classList.remove('cs-player-pause'); 2988 control.classList.add('cs-player-play'); 2989 players[id].pauseVideo(); 2990 } 2991 } 2992 } 2993 }); 2994 }); 2995 2996 process = false; 2997 } 2998 2999 // State Control. 3000 document.addEventListener('click', function (event) { 3001 if (event.target.classList.contains('cs-player-state')) { 3002 var container = event.target.closest('.cs-overlay, .cs-video-wrap').querySelector('.cs-video-inner'); 3003 var id = container.getAttribute('data-uid'); 3004 3005 event.target.classList.toggle('cs-player-pause'); 3006 event.target.classList.toggle('cs-player-play'); 3007 3008 if (event.target.classList.contains('cs-player-pause')) { 3009 event.target.classList.remove('cs-player-upause'); 3010 players[id].playVideo(); 3011 } else { 3012 event.target.classList.add('cs-player-upause'); 3013 players[id].pauseVideo(); 3014 } 3015 } 3016 }); 3017 3018 // Stop Control. 3019 document.addEventListener('click', function (event) { 3020 if (event.target.classList.contains('cs-player-stop')) { 3021 var container = event.target.closest('.cs-overlay, .cs-video-wrap').querySelector('.cs-video-inner'); 3022 var id = container.getAttribute('data-uid'); 3023 3024 var stateControl = event.target.nextElementSibling; 3025 stateControl.classList.remove('cs-player-pause'); 3026 stateControl.classList.add('cs-player-play', 'cs-player-upause'); 3027 3028 players[id].pauseVideo(); 3029 } 3030 }); 3031 3032 // Volume Control. 3033 document.addEventListener('click', function (event) { 3034 if (event.target.classList.contains('cs-player-volume')) { 3035 var container = event.target.closest('.cs-overlay, .cs-video-wrap').querySelector('.cs-video-inner'); 3036 var id = container.getAttribute('data-uid'); 3037 3038 event.target.classList.toggle('cs-player-mute'); 3039 event.target.classList.toggle('cs-player-unmute'); 3040 3041 if (event.target.classList.contains('cs-player-unmute')) { 3042 players[id].unMute(); 3043 } else { 3044 players[id].mute(); 3045 } 3046 } 3047 }); 3048 3049 // Document scroll.
3050 window.addEventListener('load', initVideoBackground); 3051 window.addEventListener('scroll', initVideoBackground); 3052 window.addEventListener('resize', initVideoBackground); 3053 window.addEventListener('scrollstop', initVideoBackground); 3054 3055 // Document ready. 3056 document.addEventListener('DOMContentLoaded', function () { 3057 initVideoBackground(); 3058 }); 3059 3060 // Post load. 3061 document.body.addEventListener('post-load', function () { 3062 initVideoBackground(); 3063 }); 3064 3065 // Document resize. 3066 window.addEventListener('resize', rescaleVideoBackground); 3067 3068 // Init. 3069 initVideoBackground(); 3070})(); 3071 3072})(); 3073 3074// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 3075(() => { 3076var __webpack_exports__ = {}; 3077__webpack_require__.r(__webpack_exports__); 3078/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 3079/** ---------------------------------------------------------------------------- 3080 * Widget Nav Menu */ 3081 3082 3083 3084(function () { 3085 3086 HTMLElement.prototype.responsiveNav = function () { 3087 this.classList.remove('menu-item-expanded'); 3088 let previousElement = this.previousElementSibling; 3089 3090 if (previousElement && previousElement.classList.contains('submenu-visible')) { 3091 previousElement.classList.remove('submenu-visible'); 3092 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideUp)(previousElement); 3093 this.parentElement.classList.remove('menu-item-expanded'); 3094 } else { 3095 let parentOfParent = this.parentElement.parentElement; 3096 3097 parentOfParent.querySelectorAll('.menu-item .sub-menu').forEach(subMenu => { 3098 subMenu.classList.remove('submenu-visible'); 3099 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideUp)(subMenu); 3100 }); 3101 3102 parentOfParent.querySelectorAll('.menu-item-expanded').forEach(item => { 3103 item.classList.remove('menu-item-expanded'); 3104 }); 3105 3106 if (previousElement) { 3107 previousElement.classList.toggle('submenu-visible'); 3108 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideToggle)(previousElement); 3109 } 3110 3111 this.parentElement.classList.toggle('menu-item-expanded'); 3112 } 3113 }; 3114 3115 document.addEventListener('DOMContentLoaded', function () { 3116 let menuItems = document.querySelectorAll('.widget_nav_menu .menu-item-has-children'); 3117 3118 menuItems.forEach(menuItem => { 3119 let span = document.createElement('span'); 3120 menuItem.appendChild(span); 3121 3122 span.addEventListener('click', function (e) { 3123 e.preventDefault(); 3124 this.responsiveNav(); 3125 }); 3126 3127 let anchor = menuItem.children[0]; 3128 if (anchor && anchor.tagName === 'A' && anchor.getAttribute('href') === '#') { 3129 anchor.addEventListener('click', function (e) { 3130 e.preventDefault(); 3131 this.nextElementSibling.nextElementSibling.responsiveNav(); 3132 }); 3133 } 3134 }); 3135 }); 3136 3137})(); 3138 3139})(); 3140 3141// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 3142(() => { 3143__webpack_require__.r(__webpack_exports__); 3144/** ---------------------------------------------------------------------------- 3145 * Woocommerce Tabs */ 3146 3147document.addEventListener('click', function(e) { 3148 var target = e.target; 3149 if (target && target.matches('.cs-woocommerce-tabs > ul > li > a')) { 3150 target.parentElement.classList.toggle('cs-opened'); 3151 var panel = target.parentElement.querySelector('.woocommerce-Tabs-panel'); 3152 if (panel) { 3153 if (panel.style.display === 'none' || panel.style.display === '') { 3154 panel.style.display = 'block'; 3155 } else { 3156 panel.style.display = 'none'; 3157 } 3158 } 3159 var siblings = target.parentElement.parentElement.children; 3160 for (var i = 0; i < siblings.length; i++) { 3161 if (siblings[i] !== target.parentElement) { 3162 siblings[i].classList.remove('cs-opened'); 3163 var siblingPanel = siblings[i].querySelector('.woocommerce-Tabs-panel'); 3164 if (siblingPanel) { 3165 siblingPanel.style.display = 'none'; 3166 } 3167 } 3168 } 3169 e.preventDefault(); 3170 } 3171}); 3172 3173})(); 3174 3175/******/ })() 3176;
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.