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 let executed = false; 201 202 const isSwiperScriptLoaded = function() { 203 return Array.from(document.getElementsByTagName('script')).some(script => { 204 return script.src === 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.0.0/swiper-bundle.min.js'; 205 }); 206 }; 207 208 const initSwiper = function() { 209 sliders.forEach(slider => { 210 211 // Swiper settings 212 const wrapperClass = `cs-header-bottombar__nav`; 213 const slideClass = `menu-item`; 214 const prevEl = slider.querySelector(`.cs-header-bottombar__button-prev`); 215 const nextEl = slider.querySelector(`.cs-header-bottombar__button-next`); 216 217 new Swiper(slider, { 218 scrollbar: false, 219 wrapperClass: wrapperClass, 220 slideClass: slideClass, 221 direction: 'horizontal', 222 loop: false, 223 rewind: true, 224 speed: 250, 225 parallax: false, 226 autoplay: false, 227 slidesPerView: 'auto', 228 spaceBetween: 0, 229 navigation: { 230 nextEl: nextEl, 231 prevEl: prevEl, 232 }, 233 }); 234 }); 235 }; 236 237 const initHero = function() { 238 if (!executed && (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.isInViewport)(sliders[0])) { 239 executed = true; 240 241 if (typeof Swiper === 'undefined' && !isSwiperScriptLoaded()) { 242 const head = document.getElementsByTagName('head')[0]; 243 const script = document.createElement('script'); 244 245 script.type = 'text/javascript'; 246 script.src = 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.0.0/swiper-bundle.min.js'; 247 248 script.onload = function () { 249 initSwiper(); 250 }; 251 252 head.appendChild(script); 253 } else { 254 initSwiper(); 255 } 256 } 257 }; 258 259 document.addEventListener('DOMContentLoaded', () => { 260 initHero(); 261 }); 262 263 window.addEventListener('resize', () => { 264 initHero(); 265 }); 266 267 window.addEventListener('scroll', () => { 268 initHero(); 269 }); 270 271})(); 272 273})(); 274 275// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 276(() => { 277var __webpack_exports__ = {}; 278__webpack_require__.r(__webpack_exports__); 279/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 280/** ---------------------------------------------------------------------------- 281 * Hero */ 282 283 284 285(function () { 286 287 const section = 'cs-carousel'; 288 const sliders = document.querySelectorAll(`.${section}`); 289 290 if (sliders.length === 0) { 291 return; 292 } 293 294 let executed = false; 295 296 const isSwiperScriptLoaded = function() { 297 return Array.from(document.getElementsByTagName('script')).some(script => { 298 return script.src === 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.0.0/swiper-bundle.min.js'; 299 }); 300 }; 301 302 const initSwiper = function() {
303 sliders.forEach(slider => { 304 const postContentContainer = '.cs-entry__content'; 305 const postContents = slider.querySelectorAll(postContentContainer); 306 307 // Function to set parallax attributes 308 const setParallaxAttributes = function(element, duration) { 309 element.setAttribute('data-swiper-parallax-x', '-400'); 310 element.setAttribute('data-swiper-parallax-duration', duration); 311 }; 312 313 // Section data 314 const postPerViewValue = slider.getAttribute('data-cs-post-per-view'); 315 const autoplayValue = slider.getAttribute('data-cs-autoplay'); 316 const autoplayDelayValue = slider.getAttribute('data-cs-autoplay-delay'); 317 const speedValue = slider.getAttribute('data-cs-slide-speed'); 318 const parallaxValue = slider.getAttribute('data-cs-parallax'); 319 const gapValue = slider.getAttribute('data-cs-gap'); 320 321 // Data manipulation 322 const postPerView = ( !isNaN(parseInt(postPerViewValue)) && parseInt(postPerViewValue) > 0 ) ? parseInt(postPerViewValue) : 3; 323 const autoplayDelay = ( !isNaN(parseInt(autoplayDelayValue)) && parseInt(autoplayDelayValue) > 0 ) ? parseInt(autoplayDelayValue) : 5000; 324 const autoplay = ('true' === autoplayValue) ? { delay: autoplayDelay, disableOnInteraction: false, pauseOnMouseEnter: true, } : false; 325 const speed = !isNaN(parseInt(speedValue)) ? parseInt(speedValue) : 800; 326 const parallax = ('true' === parallaxValue) ? true : false; 327 const gap = !isNaN(parseInt(gapValue)) ? parseInt(gapValue) : 0; 328 329 if (parallax) { 330 if (postContents.length > 0) { 331 postContents.forEach(postContent => { 332 setParallaxAttributes(postContent, '800'); 333 }); 334 } 335 } 336 337 // Swiper settings 338 const wrapperClass = `${section}__wrapper`; 339 const slideClass = `${section}__item`; 340 const prevEl = slider.querySelector(`.${section}__button-prev`); 341 const nextEl = slider.querySelector(`.${section}__button-next`); 342 const paginationContainer = slider.querySelector(`.${section}__pagination`); 343 const progressbar = slider.querySelector(`.${section}__progress-bar`); 344 const bulletClass = `${section}__pagination-bullet`; 345 const bulletClassActive = `${section}__pagination-bullet-active`; 346 347 const carouselTabs = new Swiper(slider.querySelector(`.${section}__swiper-tabs`), { 348 scrollbar: false, 349 wrapperClass: wrapperClass, 350 slideClass: slideClass, 351 direction: 'horizontal', 352 loop: true, 353 speed: speed, 354 parallax: false, 355 slidesPerView: postPerView, 356 freeMode: true, 357 spaceBetween: 0, 358 }); 359 const carouselPost = new Swiper(slider.querySelector(`.${section}__swiper-post`), { 360 scrollbar: false, 361 wrapperClass: wrapperClass, 362 slideClass: slideClass, 363 direction: 'horizontal', 364 loop: true, 365 speed: speed, 366 parallax: parallax, 367 autoplay: autoplay, 368 slidesPerView: 1, 369 spaceBetween: gap, 370 a11y: { 371 slideRole: 'article', 372 slideLabelMessage: 'Slide {{index}} of {{slidesLength}}' 373 }, 374 pagination: { 375 type: 'progressbar', 376 el: paginationContainer, 377 clickable: true, 378 bulletElement: 'span', 379 bulletClass: bulletClass, 380 bulletActiveClass: bulletClassActive, 381 }, 382 navigation: { 383 nextEl: nextEl, 384 prevEl: prevEl, 385 }, 386 thumbs: { 387 swiper: carouselTabs, 388 }, 389 on: { 390 autoplayTimeLeft(s, time, progress) { 391 progressbar.style.setProperty(`--${section}-progressbar`, 1 - progress); 392 }, 393 init: function () { 394 setTimeout(() => { 395 const initialSlide = this.slides[this.activeIndex]; 396 if (initialSlide) { 397 const initialContent = initialSlide.querySelector(postContentContainer); 398 if (initialContent) { 399 initialContent.style.transform = 'none'; 400 } 401 } 402 }, 100); 403 }, 404 slideChange: function () { 405 const currentSlide = this.slides[this.activeIndex]; 406 407 postContents.forEach(postContent => { 408 if (postContent === currentSlide.querySelector(postContentContainer)) { 409 postContent.style.transform = 'none'; 410 } 411 }); 412 } 413 }, 414 }); 415 416 // Calculate the height of swiper tabs. 417 let tabsHeight = slider.querySelector(`.${section}__swiper-tabs`).offsetHeight; 418 slider.style.setProperty(`--${section}-tabs-height`, tabsHeight + 'px'); 419 }); 420 }; 421 422 const initHero = function() { 423 if (!executed && (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.isInViewport)(sliders[0])) { 424 executed = true; 425 426 if (typeof Swiper === 'undefined' && !isSwiperScriptLoaded()) { 427 const head = document.getElementsByTagName('head')[0]; 428 const script = document.createElement('script'); 429 430 script.type = 'text/javascript'; 431 script.src = 'https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.0.0/swi
431per-bundle.min.js'; 432 433 script.onload = function () { 434 initSwiper(); 435 }; 436 437 head.appendChild(script); 438 } else { 439 initSwiper(); 440 } 441 } 442 }; 443 444 document.addEventListener('DOMContentLoaded', () => { 445 initHero(); 446 }); 447 448 window.addEventListener('resize', () => { 449 initHero(); 450 }); 451 452 window.addEventListener('scroll', () => { 453 initHero(); 454 }); 455 456})(); 457 458})(); 459 460// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 461(() => { 462var __webpack_exports__ = {}; 463__webpack_require__.r(__webpack_exports__); 464/** ---------------------------------------------------------------------------- 465 * Search Dropdown */ 466 467(function () { 468 469 const toggles = document.querySelectorAll('.cs-entry__comments-toggle'); 470 471 toggles.forEach(toggle => { 472 toggle.addEventListener('click', function (e) { 473 e.preventDefault(); 474 475 const commentsElement = document.querySelector('.cs-entry__comments'); 476 477 commentsElement.classList.toggle('cs-entry__comments-visible'); 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 followToggles = document.querySelectorAll('.cs-follow__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-follow-visible')) { 574 headerElement.classList.remove('cs-follow-visible'); 575 body.classList.remove('cs-follow-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-follow-visible')) { 597 headerElement.classList.remove('cs-follow-visible'); 598 body.classList.remove('cs-follow-active'); 599 } 600 601 headerElement.classList.toggle('cs-burger-visible'); 602 body.classList.toggle('cs-burger-active'); 603 }); 604 }); 605 606 followToggles.forEach(followToggle => { 607 followToggle.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-follow-visible'); 625 body.classList.toggle('cs-follow-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-follow-visible')) { 644 headerElement.classList.remove('cs-follow-visible'); 645 body.classList.remove('cs-follow-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})(); 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}
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 Load More. 780 object.textContent = settings.translation.loading; 781 782 let data = { 783 action: 'csco_ajax_load_more', 784 page: page, 785 posts_per_page: settings.posts_per_page, 786 query_data: settings.query_data, 787 attributes: settings.attributes, 788 options: settings.options, 789 _ajax_nonce: settings.nonce, 790 }; 791 792 // Request Url. 793 let csco_pagination_url = (settings.type === 'ajax_restapi') ? settings.rest_url : settings.url; 794 795 function encodeFormData(data) { 796 return Object.keys(data).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])).join('&'); 797 } 798 799 fetch(csco_pagination_url, { 800 method: 'POST', 801 body: encodeFormData(data), 802 headers: { 803 'Content-Type': 'application/x-www-form-urlencoded' 804 } 805 }) 806 .then(response => response.json()) 807 .then(res => { 808 if (res.success) { 809 let dataContent = document.createElement('div'); 810 dataContent.innerHTML = res.data.content; 811 812 if (dataContent.children.length) { 813 // WP Post Load trigger. This might need more logic for your specific use-case. 814 document.body.dispatchEvent(new Event('post-load')); 815 816 // Reinit Facebook widgets. 817 if (document.querySelector('#fb-root') && typeof FB !== 'undefined') { 818 FB.XFBML.parse(); 819 } 820 821 // Set button text to Load More. 822 object.textContent = settings.translation.load_more; 823 824 // Increment a page. 825 page += 1; 826 827 object.dataset.page = page.toString(); 828 829 // Reset the loading state. 830 object.dataset.loading = "false"; 831 832 // Append new content to the container 833 let mainContainer = container.querySelector('.cs-posts-area__main'); 834 while (dataContent.firstChild) { 835 mainContainer.appendChild(dataContent.firstChild); 836 } 837 } 838 839 // Remove Button on Posts End. 840 if (res.data.posts_end) { 841 // Remove Load More button. 842 object.parentNode.removeChild(object); 843 } 844 } 845 }) 846 .catch(error => { 847 console.error('Error fetching posts:', error); 848 }); 849} 850 851function csco_load_more_init(infinite) { 852 let areas = document.querySelectorAll('.cs-posts-area'); 853 areas.forEach(area => { 854 if (area.dataset.init) { 855 return; 856 } 857 858 let csco_ajax_settings; 859 let archive_data = area.dataset.postsArea; 860 861 if (archive_data) { 862 csco_ajax_settings = JSON.parse(window.atob(archive_data)); 863 } else if (typeof csco_ajax_pagination !== 'undefined' && typeof archive_data === 'undefined') { 864 csco_ajax_settings = csco_ajax_pagination; 865 } 866 867 if (csco_ajax_settings) { 868 if (!infinite && csco_ajax_settings.infinite_load) { 869 return; 870 } 871 872 let pagination = document.createElement('div'); 873 pagination.className = 'cs-posts-area__pagination'; 874 875 let btn = document.createElement('button'); 876 btn.className = 'cs-load-more'; 877 btn.textContent = csco_ajax_settings.translation.load_more; 878 pagination.appendChild(btn); 879 area.appendChild(pagination); 880 881 btn.dataset.settings = JSON.stringify(csco_ajax_settings); 882 btn.dataset.page = '2'; 883 btn.dataset.loading = "false"; 884 btn.dataset.scrollHandling = JSON.stringify({ 885 allow: JSON.parse(csco_ajax_settings.infinite_load), 886 delay: 400 887 }); 888 } 889 890 area.dataset.init = true; 891 }); 892} 893 894csco_load_more_init(true); 895 896// Elementor Init 897window.addEventListener('elementor/frontend/init', function () { 898 csco_load_more_init(true); 899}); 900 901// On Scroll Event. 902window.addEventListener('scroll', function () { 903 let buttons = document.querySelectorAll('.cs-posts-area .cs-load-more'); 904 buttons.forEach(btn => { 905 let loading = btn.dataset.loading === "true"; 906 let scrollHandling = JSON.parse(btn.dataset.scrollHandling || '{}'); 907 908 if (loading || !scrollHandling.allow) { 909 return; 910 } 911 912 scrollHandling.allow = false;
913 btn.dataset.scrollHandling = JSON.stringify(scrollHandling); 914 915 setTimeout(function () { 916 scrollHandling.allow = true; 917 918 btn.dataset.scrollHandling = JSON.stringify(scrollHandling); 919 }, scrollHandling.delay); 920 921 let offset = btn.getBoundingClientRect().top - window.innerHeight; 922 923 if (offset < 4000) { 924 csco_ajax_get_posts(btn); 925 } 926 }); 927}); 928 929// On Click Event. 930document.body.addEventListener('click', function (event) { 931 if (event.target.classList.contains('cs-load-more')) { 932 let loading = event.target.dataset.loading === "true"; 933 if (!loading) { 934 csco_ajax_get_posts(event.target); 935 } 936 } 937}); 938 939})(); 940 941// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 942(() => { 943var __webpack_exports__ = {}; 944__webpack_require__.r(__webpack_exports__); 945// Check if Load Nextpost is defined by the wp_localize_script 946if (typeof csco_ajax_nextpost !== 'undefined') { 947 948 var objNextparent = document.querySelector('.cs-site-primary > .cs-site-content'); 949 var objNextsect = '.cs-nextpost-section'; 950 var objNextpost = null; 951 var currentNTitle = document.title; 952 var currentNLink = window.location.href; 953 var loadingNextpost = false; 954 var scrollNextpost = { 955 allow: true, 956 reallow: function () { 957 scrollNextpost.allow = true; 958 }, 959 delay: 400 //(milliseconds) adjust to the highest acceptable value 960 }; 961 962 // Init. 963 if (csco_ajax_nextpost.next_post) { 964 objNextparent.insertAdjacentHTML('afterend', '<div class="cs-nextpost-inner"></div>'); 965 objNextpost = document.querySelector('.cs-nextpost-inner'); 966 } 967} 968 969/** 970 * Get next post 971 */ 972function csco_ajax_get_nextpost() { 973 loadingNextpost = true; 974 975 // Set class loading. 976 var data = { 977 action: 'csco_ajax_load_nextpost', 978 not_in: csco_ajax_nextpost.not_in, 979 current_user: csco_ajax_nextpost.current_user, 980 nonce: csco_ajax_nextpost.nonce, 981 next_post: csco_ajax_nextpost.next_post, 982 }; 983 984 // Request Url. 985 var csco_ajax_nextpost_url; 986 if ('ajax_restapi' === csco_ajax_nextpost.type) { 987 csco_ajax_nextpost_url = csco_ajax_nextpost.rest_url; 988 } else { 989 csco_ajax_nextpost_url = csco_ajax_nextpost.url; 990 } 991 992 function encodeFormData(data) { 993 return Object.keys(data).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])).join('&'); 994 } 995 996 // Send Request. 997 fetch(csco_ajax_nextpost_url, { 998 method: 'POST', 999 body: encodeFormData(data), 1000 headers: { 1001 'Content-Type': 'application/x-www-form-urlencoded' 1002 } 1003 }) 1004 .then(response => response.json()) 1005 .then(res => { 1006 csco_ajax_nextpost.next_post = false; 1007 1008 if (res.success) { 1009 // Get the posts. 1010 var tempDiv = document.createElement('div'); 1011 tempDiv.innerHTML = res.data.content; 1012 var data = tempDiv.children; 1013 1014 // Check if there're any posts. 1015 if (data.length) { 1016 // Set the loading state. 1017 loadingNextpost = false; 1018 1019 // Set not_in. 1020 csco_ajax_nextpost.not_in = res.data.not_in; 1021 1022 // Set next data. 1023 csco_ajax_nextpost.next_post = res.data.next_post; 1024 1025 // Remove loader. 1026 var loadingElement = objNextpost.nextElementSibling; 1027 if (loadingElement && loadingElement.classList.contains('cs-nextpost-loading')) { 1028 loadingElement.remove(); 1029 } 1030 1031 // Append new post. 1032 for (var i = 0; i < data.length; i++) { 1033 objNextpost.appendChild(data[i].cloneNode(true)); 1034 } 1035 1036 // Reinit facebook. 1037 if (document.getElementById('fb-root') && typeof FB === 'object') { 1038 FB.XFBML.parse(); 1039 } 1040 1041 document.body.dispatchEvent(new Event('post-load')); 1042 } 1043 } else { 1044 // console.log(res); 1045 } 1046 }) 1047 .catch(error => { 1048 // console.log(error); 1049 }); 1050} 1051 1052/** 1053 * Check if Load Nextpost is defined by the wp_localize_script 1054 */ 1055if (typeof csco_ajax_nextpost !== 'undefined') { 1056 1057 // On Scroll Event. 1058 window.addEventListener('scroll', function () { 1059 var scrollTop = window.scrollY || window.pageYOffset; 1060 1061 // Init nextpost. 1062 if (csco_ajax_nextpost.next_post) { 1063 1064 if (objNextpost && !loadingNextpost && scrollNextpost.allow) { 1065 scrollNextpost.allow = false; 1066 setTimeout(scrollNextpost.reallow, scrollNextpost.delay); 1067 // Calc current offset. 1068 var offset = objNextpost.offsetTop + objNextpost.offsetHeight - scrollTop; 1069 // Load nextpost. 1070 if (4000 > offset) { 1071 objNextpost.insertAdjacentHTML('afterend', '<div class="cs-nextpost-loading"></div>'); 1072 1073 csco_ajax_get_nextpost(); 1074 } 1075 } 1076 } 1077 1078 // Reset browser data link. 1079 var objFirst = document.querySelector(objNextsect + ':first-child'); 1080 1081 if (objFirst) { 1082 var firstTop = objFirst.offsetTop; 1083 // If there has been a change. 1084 if (scrollTop < firstTop && window.location.href !== currentNLink) { 1085 document.title = currentNTitle; 1086 history.pushState(null, currentNTitle, currentNLink); 1087 } 1088 } 1089 1090 // Set browser data link.
1091 document.querySelectorAll(objNextsect).forEach(function (elem) { 1092 var elemTop = elem.offsetTop; 1093 var elemHeight = elem.offsetHeight; 1094 1095 if (scrollTop > elemTop && scrollTop < elemTop + elemHeight) { 1096 // If there has been a change. 1097 if (window.location.href !== elem.dataset.url) { 1098 // New title. 1099 document.title = elem.dataset.title; 1100 // New link. 1101 history.pushState(null, elem.dataset.title, elem.dataset.url); 1102 // Google Analytics. 1103 if (typeof gtag === 'function' && typeof window.gaData === 'object') { 1104 var trackingId = Object.keys(window.gaData)[0]; 1105 if (trackingId) { 1106 gtag('config', trackingId, { 1107 'page_title': elem.dataset.title, 1108 'page_location': elem.dataset.url 1109 }); 1110 1111 gtag('event', 'page_view', { 1112 'send_to': trackingId 1113 }); 1114 } 1115 } 1116 } 1117 } 1118 }); 1119 }); 1120} 1121 1122})(); 1123 1124// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1125(() => { 1126var __webpack_exports__ = {}; 1127__webpack_require__.r(__webpack_exports__); 1128/** ---------------------------------------------------------------------------- 1129 * Mega Menu */ 1130 1131document.addEventListener('DOMContentLoaded', function () { 1132 function loadMenuPosts(menuItem) { 1133 var dataTerm = menuItem.children[0].dataset.term, 1134 dataPosts = menuItem.children[0].dataset.posts, 1135 dataNumberposts = menuItem.children[0].dataset.numberposts, 1136 menuContainer, 1137 postsContainer; 1138 1139 // Containers. 1140 if (menuItem.classList.contains('cs-mega-menu-term') || menuItem.classList.contains('cs-mega-menu-posts')) { 1141 menuContainer = menuItem; 1142 postsContainer = menuContainer.querySelector('.cs-mm__posts'); 1143 } 1144 1145 if (menuItem.classList.contains('cs-mega-menu-child-term')) { 1146 menuContainer = menuItem.closest('.sub-menu'); 1147 postsContainer = menuContainer.querySelector('.cs-mm__posts[data-term="' + dataTerm + '"]'); 1148 } 1149 1150 // Check Menu Container. 1151 if (!menuContainer || typeof menuContainer === 'undefined') { 1152 return false; 1153 } 1154 1155 // Check Container. 1156 if (!postsContainer || typeof postsContainer === 'undefined') { 1157 return false; 1158 } 1159 1160 // Set Active. 1161 menuContainer.querySelectorAll('.menu-item, .cs-mm__posts').forEach(function (el) { 1162 el.classList.remove('cs-active-item'); 1163 }); 1164 1165 menuItem.classList.add('cs-active-item'); 1166 if (postsContainer) { 1167 postsContainer.classList.add('cs-active-item'); 1168 } 1169 1170 // Check Loading. 1171 if (menuItem.classList.contains('cs-mm-loading') || menuItem.classList.contains('loaded')) { 1172 return false; 1173 } 1174 1175 // Create Data. 1176 var data = { 1177 'term': dataTerm, 1178 'posts': dataPosts, 1179 'per_page': dataNumberposts 1180 }; 1181 1182 if (typeof csco_mega_menu === 'undefined') { 1183 return; 1184 } 1185 1186 // Get Results using fetch. 1187 menuItem.classList.add('cs-mm-loading'); 1188 postsContainer.classList.add('cs-mm-loading'); 1189 1190 function encodeFormData(data) { 1191 return Object.keys(data).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(data[key])).join('&'); 1192 } 1193 1194 // fetch(csco_mega_menu.rest_url) 1195 fetch(csco_mega_menu.rest_url, { 1196 method: 'POST', 1197 body: encodeFormData(data), 1198 headers: { 1199 'Content-Type': 'application/x-www-form-urlencoded' 1200 } 1201 }) 1202 .then(response => response.json()) 1203 .then(res => { 1204 if (res.status && 'success' === res.status) { 1205 // Set the loaded state. 1206 menuItem.classList.add('loaded'); 1207 postsContainer.classList.add('loaded'); 1208 1209 // Check if there're any posts. 1210 if (res.content && res.content.length) { 1211 postsContainer.innerHTML = res.content; 1212 imagesLoaded(postsContainer, function () { 1213 // Append Data. 1214 }); 1215 } 1216 } 1217 }) 1218 .catch(error => { 1219 // Handle errors. 1220 }) 1221 .finally(() => { 1222 // Set the loading state. 1223 menuItem.classList.remove('cs-mm-loading'); 1224 postsContainer.classList.remove('cs-mm-loading'); 1225 }); 1226 } 1227 1228 function getFirstTab(container) { 1229 var firstTab = false; 1230 1231 container.querySelectorAll('.cs-mega-menu-child').forEach(function (el) { 1232 if ( ! firstTab && el.classList.contains('cs-mega-menu-child')) { 1233 firstTab = el; 1234 } 1235 }); 1236 1237 return firstTab; 1238 } 1239 1240 function handleMenuHover(event) { 1241 var menuItem = event.currentTarget; 1242 1243 if (menuItem.classList.contains('cs-mega-menu-posts') || 1244 menuItem.classList.contains('cs-mega-menu-term') || 1245 menuItem.classList.contains('cs-mega-menu-child')) { 1246 loadMenuPosts(menuItem); 1247 } 1248 } 1249 1250 function handleTermsHover(event) { 1251 var menuItem = event.currentTarget; 1252 var tab = getFirstTab(menuItem); 1253 1254 if (tab) { 1255 loadMenuPosts(tab); 1256 } 1257 } 1258 1259 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-posts').forEach(function (menuItem) { 1260 menuItem.addEventListener('mouseenter', handleMenuHover); 1261 }); 1262 1263 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-term').forEach(function (menuItem) { 1264 menuItem.addEventListener('mouseenter', handleMenuHover); 1265 }); 1266 1267 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-child').forEach(function (menuItem) { 1268 menuItem.addEventListener('mouseenter', handleMenuHover); 1269 }); 1270 1271 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-terms').forEach(function (menuItem) { 1272 menuItem.addEventListener('mouseenter', handleTermsHover); 1273 }); 1274 1275 // Load First Tab on Navbar Ready. 1276 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-terms').forEach(function (menuItem) { 1277 var tab = getFirstTab(menuItem); 1278 1279 if (tab) { 1280 loadMenuPosts(tab); 1281 } 1282 }); 1283 1284 // Autoload Posts. 1285 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-posts').forEach(function (menuItem) { 1286 loadMenuPosts(menuItem); 1287 }); 1288 1289 // Autoload Term. 1290 document.querySelectorAll('.cs-header__nav .menu-item.cs-mega-menu-term').forEach(function (menuItem) { 1291 loadMenuPosts(menuItem); 1292 }); 1293}); 1294 1295})(); 1296 1297// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1298(() => { 1299var __webpack_exports__ = {}; 1300__webpack_require__.r(__webpack_exports__); 1301/** ---------------------------------------------------------------------------- 1302 * Navigation */ 1303 1304class CscoNavigation { 1305 constructor() { 1306 this.headerParams = { 1307 headerLargeHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-initial-height')), 1308 headerCompactHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height')), 1309 headerSmart: document.querySelector('.cs-navbar-smart-enabled .cs-header, .cs-navbar-sticky-enabled .cs-header'), 1310 wpAdminBar: document.querySelector('#wpadminbar'), 1311 headerBefore: document.querySelector('.cs-header-before'), 1312 headerStretch: document.querySelector('.cs-navbar-smart-enabled .cs-header-stretch'), 1313 wpAdminBarHeight: null, 1314 smartStart: null, 1315 scrollPoint: 200, 1316 scrollPrev: 200, 1317 scrollUpAmount: 0, 1318 headerSmartPosition: 0 1319 }; 1320 1321 this.initialize(); 1322 } 1323 1324 initialize() { 1325 if (document.body.classList.contains('wp-admin')) { 1326 return; 1327 } 1328 this.bindEvents(); 1329 } 1330 1331 bindEvents() { 1332 document.addEventListener('DOMContentLoaded', () => { 1333 this.smartLevels(); 1334 this.adaptTablet(); 1335 this.stickyScroll(); 1336 this.headerClassesChange(); 1337 }); 1338 1339 window.addEventListener('resize', () => { 1340 this.smartLevels(); 1341 this.adaptTablet(); 1342 this.stickyScroll(); 1343 }); 1344 } 1345 1346 smartLevels() { 1347 let windowWidth = window.innerWidth; 1348 1349 // Reset Calc. 1350 document.querySelectorAll('.cs-header__nav-inner li').forEach(el => { 1351 el.classList.remove('cs-sm__level', 'cs-sm-position-left', 'cs-sm-position-right'); 1352 }); 1353 document.querySelectorAll('.cs-header__nav-inner li .sub-menu').forEach(el => { 1354 el.classList.remove('cs-mm__position-init'); 1355 }); 1356 1357 // Set Settings. 1358 document.querySelectorAll('.cs-header__nav-inner > li.menu-item:not(.cs-mm)').forEach(parent => { 1359 let position = 'cs-sm-position-right'; //default 1360 let objPrevWidth = 0; 1361 1362 parent.querySelectorAll('.sub-menu').forEach(el => { 1363 // Reset child levels. 1364 if (el.parentElement.nextElementSibling) { 1365 el.parentElement.nextElementSibling.classList.add('cs-sm__level'); 1366 } 1367 1368 if (el.parentElement.classList.contains('cs-sm__level')) { 1369 el.parentElement.classList.remove('cs-mm-level'); 1370 position = 'cs-sm-position-right'; //reset 1371 objPrevWidth = 0; 1372 } 1373 1374 // Find out position items. 1375 let offset = el.getBoundingClientRect().left; 1376 1377 if (position === 'cs-sm-position-right' && el.offsetWidth + offset > windowWidth) { 1378 position = 'cs-sm-position-left'; 1379 } 1380 1381 if (position === 'cs-sm-position-left' && offset - (el.offsetWidth + objPrevWidth) < 0) { 1382 position = 'cs-sm-position-right'; 1383 } 1384 1385 objPrevWidth = el.offsetWidth; 1386 1387 el.classList.add('cs-sm-position-init'); 1388 el.parentElement.classList.add(position); 1389 }); 1390 }); 1391 } 1392 1393 adaptTablet() { 1394 // Click outside. 1395 document.addEventListener('touchstart', (e) => { 1396 if (!e.target.closest('.cs-header__nav-inner')) { 1397 document.querySelectorAll('.cs-header__nav-inner .menu-item-has-children').forEach(el => { 1398 el.classList.remove('submenu-visible'); 1399 }); 1400 } else { 1401 let parentMenuItem = e.target.closest('.menu-item'); 1402 if (parentMenuItem) { 1403 if (parentMenuItem.previousElementSibling) { 1404 parentMenuItem.previousElementSibling.querySelectorAll('.menu-item').forEach(el => { 1405 el.classList.remove('submenu-visible'); 1406 }); 1407 } 1408 if (parentMenuItem.nextElementSibling) { 1409 parentMenuItem.nextElementSibling.classList.remove('submenu-visible'); 1410 } 1411 } 1412 } 1413 }); 1414 1415 document.querySelectorAll('.cs-header__nav-inner .menu-item-has-children').forEach(el => { 1416 // Reset class. 1417 el.classList.remove('submenu-visible'); 1418 1419 // Remove expanded if exists. 1420 let expandedElem = el.querySelector('a > .expanded'); 1421 if (expandedElem) { 1422 expandedElem.remove(); 1423 } 1424 1425 // Add a caret. 1426 if ('ontouchstart' in document.documentElement) { 1427 let aTag = el.querySelector('a'); 1428 if (aTag) { 1429 let span = document.createElement('span'); 1430 span.className = 'expanded'; 1431 aTag.appendChild(span); 1432 } 1433 } 1434 1435 // Check touch device. 1436 if ('ontouchstart' in document.documentElement) { 1437 el.classList.add('touch-device'); 1438 } 1439 1440 let expandedElement = el.querySelector('a .expanded'); 1441 if (expandedElement) { 1442 expandedElement.addEventListener('touchstart', (e) => { 1443 e.preventDefault(); 1444 el.classList.toggle('submenu-visible'); 1445 }, { passive: false }); 1446 } 1447 1448 let anchor = el.querySelector('a'); 1449 if (anchor && anchor.getAttribute('href') === '#') { 1450 anchor.addEventListener('touchstart', (e) => { 1451 e.preventDefault(); 1452 if (!e.target.classList.contains('expanded')) { 1453 el.classList.toggle('submenu-visible'); 1454 } 1455 }, { passive: false }); 1456 } 1457 }); 1458 } 1459 1460 stickyScroll() { 1461 this.headerParams = { 1462 headerLargeHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-initial-height')), 1463 headerCompactHeight: parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height')), 1464 headerSmart: document.querySelector('.cs-navbar-smart-enabled .cs-header, .cs-navbar-sticky-enabled .cs-header'), 1465 wpAdminBar: document.querySelector('#wpadminbar'), 1466 headerBefore: document.querySelector('.cs-header-before'), 1467 headerStretch: document.querySelector('.cs-navbar-smart-enabled .cs-header-stretch'), 1468 wpAdminBarHeight: null, 1469 smartStart: null, 1470 scrollPoint: 200, 1471 scrollPrev: 200, 1472 scrollUpAmount: 0, 1473 headerSmartPosition: 0 1474 }; 1475 1476 this.headerParams.wpAdminBarHeight = this.headerParams.wpAdminBar ? this.headerParams.wpAdminBar.offsetHeight : 0; 1477 1478 if (this.headerParams.headerBefore) { 1479 this.headerParams.smartStart = this.headerParams.headerBefore.offsetTop; 1480 } else { 1481 this.headerParams.smartStart = this.headerParams.wpAdminBarHeight + (this.headerParams.headerSmart ? this.headerParams.headerSmart.offsetTop : 0); 1482 } 1483 1484 window.addEventListener('scroll', () => { 1485 let scrolled = window.scrollY; 1486 this.headerParams.headerSmartPosition = this.headerParams.headerSmart ? this.headerParams.headerSmart.offsetTop : 0; 1487 1488 if (scrolled > this.headerParams.smartStart + this.headerParams.scrollPoint + 10 && scrolled > this.headerParams.scrollPrev) { 1489 if (scrolled > this.headerParams.smartStart + this.headerParams.headerCompactHeight + 200) { 1490 document.dispatchEvent(new Event('sticky-nav-hide')); 1491 } 1492 } else { 1493 if (this.headerParams.scrollUpAmount >= this.headerParams.scrollPoint || scrolled === 0) { 1494 document.dispatchEvent(new Event('sticky-nav-visible')); 1495 } 1496 } 1497 1498 if ( this.headerParams.headerSmart ) { 1499 if ( scrolled > this.headerParams.smartStart + this.headerParams.headerCompactHeight ) { 1500 1501 document.dispatchEvent(new Event('nav-stick', { detail: this.headerParams })); 1502 1503 } else if ( this.headerParams.headerSmartPosition <= this.headerParams.smartStart ) { 1504 document.dispatchEvent(new Event('nav-unstick', { detail: this.headerParams })); 1505 } 1506 } 1507 1508 if (scrolled < this.headerParams.scrollPrev) { 1509 this.headerParams.scrollUpAmount += this.headerParams.scrollPrev - scrolled; 1510 } else { 1511 this.headerParams.scrollUpAmount = 0; 1512 } 1513 1514 if (this.headerParams.wpAdminBar && window.innerWidth <= 600 && scrolled >= this.headerParams.wpAdminBarHeight) { 1515 document.dispatchEvent(new Event('adminbar-mobile-scrolled')); 1516 } else { 1517 document.dispatchEvent(new Event('adminbar-mobile-no-scrolled')); 1518 } 1519 1520 this.headerParams.scrollPrev = scrolled; 1521 }); 1522 } 1523 1524 headerClassesChange() { 1525 document.addEventListener("sticky-nav-visible", event => { 1526 this.headerParams.headerSmart.classList.add('cs-header-smart-visible'); 1527 }); 1528 1529 document.addEventListener("sticky-nav-hide", event => { 1530 this.headerParams.headerSmart.classList.remove('cs-header-smart-visible'); 1531 }); 1532 1533 document.addEventListener("nav-stick", event => { 1534 this.headerParams.headerSmart.classList.add('cs-scroll-sticky'); 1535 }); 1536 1537 document.addEventListener("nav-unstick", event => { 1538 this.headerParams.headerSmart.classList.remove('cs-scroll-sticky', 'cs-header-smart-visible'); 1539 }); 1540 1541 document.addEventListener("adminbar-mobile-scrolled", event => { 1542 document.body.classList.add('cs-adminbar-mobile-scrolled'); 1543 }); 1544 1545 document.addEventListener("adminbar-mobile-no-scrolled", event => { 1546 document.body.classList.remove('cs-adminbar-mobile-scrolled'); 1547 }); 1548 } 1549} 1550 1551new CscoNavigation(); 1552 1553})(); 1554 1555// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1556(() => { 1557var __webpack_exports__ = {}; 1558__webpack_require__.r(__webpack_exports__); 1559/** ---------------------------------------------------------------------------- 1560 * Offcanvas */ 1561 1562(function () { 1563 const body = document.body; 1564 const headerElement = document.querySelector('.cs-header'); 1565 const offcanvasToggles = document.querySelectorAll('.cs-header__offcanvas-toggle, .cs-site-overlay, .cs-offcanvas__toggle'); 1566
1567 offcanvasToggles.forEach(offcanvasToggle => { 1568 offcanvasToggle.addEventListener('click', function (e) { 1569 e.preventDefault(); 1570 1571 if (headerElement.classList.contains('cs-search-visible')) { 1572 headerElement.classList.remove('cs-search-visible'); 1573 body.classList.remove('cs-search-active'); 1574 } 1575 1576 if (headerElement.classList.contains('cs-burger-visible')) { 1577 headerElement.classList.remove('cs-burger-visible'); 1578 body.classList.remove('cs-burger-active'); 1579 } 1580 1581 if (!body.classList.contains('cs-offcanvas-active')) { 1582 body.classList.add('cs-offcanvas-transition'); 1583 } else { 1584 setTimeout(() => { 1585 body.classList.remove('cs-offcanvas-transition'); 1586 }, 400); 1587 } 1588 1589 body.classList.toggle('cs-offcanvas-active'); 1590 }); 1591 }); 1592 1593})(); 1594 1595})(); 1596 1597// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1598(() => { 1599var __webpack_exports__ = {}; 1600__webpack_require__.r(__webpack_exports__); 1601/** ---------------------------------------------------------------------------- 1602 * Responsive Embeds */ 1603 1604(function () { 1605 /** 1606 * Add max-width & max-height to <iframe> elements, depending on their width & height props. 1607 */ 1608 function initResponsiveEmbeds() { 1609 let proportion, parentWidth; 1610 let iframes = document.querySelectorAll('.entry-content iframe'); 1611 1612 // Loop through iframe elements. 1613 iframes.forEach(iframe => { 1614 // Don't handle if the parent automatically resizes itself. 1615 if (iframe.closest('div[data-video-start], div[data-video-end]')) { 1616 return; 1617 } 1618 // Only continue if the iframe has a width & height defined. 1619 if (iframe.width && iframe.height) { 1620 // Calculate the proportion/ratio based on the width & height. 1621 proportion = parseFloat(iframe.width) / parseFloat(iframe.height); 1622 // Get the parent element's width. 1623 parentWidth = parseFloat(window.getComputedStyle(iframe.parentElement).width); 1624 // Set the max-width & height. 1625 iframe.style.maxWidth = '100%'; 1626 iframe.style.maxHeight = Math.round(parentWidth / proportion) + 'px'; 1627 } 1628 }); 1629 } 1630 1631 // Document ready. 1632 document.addEventListener('DOMContentLoaded', function () { 1633 initResponsiveEmbeds(); 1634 }); 1635 1636 // Post load. This assumes you have an event "post-load" being dispatched on the body element. 1637 document.body.addEventListener('post-load', function () { 1638 initResponsiveEmbeds(); 1639 }); 1640 1641 // Window resize. 1642 window.addEventListener('resize', function () { 1643 initResponsiveEmbeds(); 1644 }); 1645 1646 // Run on initial load. 1647 initResponsiveEmbeds(); 1648 1649})(); 1650 1651})(); 1652 1653// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1654(() => { 1655var __webpack_exports__ = {}; 1656__webpack_require__.r(__webpack_exports__); 1657/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 1658/** ---------------------------------------------------------------------------- 1659 * Color Scheme Toogle */ 1660 1661 1662 1663const cscoDarkMode = { 1664 init: function () { 1665 this.initMode(); 1666 1667 window.matchMedia('(prefers-color-scheme: dark)').addListener((e) => { 1668 this.initMode(); 1669 }); 1670 1671 document.querySelectorAll('.cs-site-scheme-toggle').forEach(toggle => { 1672 toggle.onclick = () => { 1673 if ('dark' === document.body.getAttribute('data-scheme')) { 1674 this.changeScheme('light', true); 1675 } else { 1676 this.changeScheme('dark', true); 1677 } 1678 }; 1679 }); 1680 }, 1681 1682 detectColorScheme: function (color) { 1683 var level = 190; 1684 var alpha = 1; 1685 var rgba = [255, 255, 255]; 1686 var color_rgba = false; 1687 1688 color = color.trim(); 1689 1690 // Excludes. 1691 if ( ['#0e131a'].includes( color ) ) { 1692 return 'dark'; 1693 } 1694 1695 if ('#' === color[0]) { 1696 color = color.replace('#', '').trim(); 1697 1698 if (3 === color.length) { 1699 color = color[0] + color[0] + color[1] + color[1] + color[2] + color[2]; 1700 } 1701 1702 rgba[0] = parseInt(color.substr(0, 2), 16); 1703 rgba[1] = parseInt(color.substr(2, 2), 16); 1704 rgba[2] = parseInt(color.substr(4, 2), 16); 1705 } else if ((color_rgba = color.replace(/\s/g, '').match(/^rgba?\((\d+),(\d+),(\d+),?([^,\s)]+)?/i))) { 1706 rgba[0] = parseInt(color_rgba[1]); 1707 rgba[1] = parseInt(color_rgba[2]); 1708 rgba[2] = parseInt(color_rgba[3]); 1709 1710 if (color_rgba[4] !== undefined) { 1711 alpha = parseFloat(color_rgba[4]); 1712 } 1713 } 1714
1715 rgba.forEach(function myFunction(channel, key, stack) { 1716 stack[key] = String(channel + Math.ceil((255 - channel) * (1 - alpha))).padStart(2, '0'); 1717 }); 1718 1719 var scheme = 'light'; 1720 1721 var brightness = ((rgba[0] * 299) + (rgba[1] * 587) + (rgba[2] * 114)) / 1000; 1722 1723 if (rgba[0] === rgba[1] && rgba[1] === rgba[2]) { 1724 if (brightness < level) { 1725 scheme = 'dark'; 1726 } 1727 } else { 1728 if (brightness < level) { 1729 scheme = 'inverse'; 1730 } 1731 } 1732 1733 return scheme; 1734 }, 1735 1736 setIndividualScheme: function () { 1737 var list = { 1738 '.cs-header': '--cs-header-background', 1739 '.cs-header__nav-inner .sub-menu': '--cs-header-submenu-background', 1740 '.cs-header-topbar': '--cs-header-topbar-background', 1741 '.cs-offcanvas': '--cs-offcanvas-background', 1742 '.cs-footer': '--cs-footer-background', 1743 }; 1744 1745 function createClosure(key) { 1746 return function (element) { 1747 var color = getComputedStyle(element).getPropertyValue(list[key]); 1748 var scheme = cscoDarkMode.detectColorScheme(color); 1749 element.setAttribute('data-scheme', scheme); 1750 }; 1751 } 1752 1753 for (var key in list) { 1754 if (list.hasOwnProperty(key)) { 1755 var elements = document.querySelectorAll(key); 1756 1757 if (elements.length <= 0) { 1758 continue; 1759 } 1760 1761 elements.forEach(createClosure(key)); 1762 } 1763 } 1764 }, 1765 1766 initMode: function () { 1767 let siteScheme = false; 1768 1769 switch (csLocalize.siteSchemeMode) { 1770 case 'dark': 1771 siteScheme = 'dark'; 1772 break; 1773 case 'light': 1774 siteScheme = 'light'; 1775 break; 1776 case 'system': 1777 siteScheme = 'auto'; 1778 break; 1779 } 1780 1781 if (csLocalize.siteSchemeToogle) { 1782 if ('light' === (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.csGetCookie)('_color_schema')) { 1783 siteScheme = 'light'; 1784 } 1785 if ('dark' === (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.csGetCookie)('_color_schema')) { 1786 siteScheme = 'dark'; 1787 } 1788 } 1789 1790 this.setIndividualScheme(); 1791 1792 if (siteScheme && siteScheme !== document.body.getAttribute('data-scheme')) { 1793 this.changeScheme(siteScheme, false); 1794 } 1795 }, 1796 1797 changeScheme: function (siteScheme, cookie) { 1798 document.body.classList.add('cs-scheme-toggled'); 1799 document.body.setAttribute('data-scheme', siteScheme); 1800 1801 this.setIndividualScheme(); 1802 1803 if (cookie) { 1804 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.csSetCookie)('_color_schema', siteScheme, { expires: 2592000 }); 1805 } 1806 1807 setTimeout(() => { 1808 document.body.classList.remove('cs-scheme-toggled'); 1809 }, 100); 1810 } 1811}; 1812 1813cscoDarkMode.init(); 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/** ---------------------------------------------------------------------------- 1822 * Scroll to top */ 1823 1824( function() { 1825 1826 const section = 'cs-scroll-top'; 1827 const activeClass = 'is-active'; 1828 const offset = 200; 1829 1830 const scrollToTop = () => { 1831 window.scrollTo({ top: 0, behavior: 'smooth' }); 1832 }; 1833 1834 const scrollToTopButton = document.querySelector(`.${section}`); 1835 1836 if (scrollToTopButton) { 1837 const progressPath = scrollToTopButton.querySelector(`.${section}-progress path`); 1838 const pathLength = progressPath.getTotalLength(); 1839 1840 progressPath.style.transition = progressPath.style.WebkitTransition = 'none'; 1841 progressPath.style.strokeDasharray = `${pathLength} ${pathLength}`; 1842 progressPath.style.strokeDashoffset = pathLength; 1843 progressPath.getBoundingClientRect(); 1844 progressPath.style.transition = progressPath.style.WebkitTransition = 'stroke-dashoffset 10ms linear'; 1845 1846 const updateProgress = function () { 1847 const scroll = window.scrollY || window.scrollTop || document.documentElement.scrollTop; 1848 const docHeight = Math.max( 1849 document.body.scrollHeight, 1850 document.documentElement.scrollHeight, 1851 document.body.offsetHeight, 1852 document.documentElement.offsetHeight, 1853 document.body.clientHeight, 1854 document.documentElement.clientHeight 1855 ); 1856 const windowHeight = Math.max( 1857 document.documentElement.clientHeight, 1858 window.innerHeight || 0 1859 ); 1860 const height = docHeight - windowHeight; 1861 var progress = pathLength - (scroll * pathLength) / height; 1862 progressPath.style.strokeDashoffset = progress; 1863 }; 1864 1865 updateProgress(); 1866 1867 scrollToTopButton.addEventListener('click', scrollToTop); 1868 1869 window.addEventListener('scroll', () => { 1870 updateProgress(); 1871 1872 const scrollPos = window.scrollY || window.scrollTop || document.getElementsByTagName('html')[0].scrollTop; 1873 if (scrollPos > offset) { 1874 scrollToTopButton.classList.add(activeClass); 1875 } else { 1876 scrollToTopButton.classList.remove(activeClass); 1877 } 1878 }); 1879 } 1880 1881} )(); 1882 1883})(); 1884 1885// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1886(() => { 1887var __webpack_exports__ = {}; 1888__webpack_require__.r(__webpack_exports__); 1889/** ---------------------------------------------------------------------------- 1890 * Sticky Sidebar */ 1891 1892(function() { 1893 let stickyElementsSmart = [], 1894 stickyElements = []; 1895 1896 stickyElementsSmart.push( 1897 '.cs-navbar-smart-enabled.cs-stick-to-top .cs-single-product .entry-summary', 1898 '.cs-sticky-sidebar-enabled.cs-navbar-smart-enabled.cs-stick-to-top .cs-sidebar__inner', 1899 '.cs-sticky-sidebar-enabled.cs-navbar-smart-enabled.cs-stick-last .cs-sidebar__inner .widget:last-child' 1900 ); 1901 1902 stickyElements.push( 1903 '.cs-navbar-sticky-enabled.cs-stick-to-top .cs-single-product .entry-summary', 1904 '.cs-sticky-sidebar-enabled.cs-navbar-sticky-enabled.cs-stick-to-top .cs-sidebar__inner', 1905 '.cs-sticky-sidebar-enabled.cs-navbar-sticky-enabled.cs-stick-last .cs-sidebar__inner .widget:last-child' 1906 ); 1907 1908 document.addEventListener("DOMContentLoaded", function() { 1909 let headerStick = document.querySelector('.cs-header'), 1910 wpAdminBar = document.querySelector('#wpadminbar'), 1911 headerStickHeight = headerStick ? headerStick.offsetHeight : 0, 1912 wpAdminBarHeight = wpAdminBar ? wpAdminBar.offsetHeight : 0, 1913 headerStretch = document.querySelector('.cs-header-stretch'), 1914 headerStretchHeight = headerStretch ? headerStretch.offsetHeight : 0, 1915 allHeight = headerStickHeight + wpAdminBarHeight + 20, 1916 windowWidth = window.innerWidth; 1917 1918 if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) { 1919 stickyElementsSmart.push('.cs-sticky-sidebar-enabled.cs-stick-to-bottom .cs-sidebar__inner'); 1920 stickyElements.push('.cs-sticky-sidebar-enabled.cs-stick-to-bottom .cs-sidebar__inner'); 1921 } 1922 1923 stickyElementsSmart = stickyElementsSmart.join(','); 1924 stickyElements = stickyElements.join(','); 1925 1926 document.addEventListener('sticky-nav-visible', function() { 1927 headerStickHeight = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height'));
1928 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + 20; 1929 1930 document.querySelectorAll(stickyElementsSmart).forEach(el => { 1931 el.style.top = allHeight + 'px'; 1932 }); 1933 }); 1934 1935 document.addEventListener('sticky-nav-hide', function() { 1936 headerStickHeight = 0; 1937 allHeight = (headerStickHeight || 0) + (wpAdminBarHeight || 0) + 20; 1938 1939 document.querySelectorAll(stickyElementsSmart).forEach(el => { 1940 el.style.top = allHeight + 'px'; 1941 }); 1942 }); 1943 1944 document.addEventListener('stretch-nav-to-small', function() { 1945 headerStretchHeight = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-height')); 1946 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + 20; 1947 1948 if (headerStretch && headerStretch.classList.contains("cs-scroll-sticky") && !headerStretch.classList.contains("cs-scroll-active")) { 1949 document.querySelectorAll(stickyElementsSmart).forEach(el => { 1950 el.style.top = allHeight + 'px'; 1951 }); 1952 } 1953 }); 1954 1955 document.addEventListener('stretch-nav-to-big', function() { 1956 headerStretchHeight = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--cs-header-initial-height')); 1957 }); 1958 1959 if (document.body.classList.contains('cs-navbar-smart-enabled') && windowWidth >= 1020) { 1960 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + 20; 1961 1962 document.querySelectorAll(stickyElementsSmart).forEach(el => { 1963 el.style.top = allHeight + 'px'; 1964 }); 1965 } else if (document.body.classList.contains('cs-navbar-sticky-enabled') && windowWidth >= 1020) { 1966 allHeight = (headerStretchHeight || 0) + (wpAdminBarHeight || 0) + 20; 1967 1968 document.querySelectorAll(stickyElements).forEach(el => { 1969 el.style.top = allHeight + 'px'; 1970 }); 1971 } 1972 1973 window.addEventListener('resize', function() { 1974 let windowWidthResize = window.innerWidth; 1975 if (windowWidthResize < 1020) { 1976 document.querySelectorAll(stickyElements).forEach(el => { 1977 el.removeAttribute('style'); 1978 }); 1979 document.querySelectorAll(stickyElementsSmart).forEach(el => { 1980 el.removeAttribute('style'); 1981 }); 1982 } 1983 }); 1984 }); 1985})(); 1986 1987})(); 1988 1989// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 1990(() => { 1991var __webpack_exports__ = {}; 1992__webpack_require__.r(__webpack_exports__); 1993/** ---------------------------------------------------------------------------- 1994 * Post Tabs */ 1995 1996(function () { 1997 1998 const sectionName = 'cs-tabs'; 1999 const sections = document.querySelectorAll(`.${sectionName}`); 2000 2001 if (0 === sections.length) { 2002 return; 2003 } 2004 2005 sections.forEach(section => { 2006 2007 const tabs = section.querySelectorAll(`.${sectionName}__tab`); 2008 const postAreas = section.querySelectorAll('.cs-posts-area'); 2009
2010 tabs.forEach((tab, index) => { 2011 tab.addEventListener('click', function () { 2012 tabs.forEach(t => { 2013 t.classList.remove(`${sectionName}__tab-active`); 2014 }); 2015 2016 postAreas.forEach(area => { 2017 area.classList.remove('cs-posts-area-active'); 2018 }); 2019 2020 tab.classList.add(`${sectionName}__tab-active`); 2021 postAreas[index].classList.add('cs-posts-area-active'); 2022 }); 2023 }); 2024 2025 }); 2026 2027})(); 2028 2029})(); 2030 2031// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2032(() => { 2033var __webpack_exports__ = {}; 2034__webpack_require__.r(__webpack_exports__); 2035/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 2036/** ---------------------------------------------------------------------------- 2037 * Video Background */ 2038 2039 2040 2041(function () { 2042 var initAPI = false; 2043 var process = false; 2044 var contex = []; 2045 var players = []; 2046 var attrs = []; 2047 2048 // Create deferred object 2049 var YTdeferred = new Promise(function (resolve) { 2050 window.onYouTubePlayerAPIReady = function () { 2051 resolve(window.YT); 2052 }; 2053 }); 2054 2055 // Embedding youtube iframe api. 2056 function embedYoutubeAPI() { 2057 document.querySelectorAll('.cs-video-inner').forEach(function (el) { 2058 if ( (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.isInViewport)(el) ) { 2059 var tag = document.createElement('script'); 2060 tag.src = 'https://www.youtube.com/iframe_api'; 2061 var firstScriptTag = document.getElementsByTagName('script')[0]; 2062 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 2063 initAPI = true; 2064 } 2065 }); 2066 } 2067 2068 // Video rescale. 2069 function rescaleVideoBackground() { 2070 document.querySelectorAll('.cs-video-init').forEach(function (el) { 2071 var w = el.parentElement.offsetWidth; 2072 var h = el.parentElement.offsetHeight; 2073 var hideControl = 400; 2074 var id = el.getAttribute('data-uid'); 2075 2076 if (w / h > 16 / 9) { 2077 players[id].setSize(w, w / 16 * 9 + hideControl); 2078 } else { 2079 players[id].setSize(h / 9 * 16, h + hideControl); 2080 } 2081 }); 2082 } 2083 2084 // Init video background. 2085 function initVideoBackground() { 2086 if (document.body.classList.contains('wp-admin')) { 2087 return; 2088 } 2089 2090 if (process) { 2091 return; 2092 } 2093 2094 process = true; 2095 2096 // Smart init API. 2097 if (!initAPI) { 2098 var elements = document.querySelectorAll('.cs-video-wrapper[data-vi
2098deo-id]'); 2099 2100 if (elements.length) { 2101 embedYoutubeAPI(); 2102 } 2103 } 2104 2105 if (!initAPI) { 2106 process = false; 2107 return; 2108 } 2109 2110 // Whenever youtube callback was called = deferred resolved 2111 // your custom function will be executed with YT as an argument. 2112 YTdeferred.then(function (YT) { 2113 document.querySelectorAll('.cs-video-inner').forEach(function (el) { 2114 var isInit = el.classList.contains('cs-video-init'); 2115 var id = null; 2116 2117 if (!isInit) { 2118 id = Math.random().toString(36).substr(2, 9); 2119 } else { 2120 id = el.getAttribute('data-uid'); 2121 } 2122 2123 contex[id] = el; 2124 var isActive = contex[id].classList.contains('active'); 2125 var isInView = (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.isInViewport)(contex[id]); 2126 2127 if (isInView && !isInit) { 2128 contex[id].classList.add('cs-video-init'); 2129 contex[id].setAttribute('data-uid', id); 2130 2131 var videoID = contex[id].parentElement.dataset.videoId; 2132 var videoStart = contex[id].parentElement.dataset.videoStart; 2133 var videoEnd = contex[id].parentElement.dataset.videoEnd; 2134 2135 if (typeof videoID === 'undefined' || !videoID) { 2136 return; 2137 } 2138 2139 attrs[id] = { 2140 'videoId': videoID, 2141 'startSeconds': videoStart, 2142 'endSeconds': videoEnd, 2143 'suggestedQuality': 'hd720' 2144 }; 2145 2146 players[id] = new YT.Player(contex[id], { 2147 playerVars: { 2148 autoplay: 0, 2149 autohide: 1, 2150 modestbranding: 1, 2151 rel: 0, 2152 showinfo: 0, 2153 controls: 0, 2154 disablekb: 1, 2155 enablejsapi: 0, 2156 iv_load_policy: 3, 2157 playsinline: 1, 2158 loop: 1 2159 }, 2160 events: { 2161 'onReady': function () { 2162 players[id].loadVideoById(attrs[id]); 2163 players[id].mute(); 2164 }, 2165 'onStateChange': function (e) { 2166 if (e.data === 1) { 2167 var parentElement = contex[id].closest('.cs-overlay, .cs-video-wrap'); 2168 2169 if (parentElement) { 2170 parentElement.classList.add('cs-video-bg-init'); 2171 } 2172 2173 contex[id].classList.add('active'); 2174 } else if (e.data === 0) { 2175 players[id].seekTo(attrs[id].startSeconds); 2176 } 2177 } 2178 } 2179 }); 2180 rescaleVideoBackground(); 2181 } 2182 2183 var parentElement = contex[id].closest('.cs-overlay, .cs-video-wrap'); 2184 if (isActive && isInit && !parentElement.querySelector('.cs-player-state').classList.contains('cs-player-upause')) { 2185 var control = parentElement.querySelector('.cs-player-state'); 2186 2187 if (control) { 2188 if (isInView && control.classList.contains('cs-player-play')) { 2189 control.classList.remove('cs-player-play'); 2190 control.classList.add('cs-player-pause'); 2191 players[id].playVideo(); 2192 } 2193 2194 if (!isInView && control.classList.contains('cs-player-pause')) { 2195 control.classList.remove('cs-player-pause'); 2196 control.classList.add('cs-player-play'); 2197 players[id].pauseVideo(); 2198 } 2199 } 2200 } 2201 }); 2202 }); 2203 2204 process = false; 2205 } 2206 2207 // State Control. 2208 document.addEventListener('click', function (event) { 2209 if (event.target.classList.contains('cs-player-state')) { 2210 var container = event.target.closest('.cs-overlay, .cs-video-wrap').querySelector('.cs-video-inner'); 2211 var id = container.getAttribute('data-uid'); 2212 2213 event.target.classList.toggle('cs-player-pause'); 2214 event.target.classList.toggle('cs-player-play'); 2215 2216 if (event.target.classList.contains('cs-player-pause')) { 2217 event.target.classList.remove('cs-player-upause'); 2218 players[id].playVideo(); 2219 } else { 2220 event.target.classList.add('cs-player-upause'); 2221 players[id].pauseVideo(); 2222 } 2223 } 2224 }); 2225 2226 // Stop Control. 2227 document.addEventListener('click', function (event) { 2228 if (event.target.classList.contains('cs-player-stop')) { 2229 var container = event.target.closest('.cs-overlay, .cs-video-wrap').querySelector('.cs-video-inner'); 2230 var id = container.getAttribute('data-uid'); 2231 2232 var stateControl = event.target.nextElementSibling; 2233 stateControl.classList.remove('cs-player-pause'); 2234 stateControl.classList.add('cs-player-play', 'cs-player-upause'); 2235 2236 players[id].pauseVideo(); 2237 } 2238 }); 2239 2240 // Volume Control. 2241 document.addEventListener('click', function (event) { 2242 if (event.target.classList.contains('cs-player-volume')) { 2243 var container = event.target.closest('.cs-overlay, .cs-video-wrap').querySelector('.cs-video-inner'); 2244 var id = container.getAttribute('data-uid'); 2245 2246 event.target.classList.toggle('cs-player-mute'); 2247 event.target.classList.toggle('cs-player-unmute'); 2248 2249 if (event.target.classList.contains('cs-player-unmute')) { 2250 players[id].unMute(); 2251 } else { 2252 players[id].mute(); 2253 } 2254 } 2255 }); 2256 2257 // Document scroll.
2258 window.addEventListener('load', initVideoBackground); 2259 window.addEventListener('scroll', initVideoBackground); 2260 window.addEventListener('resize', initVideoBackground); 2261 window.addEventListener('scrollstop', initVideoBackground); 2262 2263 // Document ready. 2264 document.addEventListener('DOMContentLoaded', function () { 2265 initVideoBackground(); 2266 }); 2267 2268 // Post load. 2269 document.body.addEventListener('post-load', function () { 2270 initVideoBackground(); 2271 }); 2272 2273 // Document resize. 2274 window.addEventListener('resize', rescaleVideoBackground); 2275 2276 // Init. 2277 initVideoBackground(); 2278})(); 2279 2280})(); 2281 2282// This entry need to be wrapped in an IIFE because it need to be isolated against other entry modules. 2283(() => { 2284__webpack_require__.r(__webpack_exports__); 2285/* harmony import */ var _utility_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); 2286/** ---------------------------------------------------------------------------- 2287 * Widget Nav Menu */ 2288 2289 2290 2291(function () { 2292 2293 HTMLElement.prototype.responsiveNav = function () { 2294 this.classList.remove('menu-item-expanded'); 2295 let previousElement = this.previousElementSibling; 2296 2297 if (previousElement && previousElement.classList.contains('submenu-visible')) { 2298 previousElement.classList.remove('submenu-visible'); 2299 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideUp)(previousElement); 2300 this.parentElement.classList.remove('menu-item-expanded'); 2301 } else { 2302 let parentOfParent = this.parentElement.parentElement; 2303 2304 parentOfParent.querySelectorAll('.menu-item .sub-menu').forEach(subMenu => { 2305 subMenu.classList.remove('submenu-visible'); 2306 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideUp)(subMenu); 2307 }); 2308 2309 parentOfParent.querySelectorAll('.menu-item-expanded').forEach(item => { 2310 item.classList.remove('menu-item-expanded'); 2311 }); 2312 2313 if (previousElement) { 2314 previousElement.classList.toggle('submenu-visible'); 2315 (0,_utility_js__WEBPACK_IMPORTED_MODULE_0__.slideToggle)(previousElement); 2316 } 2317 2318 this.parentElement.classList.toggle('menu-item-expanded'); 2319 } 2320 }; 2321 2322 document.addEventListener('DOMContentLoaded', function () { 2323 let menuItems = document.querySelectorAll('.widget_nav_menu .menu-item-has-children'); 2324 2325 menuItems.forEach(menuItem => { 2326 let span = document.createElement('span'); 2327 menuItem.appendChild(span); 2328 2329 span.addEventListener('click', function (e) { 2330 e.preventDefault(); 2331 this.responsiveNav(); 2332 }); 2333 2334 let anchor = menuItem.children[0]; 2335 if (anchor && anchor.tagName === 'A' && anchor.getAttribute('href') === '#') { 2336 anchor.addEventListener('click', function (e) { 2337 e.preventDefault(); 2338 this.nextElementSibling.nextElementSibling.responsiveNav(); 2339 }); 2340 } 2341 }); 2342 }); 2343 2344})(); 2345 2346})(); 2347 2348/******/ })() 2349;
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.