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

1 line
8.2 KiB
Plaintext
Raw Normal View History

{"version":3,"file":"daux.min.js.map","sources":["../../../src/js/theme_daux/code_toggle.js","../../../src/js/theme_daux/hamburger.js","../../../src/js/theme_daux/highlight.js","../../../src/js/theme_daux/menu.js"],"sourcesContent":["const codeBlocks = document.querySelectorAll(\".s-content pre\");\nconst toggleCodeSection = document.querySelector(\".CodeToggler\");\n\nconst LOCAL_STORAGE_KEY = \"daux_code_blocks_hidden\";\n\nfunction setCodeBlockStyle(hidden) {\n for (let a = 0; a < codeBlocks.length; a++) {\n codeBlocks[a].classList.toggle(\"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() {\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(!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(!!hidden);\n toggleCodeBlockBtnSet.checked = !hidden;\n }\n } catch (e) {\n // local storage operations can fail with the file:// protocol\n }\n}\n\nif (toggleCodeSection) {\n if (codeBlocks.length) {\n enableToggler();\n } else {\n toggleCodeSection.classList.add(\"Hidden\");\n }\n}\n","const trigger = document.querySelector(\".Collapsible__trigger\");\n\nif (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","const codeBlocks = document.querySelectorAll(\"pre > code:not(.hljs)\");\nif (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 * 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(\"N