/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/normalize.css/normalize.css": /*!**************************************************!*\ !*** ./node_modules/normalize.css/normalize.css ***! \**************************************************/ /***/ (() => { eval("throw new Error(\"Module parse failed: Unexpected token (11:5)\\nYou may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders\\n| */\\n| \\n> html {\\n| line-height: 1.15; /* 1 */\\n| -webkit-text-size-adjust: 100%; /* 2 */\");\n\n//# sourceURL=webpack://aspace/./node_modules/normalize.css/normalize.css?"); /***/ }), /***/ "./src/index.js": /*!**********************!*\ !*** ./src/index.js ***! \**********************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var normalize_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! normalize.css */ \"./node_modules/normalize.css/normalize.css\");\n/* harmony import */ var normalize_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(normalize_css__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _sass_front_end_bunde_scss__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./sass/front-end-bunde.scss */ \"./src/sass/front-end-bunde.scss\");\n/* harmony import */ var _sass_front_end_bunde_scss__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_sass_front_end_bunde_scss__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var _js_core_events__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./js/core/events */ \"./src/js/core/events.js\");\n/* harmony import */ var _js_core_objectfitFallback__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./js/core/objectfitFallback */ \"./src/js/core/objectfitFallback.js\");\n/* harmony import */ var _js_core_objectfitFallback__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_js_core_objectfitFallback__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var _js_core_sidebar__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./js/core/sidebar */ \"./src/js/core/sidebar.js\");\n/* harmony import */ var _js_core_sidebar__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_js_core_sidebar__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var _js_core_navigation__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./js/core/navigation */ \"./src/js/core/navigation.js\");\n/* harmony import */ var _js_core_panel_left__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./js/core/panel-left */ \"./src/js/core/panel-left.js\");\n/* harmony import */ var _js_core_panel_left__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_js_core_panel_left__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var _js_core_smooth_scroll__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./js/core/smooth-scroll */ \"./src/js/core/smooth-scroll.js\");\n/* harmony import */ var _js_core_smooth_scroll__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_js_core_smooth_scroll__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _js_core_icons__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./js/core/icons */ \"./src/js/core/icons.js\");\n/* harmony import */ var _js_core_icons__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_js_core_icons__WEBPACK_IMPORTED_MODULE_8__);\n/* harmony import */ var _js_core_responsive_iframe__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./js/core/responsive-iframe */ \"./src/js/core/responsive-iframe.js\");\nObject(function webpackMissingModule() { var e = new Error(\"Cannot find module '../inc/**/_?*.js'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\nObject(function webpackMissingModule() { var e = new Error(\"Cannot find module './parts/**/_?*.js'\"); e.code = 'MODULE_NOT_FOUND'; throw e; }());\n\n\n//ADDING SASS\n//add your sass files easilt by starting them with an underscore inside the inc or parts folders\n// You can also manually add a regular file to the front end bundle so you have access to all scss variables and classes\n//adding a separate scss here will work, but you wont have access to scss variables or @use, or @extend\n\n\n//js from src\n\n\n\n\n\n\n\n\n\n\n//add all underscored js files from inc and parts\n\n\n\n\n\n\n//# sourceURL=webpack://aspace/./src/index.js?"); /***/ }), /***/ "./src/js/core/events.js": /*!*******************************!*\ !*** ./src/js/core/events.js ***! \*******************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setup */ \"./src/js/core/setup.js\");\n\n\n/*--------------------------------------------------------------\n# Adding some global events and functions users can use via data attributes\n--------------------------------------------------------------*/\n\n/**\n * resize menu buttons on load. also runs on resize.\n * menu button is not inside site-top for various reasons (we dont want x to be inside or when menu opens the ex is uinderneath.\n * so we use this function to match the site -top height and center it as if it was inside\n */\n\nlet menuButtons = '';\n\nfunction placeMenuButtons() {\n\tlet $siteTopHeight = document.querySelector('.site-top');\n\n\tif($siteTopHeight != null){\n\t\t$siteTopHeight = $siteTopHeight.clientHeight;\n\t}\n\n\t// let adminbar = document.querySelector(' ');\n\t// let adminbarHeight = 0;\n\t//\n\t// if (adminbar !== null) {\n\t// \tadminbarHeight = adminbar.clientHeight;\n\t// }\n\n\tif (menuButtons.length) {\n\t\tmenuButtons.forEach(button => {\n\t\t\tbutton.style.height = $siteTopHeight + 'px';\n\t\t});\n\t}\n}\n\n/*--------------------------------------------------------------\n# IGN Events\n--------------------------------------------------------------*/\n\ndocument.addEventListener('DOMContentLoaded', function () {\n\n\t/*------- Add touch classes or not --------*/\n\tif (!(\"ontouchstart\" in document.documentElement)) {\n\t\tdocument.documentElement.className += \" no-touch-device\";\n\t} else {\n\t\tdocument.documentElement.className += \" touch-device\";\n\t}\n\n\t/*------- menu buttons --------*/\n\t//if the menu button is outside site-top. get both buttons for centering both.\n\tif (!document.querySelector('.app-menu')) {\n\t\tmenuButtons = document.querySelectorAll('.panel-left-toggle, .panel-right-toggle');\n\t} else {\n\t\t//otherwise the menu button does not need to be centered because its part of the app menu and moves. (moved in navigation.js)\n\t\tmenuButtons = document.querySelectorAll('.panel-right-toggle');\n\t}\n\t//we run menu button function below in resize event\n\n\n\t/*------- Toggle Buttons --------*/\n\n\t//trigger optional afterToggle event\n\t//adding new custom event for after the element is toggled\n\tlet toggleEvent = null;\n\tif (isIE11) {\n\t\ttoggleEvent = document.createEvent('Event');\n\n\t\t// Define that the event name is 'build'.\n\t\ttoggleEvent.initEvent('afterToggle', true, true);\n\n\t} else {\n\t\ttoggleEvent = new Event('afterToggle', {bubbles: true}); //bubble allows for delegation on body\n\t}\n\n\n\t//add aria to buttons currently on page\n\tlet buttons = document.querySelectorAll('[data-toggle]');\n\tbuttons.forEach(button => {\n\t\tbutton.setAttribute('role', 'switch');\n\t\tbutton.setAttribute('aria-checked', button.classList.contains('toggled-on') ? 'true' : 'false');\n\n\t});\n\n\n\t//toggling the buttons with delegation click\n\tdocument.body.addEventListener('click', e => {\n\n\t\tlet item = e.target.closest('[data-toggle]');\n\n\t\tif (item) {\n\n\t\t\tlet $doDefault = item.getAttribute('data-default');\n\t\t\t//normally we prevent default unless someone add data-default\n\t\t\tif (null === $doDefault) {\n\t\t\t\te.preventDefault();\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\n\t\t\t//if data-radio is found, only one can be selected at a time.\n\t\t\t// untoggles any other item with same radio value\n\t\t\t//radio items cannot be untoggled until another item is clicked\n\t\t\tlet radioSelector = item.getAttribute('data-radio');\n\n\n\t\t\tif (radioSelector !== null) {\n\t\t\t\tlet radioSelectors = document.querySelectorAll(`[data-radio=\"${radioSelector}\"]`);\n\n\t\t\t\tradioSelectors.forEach(radioItem => {\n\t\t\t\t\tif (radioItem !== item && radioItem.classList.contains('toggled-on')) {\n\t\t\t\t\t\ttoggleItem(radioItem); //toggle all other radio items off when this one is being turned on\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t//if item has data-switch it can only be turned on or off but not both by this button based on value of data-switch (its either on or off)\n\t\t\tlet switchItem = item.getAttribute('data-switch');\n\n\t\t\t//finally toggle the clicked item. some types of items cannot be untoggled like radio or an on switch\n\t\t\tif (radioSelector !== null) {\n\t\t\t\ttoggleItem(item, 'on'); //the item clicked on cannot be unclicked until another item is pressed\n\t\t\t} else if (switchItem !== null) {\n\t\t\t\tif (switchItem === 'on') {\n\t\t\t\t\ttoggleItem(item, 'on');\n\t\t\t\t} else {\n\t\t\t\t\ttoggleItem(item, 'off');\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttoggleItem(item); //normal regular toggle can turn itself on or off\n\t\t\t}\n\n\t\t} //end if item found\n\t});\n\n\t//actual toggle of an item and add class toggled-on and any other classes needed. Also do a slide if necessary\n\tfunction toggleItem(item, forcedState = 'none') {\n\n\t\t//toggle item\n\t\tif (forcedState === 'on') {\n\t\t\titem.classList.add('toggled-on'); //radio or data-switch of on will always toggle-on\n\t\t} else if (forcedState === 'off') {\n\t\t\titem.classList.remove('toggled-on'); //data-switch of off will always toggle off\n\t\t} else {\n\t\t\titem.classList.toggle('toggled-on'); //basic data toggle item\n\t\t}\n\n\t\t//is item toggled? used for the rest of this function to toggle another target if needed.\n\t\tlet isToggled = item.classList.contains('toggled-on');\n\n\t\titem.setAttribute('aria-expanded', isToggled ? 'true' : 'false');\n\n\t\t//get class to add to this item or another\n\t\tlet $class = item.getAttribute('data-toggle'),\n\t\t\t$target = document.querySelectorAll(item.getAttribute('data-target'));\n\n\t\tif ($class === null || !$class) {\n\t\t\t$class = 'toggled-on'; //default class added is toggled-on\n\t\t}\n\t\t//special class added to another item\n\t\tif ($target.length) {\n\t\t\t$target.forEach(targetItem => {\n\t\t\t\tif (isToggled) {\n\t\t\t\t\ttargetItem.classList.add($class);\n\t\t\t\t} else {\n\t\t\t\t\ttargetItem.classList.remove($class);\n\t\t\t\t}\n\n\t\t\t\ttargetItem.setAttribute('aria-expanded', isToggled ? 'true' : 'false');\n\n\t\t\t\t//data slide open or closed\n\t\t\t\tif (targetItem.dataset.slide !== undefined) {\n\n\t\t\t\t\tlet slideTime = (targetItem.dataset.slide) ? parseFloat(targetItem.dataset.slide) : .5;\n\n\t\t\t\t\tif (isToggled) {\n\t\t\t\t\t\t(0,_setup__WEBPACK_IMPORTED_MODULE_0__.ignSlideDown)(targetItem, slideTime);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tignSlideUp(targetItem, slideTime);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//allow event to happen after click for the targeted item\n\t\t\t\ttargetItem.dispatchEvent(toggleEvent);\n\t\t\t});\n\t\t} else { //applies class to the clicked item, there is no target\n\t\t\tif ($class !== 'toggled-on') { //add class to clicked item if its not set to be toggled-on\n\t\t\t\tif (isToggled) {\n\t\t\t\t\titem.classList.toggle($class);\n\t\t\t\t} else {\n\t\t\t\t\titem.classList.remove($class);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//trigger optional afterToggle event. continue the click event for customized stuff\n\t\titem.dispatchEvent(toggleEvent);\n\n\t}\n\n\n\t/*------- Moving items Event as well as all resizing --------*/\n\t//on Window resize we can move items to and from divs with data-moveto=\"the destination\"\n\t//it will move there when the site reaches smaller than a size defaulted to 1030 or set that with data-moveat\n\t//the whole div, including the data att moveto moves back and forth\n\tlet movedId = 0;\n const moveEvent = new Event('afterResize', {bubbles: true}); //bubble allows for delegation on body\n\tfunction moveItems() {\n\n\n\t\tlet windowWidth = window.innerWidth;\n\t\tlet $moveItems = document.querySelectorAll('[data-moveto]');\n\n\t\t$moveItems.forEach(item => {\n\t\t\tlet moveAt = item.getAttribute('data-moveat'),\n\t\t\t\tdestination = document.querySelector(item.getAttribute('data-moveto')),\n\t\t\t\tsource = item.getAttribute('data-movefrom');\n\n\t\t\tmoveAt = moveAt ? moveAt : 1030;\n\n\t\t\tif (moveAt.startsWith('--')) {\n\t\t\t\tif (isIE11) {\n\t\t\t\t\tmoveAt = 1030;\n\t\t\t\t} else {\n\t\t\t\t\tlet cssVars = getComputedStyle(document.body); //get css variables\n\t\t\t\t\tmoveAt = parseInt(cssVars.getPropertyValue(moveAt), 10);\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\tif (!destination) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t//if no data movefrom is found add one to parent so we can move items back in. now they go back and forth\n\t\t\tif (!source) {\n\t\t\t\tlet sourceElem = item.parentElement.id;\n\n\t\t\t\t//if parent has no id attr, add one with a number so its unique\n\t\t\t\tif (!sourceElem) {\n\t\t\t\t\titem.parentElement.setAttribute('id', 'move-' + movedId);\n\t\t\t\t\tmovedId++;\n\t\t\t\t\tsourceElem = item.parentElement.id;\n\t\t\t\t}\n\n\t\t\t\titem.setAttribute('data-movefrom', '#' + sourceElem);\n\t\t\t}\n\n\t\t\tsource = document.querySelector(item.getAttribute('data-movefrom'));\n\n\t\t\t//if the screen is smaller than moveAt (1030), move to destination\n\t\t\tif (windowWidth < moveAt || moveAt == 0) {\n\t\t\t\t//no need to move if its already there...\n\t\t\t\tif (!destination.contains(item)) {\n\t\t\t\t\tif (item.hasAttribute('data-moveto-pos')) {\n\t\t\t\t\t\tdestination.insertBefore(item, destination.children[item.getAttribute('data-moveto-pos')]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tdestination.appendChild(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!source.contains(item)) {\n\t\t\t\t\tif (item.hasAttribute('data-movefrom-pos')) {\n\t\t\t\t\t\tsource.insertBefore(item, source.children[item.getAttribute('data-movefrom-pos')]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsource.appendChild(item);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//show it\n\t\t\titem.classList.add('visible');\n\t\t});\n\n\t\tplaceMenuButtons(); //running the moving of menu buttons here. nothing to do with moving items.\n\n\t\t//fix height of fixed holder fixed at top items\n\t\tdocument.querySelectorAll('.fixed-holder').forEach(fixed=>{\n\t\t\tfixed.style.height = fixed.firstElementChild.clientHeight + 'px';\n\t\t});\n\n\t\tdocument.dispatchEvent(moveEvent)\n\n\t}\n\n\twindow.addEventListener('resize', (0,_setup__WEBPACK_IMPORTED_MODULE_0__.throttle)(moveItems, 400));\n\tmoveItems();\n\n\n\n\n\tdocument.documentElement.classList.remove('dom-loading');\n\n\n\t//add finished loading aspace events\n\tlet EventFinished = null;\n\tif (isIE11) {\n\t\tEventFinished = document.createEvent('Event');\n\n\t\t// Define that the event name is 'build'.\n\t\tEventFinished.initEvent('afterIgnEvents', true, true);\n\n\t} else {\n\t\tEventFinished = new Event('afterIgnEvents');\n\t}\n\tdocument.dispatchEvent(EventFinished);\n});\n\n\n/*------- Function for hi red background image swap --------*/\n\n//check if device is retina\nfunction isHighDensity() {\n\treturn ((window.matchMedia && (window.matchMedia('(-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)').matches)));\n}\n\n//check if file exists on server before using\nfunction fileExists(image_url) {\n\tlet http = new XMLHttpRequest();\n\thttp.open('HEAD', image_url, true);\n\thttp.send();\n\treturn http.status != 404;\n}\n\n\n//Add inline retina image if found and on retina device. To use add data-high-res to an inline element with a background-image\nif (isHighDensity()) {\n\n\tlet retinaImage = document.querySelectorAll('[data-high-res]');\n\tretinaImage.forEach(item => {\n\t\tlet image2x = '';\n\t\t//if a high res is provided use that, else use background image but add 2x at end.\n\t\tif (item.dataset.highRes) {\n\t\t\timage2x = item.dataset.highRes;\n\t\t} else {\n\t\t\t//get url for original image\n\t\t\tlet image = item.style.backgroundImage.slice(4, -1).replace(/\"/g, \"\");\n\t\t\t//add @2x to it if image exists.\n\t\t\timage2x = image.replace(/(\\.[^.]+$)/, '@2x$1');\n\t\t}\n\n\t\tif (fileExists(image2x)) {\n\t\t\titem.style.backgroundImage = 'url(\"' + image2x + '\")';\n\t\t}\n\n\t});\n}\n\n\n\n\n//# sourceURL=webpack://aspace/./src/js/core/events.js?"); /***/ }), /***/ "./src/js/core/icons.js": /*!******************************!*\ !*** ./src/js/core/icons.js ***! \******************************/ /***/ (() => { eval("\n//turn icons into svg if using the icons that come with theme folder\ndocument.addEventListener('DOMContentLoaded', function () {\n\tdocument.querySelectorAll('.svg-icon').forEach(icon =>{\n\t\ticon.classList.remove('svg-icon');\n\n\t\t//classlist.value does not wokr in ie11. use getAttrbiute\n\t\tlet iconClass = icon.getAttribute('class');\n\n\t\t//ie11 does not work well with nodes. needed to add as string. no createelementNS\n\t\tlet iconString = ``;\n\n\n\t\ticon.insertAdjacentHTML('afterend', iconString);\n\t\ticon.remove();\n\n\t});\n});\n\n\n//# sourceURL=webpack://aspace/./src/js/core/icons.js?"); /***/ }), /***/ "./src/js/core/navigation.js": /*!***********************************!*\ !*** ./src/js/core/navigation.js ***! \***********************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { "use strict"; eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _setup__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./setup */ \"./src/js/core/setup.js\");\n/* harmony import */ var _navigation_callbacks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./navigation_callbacks */ \"./src/js/core/navigation_callbacks.js\");\n/* harmony import */ var _theme_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../theme.config */ \"./theme.config.json\");\n\n\n\n\n\n//toggle logic functionality that calls the above functions\n//use this one to run the opening and closing of a menu item. dont call above functions directly\nfunction toggleMenuItem(menuItem, toggleState = true,) {\n\n let topLevel = isTopLevel(menuItem)\n let horizontalMenu = isHorizontalMenu(menuItem)\n\n //toplevel horizontal on tablet\n if (topLevel && horizontalMenu) {\n //also check if menu is offscreen and give it a class\n //checkOffScreenMenu(menuItem.querySelector('.sub-menu'))\n (0,_navigation_callbacks__WEBPACK_IMPORTED_MODULE_1__.toggleTopLevelHorizontalMenu)(menuItem, toggleState)\n return\n }\n //toplevel vertical on tablet\n if (topLevel && !horizontalMenu) {\n (0,_navigation_callbacks__WEBPACK_IMPORTED_MODULE_1__.toggleTopLevelVerticalMenu)(menuItem, toggleState)\n return\n }\n (0,_navigation_callbacks__WEBPACK_IMPORTED_MODULE_1__.toggleSubMenu)(menuItem, toggleState)\n}\n\n\n//MAIN MENU EVENT. CAN BE CALLED ON ANY MENU ITEM WITH CHILDREN\nlet menuClickEvent = false //make only one click event once a click is used\nfunction createMenuListener(menuItem) {\n menuItem.addEventListener('pointerover', function (e) {\n e.stopPropagation()\n\n let toggleState = true //always open unless touch event which changes this below\n\n //TOUCH CLICK EVENT\n if (e.pointerType!=='mouse') {\n //clicking a real link opens it\n if (!e.target.closest(`a[href^=\"#\"]`) && !e.target.closest('.submenu-dropdown-toggle')) {\n return\n }\n if (menuItem.classList.contains('toggled-on')) {\n toggleState = false\n }\n //if were opening a top level on horizontal with a click, we need a way to close another that may be opened\n if (isTopLevel(menuItem) && !menuItem.classList.contains('toggled-on') && isHorizontalMenu(menuItem)) {\n closeAllTopMenus()\n }\n }//touch device\n\n //open close for hover and device touch\n toggleMenuItem(menuItem, toggleState)\n\n\n }) //pointerover\n\n menuItem.addEventListener('pointerleave', function (e) {\n e.stopPropagation()\n\n //simply close for hover\n if (e.pointerType==='mouse') {\n toggleMenuItem(menuItem, false)\n }\n\n //triggers when the lcick on is removed...too fast so we need to add another event for clicking off\n if (e.pointerType!=='mouse') {\n //clicked up on touch now we want that fi they click elsewhere to close everything\n if (!menuClickEvent) {\n menuClickEvent = true\n document.addEventListener('click', (e) => {\n //if were not clicking a menu, close any menus opened\n if (!e.target.closest('.menu')) {\n closeAllTopMenus()\n }\n })\n }\n }\n\n })\n}\n\n//close all top level menus\nfunction closeAllTopMenus() {\n let otherMenuItems = document.querySelectorAll('.top-level-item.toggled-on')\n if (otherMenuItems) {\n otherMenuItems.forEach((item) => {\n toggleMenuItem(item, false)\n })\n }\n}\n\n\nfunction isTopLevel(menuItem) {\n return menuItem.classList.contains('top-level-item')\n}\n\n//if the item is inside a submenu inside another submenu\nfunction isNestedSubMenu(menuItem) {\n return menuItem.classList.contains('nested-menu-item')\n}\n\nfunction isHorizontalMenu(menuItem) {\n return getComputedStyle(menuItem.closest('.menu')).flexDirection!=='column'\n}\n\n\n//fix and reset on resize\ndocument.addEventListener('afterResize', function () {\n document.querySelectorAll('.top-level-item.menu-item-has-children').forEach((item) => {\n toggleMenuItem(item, false)\n item.querySelector('.sub-menu').style.removeProperty('display')\n\n if (isHorizontalMenu(item)) {\n checkOffScreenMenu(item.querySelector('.sub-menu'))\n }\n\n })\n})\n\n\ndocument.addEventListener('DOMContentLoaded', function () {\n\n //adds menu events to all menus. more menus can be added later by passing it through createMenuListener\n let menus = document.querySelectorAll('.menu-item')\n menus.forEach((menuItem, index) => {\n createMenuListener(menuItem)\n })\n\n //on load if its a vertical menu, open the parent dropdown right away\n document.querySelectorAll('.menu .current-menu-item.menu-item-has-children, .menu .current-menu-parent').forEach(menu => {\n //if its a vertical menu. we can know by the flex direction of menu\n if (getComputedStyle(menu.closest('.menu')).flexDirection==='column') {\n toggleMenuItem(menu)\n }\n })\n\n})\n\n\n// FOCUS EVENTS - only for keyboard\nlet menuMightBeOpen = false\ndocument.body.addEventListener('focusin', e => {\n const menuItem = e.target.closest('.menu-item')\n\n if (menuItem && menuItem.classList.contains('menu-item-has-children')) {\n window.addEventListener('keyup', function (e) {\n let code = (e.keyCode ? e.keyCode:e.which)\n if (code===9 || code===16) {\n menuMightBeOpen = true\n\n //close other top menus when this one is turned on\n if (isTopLevel(menuItem)) {\n closeAllTopMenus()\n }\n\n toggleMenuItem(menuItem, true)\n }\n }, { once: true })\n }\n if (menuMightBeOpen) {\n closeAllTopMenus()\n menuMightBeOpen = false\n }\n\n})\n\n\n/*------- move submenus if too close to edge on desktop --------*/\nfunction checkOffScreenMenu(submenu) {\n let display = window.getComputedStyle(submenu).display\n if (display!=='block') {\n submenu.style.display = 'block'\n }\n //make item visible so we can get left edge\n\n let rightEdge = submenu.getBoundingClientRect().right\n let leftEdge = submenu.getBoundingClientRect().left\n //set menu back\n\n if (display!=='block') {\n submenu.style.removeProperty('display')\n }\n\n\n let viewport = document.documentElement.clientWidth\n\n //if the submenu is off the page, pull it back somewhat\n if (rightEdge > viewport) {\n (0,_navigation_callbacks__WEBPACK_IMPORTED_MODULE_1__.fixOffScreenMenu)(submenu, 'right')\n return\n }\n\n if (leftEdge < 0) {\n (0,_navigation_callbacks__WEBPACK_IMPORTED_MODULE_1__.fixOffScreenMenu)(submenu, 'left')\n } else {\n (0,_navigation_callbacks__WEBPACK_IMPORTED_MODULE_1__.fixOffScreenMenu)(submenu, 'none')\n }\n}\n\n\njQuery(function ($) {\n\n //move logo in middle of menu on desktop if logo is middle position\n if ($('.logo-in-middle').length) {\n let navigationLi = $('.site-navigation__nav-holder .menu li')\n let middle = Math.floor($(navigationLi).length / 2) - 1\n\n //add logo to the middle when page loads\n $('