/******/ (() => { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./src/modules/CollapsePanel.js": /*!**************************************!*\ !*** ./src/modules/CollapsePanel.js ***! \**************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); class CollapsePanel { constructor() { this.init(); } init() { document.addEventListener('DOMContentLoaded', () => { this.addToggleCollapseListener('.accordion-toggle'); }); } addToggleCollapseListener(selector) { this.toggles = document.querySelectorAll(selector); this.toggles.forEach(toggle => { toggle.addEventListener('click', () => { toggle.parentNode.parentNode.classList.toggle('active'); }); }); } } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CollapsePanel); /***/ }), /***/ "./src/modules/CustomRangeSlider.js": /*!******************************************!*\ !*** ./src/modules/CustomRangeSlider.js ***! \******************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); class CustomRangeSlider { constructor() { this.init(); } init() { this.customRangeSlider(); } customRangeSlider() { const rangeSliders = document.querySelectorAll('.range-slider'); rangeSliders.forEach(range => { range.addEventListener('input', e => { const value = +e.target.value; const label = e.target.nextElementSibling; const range_width = getComputedStyle(e.target).getPropertyValue('width'); const label_width = getComputedStyle(label).getPropertyValue('width'); const num_width = +range_width.substring(0, range_width.length - 2); const num_label_width = +label_width.substring(0, label_width.length - 2); const max = +e.target.max; const min = +e.target.min; const left = value * (num_width / max) - num_label_width / 2 + scale(value, min, max, 10, -10); label.style.left = `${left}px`; label.innerHTML = value; }); }); // https://stackoverflow.com/questions/10756313/javascript-jquery-map-a-range-of-numbers-to-another-range-of-numbers const scale = (num, in_min, in_max, out_min, out_max) => { return (num - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; }; } } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CustomRangeSlider); /***/ }), /***/ "./src/modules/NavControl.js": /*!***********************************!*\ !*** ./src/modules/NavControl.js ***! \***********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); class NavControl { constructor() { this.toggleMenuBtn = document.getElementById('toggle-nav'); this.toggleSlideOutMenu = document.getElementById('slide-out-menu'); this.accordions = document.querySelectorAll('#slide-out-menu .accordion'); this.toggleSearchBtn = document.getElementById('toggle-search'); this.headerSearch = document.getElementById('header-search'); this.hoursDropdownToggle = document.getElementById('hours-dropdown-toggle'); this.todaysBusinessHoursEl = document.getElementById('todays-business-hours'); this.businessHoursMenu = this.hoursDropdownToggle.nextElementSibling; this.init(); } init() { document.addEventListener('DOMContentLoaded', () => { // Add link click listeners this.addLinkClickListener('a'); // Open and Close the Nav Menu this.toggleMenuBtn.addEventListener('click', () => this.toggleNavMenu()); // Open and Close the Nav Search // this.toggleSearchBtn.addEventListener('click', () => this.toggleSearch()); document.addEventListener('click', event => this.handleOutsideClick(event)); this.businessHours(); }); } addLinkClickListener(selector) { this.links = document.querySelectorAll(selector); this.links.forEach(link => { link.addEventListener('click', e => { if (link.href === window.location.href) { return; } if (this.toggleMenuBtn.classList.contains('active')) { this.navControl.toggleNavMenu(); } if (!this.isExternalLink(link) && this.isWordPressAdminLink(link)) { window.location.href = link.href; // Navigate normally } else if (!this.isExternalLink(link)) { this.animatePageTransition(() => { this.loadContent(link.href, 'content-container'); // window.location.href = link.href }); } else if (this.isExternalLink(link)) { link.setAttribute('target', '_blank'); window.open(link.href, '_system'); } }); }); } isExternalLink(link) { const currentDomain = window.location.hostname; const linkDomain = link.hostname; return linkDomain !== currentDomain; } toggleNavMenu() { this.toggleMenuBtn.classList.toggle('active'); this.toggleSlideOutMenu.classList.toggle('open'); document.body.classList.toggle('noScroll'); this.collapseAllAccordions(); } toggleSearch() { this.headerSearch.classList.toggle('active'); this.headerSearch.querySelector('input').focus(); if (this.headerSearch.classList.contains('active')) { this.headerSearch.querySelector('input').value = ''; } if (this.toggleMenuBtn.classList.contains('active')) { this.toggleNavMenu(); } } collapseAllAccordions() { setTimeout(() => { this.accordions.forEach(accordion => { accordion.classList.remove('active'); }); }, 600); } handleOutsideClick(event) { if (!this.toggleMenuBtn.contains(event.target) && !this.toggleSlideOutMenu.contains(event.target) && !event.target.classList.contains('accordion')) { // Click is outside the menu and toggle button this.toggleMenuBtn.classList.remove('active'); this.toggleSlideOutMenu.classList.remove('open'); document.body.classList.remove('noScroll'); } if (!this.hoursDropdownToggle.contains(event.target) && !this.hoursDropdownToggle.classList.contains('hidden')) { // Click is outside the business hours toggle button this.businessHoursMenu.classList.add('hidden'); } // if ( // !this.toggleSearchBtn.contains(event.target) && // !this.headerSearch.contains(event.target) // ) { // // Click is input the menu and search button // this.toggleSearchBtn.classList.remove('active'); // this.headerSearch.classList.remove('active'); // document.body.classList.remove('noScroll'); // } } // Handle Business Hours businessHours() { const dayOfWeek = new Date().getDay(); const defaultHours = 'Open Today from 10:00am - 6:00pm'; let todaysBusinessHours; switch (dayOfWeek) { case 0: // Sunday todaysBusinessHours = 'We are closed today.'; break; case 6: // Saturday todaysBusinessHours = 'Open Today from 10:00am - 5:00pm'; break; default: // Monday to Friday todaysBusinessHours = defaultHours; break; } this.todaysBusinessHoursEl.innerHTML = todaysBusinessHours; this.hoursDropdownToggle.addEventListener('click', () => { this.businessHoursMenu.classList.toggle('hidden'); }); } } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (NavControl); /***/ }), /***/ "./src/modules/TestModule.js": /*!***********************************!*\ !*** ./src/modules/TestModule.js ***! \***********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); class Test { constructor() { console.log('This Module is for testing purposes'); } } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Test); /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ (() => { /******/ // define __esModule on exports /******/ __webpack_require__.r = (exports) => { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. (() => { /*!**********************!*\ !*** ./src/index.js ***! \**********************/ __webpack_require__.r(__webpack_exports__); /* harmony import */ var _modules_CollapsePanel__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./modules/CollapsePanel */ "./src/modules/CollapsePanel.js"); /* harmony import */ var _modules_CustomRangeSlider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./modules/CustomRangeSlider */ "./src/modules/CustomRangeSlider.js"); /* harmony import */ var _modules_NavControl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./modules/NavControl */ "./src/modules/NavControl.js"); /* harmony import */ var _modules_TestModule__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./modules/TestModule */ "./src/modules/TestModule.js"); // Our modules / classes // Import modules e.g import MobileMenu from "./modules/MobileMenu" // Instantiate a new object using our modules/classes // e.g var mobileMenu = new MobileMenu() const collapsePanel = new _modules_CollapsePanel__WEBPACK_IMPORTED_MODULE_0__["default"](); const customRangeSlider = new _modules_CustomRangeSlider__WEBPACK_IMPORTED_MODULE_1__["default"](); const navControl = new _modules_NavControl__WEBPACK_IMPORTED_MODULE_2__["default"](); const testModule = new _modules_TestModule__WEBPACK_IMPORTED_MODULE_3__["default"](); })(); /******/ })() ; //# sourceMappingURL=index.js.map