daux.io/themes/daux/js/daux.min.js.map

1 line
9.2 KiB
Plaintext

{"version":3,"file":"daux.min.js.map","sources":["../../../src/js/theme_daux/utils.js","../../../src/js/theme_daux/code_toggle.js","../../../src/js/theme_daux/menu.js","../../../src/js/theme_daux/hamburger.js","../../../src/js/theme_daux/highlight.js"],"sourcesContent":["/* eslint-disable @swissquote/swissquote/import/prefer-default-export */\n\nexport function ready(fn) {\n if (document.readyState === \"loading\") {\n document.addEventListener(\"DOMContentLoaded\", fn);\n } else {\n fn();\n }\n}\n","import { ready } from \"./utils\";\n\nconst LOCAL_STORAGE_KEY = \"daux_code_blocks_hidden\";\n\nfunction setCodeBlockStyle(codeBlocks, hidden) {\n for (let a = 0; a < codeBlocks.length; a++) {\n codeBlocks[a].classList.toggle(\"CodeToggler--hidden\", hidden);\n }\n try {\n localStorage.setItem(LOCAL_STORAGE_KEY, hidden);\n } catch (e) {\n // local storage operations can fail with the file:// protocol\n }\n}\n\nfunction enableToggler(toggleCodeSection, codeBlocks) {\n const toggleCodeBlockBtnSet = toggleCodeSection.querySelector(\n \".CodeToggler__button--main\"\n ); // available when floating is disabled\n\n toggleCodeBlockBtnSet.addEventListener(\n \"change\",\n ev => {\n setCodeBlockStyle(codeBlocks, !ev.target.checked);\n },\n false\n );\n\n let hidden = false;\n try {\n hidden = localStorage.getItem(LOCAL_STORAGE_KEY);\n\n if (hidden === \"false\") {\n hidden = false;\n } else if (hidden === \"true\") {\n hidden = true;\n }\n\n if (hidden) {\n setCodeBlockStyle(codeBlocks, !!hidden);\n toggleCodeBlockBtnSet.checked = !hidden;\n }\n } catch (e) {\n // local storage operations can fail with the file:// protocol\n }\n}\n\nready(() => {\n const codeBlocks = document.querySelectorAll(\".s-content pre\");\n const toggleCodeSection = document.querySelector(\".CodeToggler\");\n\n if (!toggleCodeSection) {\n return;\n }\n\n if (codeBlocks.length) {\n enableToggler(toggleCodeSection, codeBlocks);\n } else {\n toggleCodeSection.classList.add(\"CodeToggler--hidden\");\n }\n});\n","import { ready } from \"./utils\";\n\n/**\n * After the transition finishes set the height to auto so child\n * menus can expand properly.\n * @param {Element} item\n */\nfunction resetHeightAfterAnimation(item) {\n const setHeightToAuto = ev => {\n if (ev.target.style.height !== \"0px\") {\n ev.target.style.height = \"auto\";\n }\n\n ev.target.removeEventListener(\"transitionend\", setHeightToAuto);\n };\n\n item.addEventListener(\"transitionend\", setHeightToAuto);\n}\n\nfunction findNavItem(start) {\n let elem = start;\n while ((elem = elem.parentNode) && elem.nodeType !== 9) {\n if (elem.nodeType === 1 && elem.classList.contains(\"Nav__item\")) {\n return elem;\n }\n }\n\n throw new Error(\"Could not find a NavItem...\");\n}\n\nfunction toggleSubMenu(ev) {\n const isEvent = ev.preventDefault !== undefined;\n\n if (isEvent) {\n ev.preventDefault();\n }\n\n const parent = findNavItem(ev.target);\n const subNav = parent.querySelector(\"ul.Nav\");\n\n if (isEvent && parent.classList.contains(\"Nav__item--open\")) {\n // Temporarily set the height so the transition can work.\n subNav.style.height = `${subNav.scrollHeight}px`;\n subNav.style.transitionDuration = \"150ms\";\n subNav.style.height = \"0px\";\n parent.classList.remove(\"Nav__item--open\");\n } else {\n if (isEvent) {\n subNav.style.transitionDuration = \"150ms\";\n resetHeightAfterAnimation(subNav);\n subNav.style.height = `${subNav.scrollHeight}px`;\n parent.classList.add(\"Nav__item--open\");\n } else {\n // When running at page load the transitions don't need to fire and\n // the classList doesn't need to be altered.\n subNav.style.height = \"auto\";\n }\n }\n}\n\nready(() => {\n const navItems = document.querySelectorAll(\n \".Nav__item.has-children i.Nav__arrow\"\n );\n\n // Go in reverse here because on page load the child nav items need to be\n // opened first before their parents so the height on the parents can be\n // calculated properly.\n for (let i = navItems.length - 1, target; i >= 0; i--) {\n target = navItems[i];\n target.addEventListener(\"click\", toggleSubMenu);\n\n if (\n target.parentNode.parentNode.classList.contains(\"Nav__item--open\")\n ) {\n toggleSubMenu({ target });\n }\n }\n\n // Some navigations just have sub-pages without having a page by themselves\n const ajNav = document.querySelectorAll(\".Nav__item__link--nopage\");\n for (const navItem of ajNav) {\n navItem.addEventListener(\"click\", toggleSubMenu);\n }\n});\n","import { ready } from \"./utils\";\n\nready(() => {\n const trigger = document.querySelector(\".Collapsible__trigger\");\n\n if (trigger) {\n const content = document.querySelector(\".Collapsible__content\");\n\n trigger.addEventListener(\"click\", ev => {\n if (content.classList.contains(\"Collapsible__content--open\")) {\n content.style.height = 0;\n content.classList.remove(\"Collapsible__content--open\");\n trigger.setAttribute(\"aria-expanded\", \"false\");\n } else {\n trigger.setAttribute(\"aria-expanded\", \"true\");\n content.style.transitionDuration = \"150ms\";\n content.style.height = `${content.scrollHeight}px`;\n content.classList.add(\"Collapsible__content--open\");\n }\n });\n }\n});\n","import { ready } from \"./utils\";\n\nready(() => {\n const codeBlocks = document.querySelectorAll(\"pre > code:not(.hljs)\");\n if (codeBlocks.length) {\n const head = document.getElementsByTagName(\"head\")[0],\n script = document.createElement(\"script\");\n script.type = \"text/javascript\";\n script.async = true;\n script.src = `${window.base_url}daux_libraries/highlight.pack.js`;\n script.onload = function(src) {\n [].forEach.call(codeBlocks, window.hljs.highlightBlock);\n };\n head.appendChild(script);\n }\n});\n"],"names":["ready","fn","document","readyState","addEventListener","setCodeBlockStyle","codeBlocks","hidden","a","length","classList","toggle","localStorage","setItem","e","toggleSubMenu","ev","isEvent","undefined","preventDefault","parent","start","elem","parentNode","nodeType","contains","Error","findNavItem","target","subNav","querySelector","style","height","scrollHeight","transitionDuration","remove","setHeightToAuto","removeEventListener","add","querySelectorAll","toggleCodeSection","toggleCodeBlockBtnSet","checked","getItem","enableToggler","trigger","content","setAttribute","head","getElementsByTagName","script","createElement","type","async","src","window","base_url","onload","forEach","call","hljs","highlightBlock","appendChild","navItems","i"],"mappings":"yBAEO,SAASA,EAAMC,GACU,YAAxBC,SAASC,WACTD,SAASE,iBAAiB,mBAAoBH,GAE9CA,ICFR,SAASI,EAAkBC,EAAYC,OAC9B,IAAIC,EAAI,EAAGA,EAAIF,EAAWG,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