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

1 line
7.7 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 = `${Math.max(\n content.scrollHeight,\n 150\n )}ms`;\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}_libraries/highlight.pack.js`;\n script.onload = function(src) {\n [].forEach.call(codeBlocks, window.hljs.highlightBlock);\n };\n head.appendChild(script);\n}\n","function 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\nfunction toggleSubMenu(ev) {\n if (ev.preventDefault !== undefined) {\n ev.preventDefault();\n }\n\n const parent = ev.target.parentNode.parentNode;\n const subNav = parent.querySelector(\"ul.Nav\");\n\n if (\n ev.preventDefault !== undefined &&\n parent.classList.contains(\"Nav__item--open\")\n ) {\n // Temporarily set the height so the transition can work.\n subNav.style.height = `${subNav.scrollHeight}px`;\n subNav.style.transitionDuration = `${Math.max(\n subNav.scrollHeight,\n 150\n )}ms`;\n subNav.style.height = \"0px\";\n parent.classList.remove(\"Nav__item--open\");\n } else {\n if (ev.preventDefault === undefined) {\n // When running at page load