1 regel
12 KiB
Plaintext
1 regel
12 KiB
Plaintext
|
{"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\nfunction setCodeBlockStyle(\n codeBlockState,\n toggleCodeBlockBtnList,\n toggleCodeBlockBtnFloat,\n toggleCodeBlockBtnBelow,\n toggleCodeBlockBtnHide,\n codeBlockView\n) {\n for (let a = 0; a < toggleCodeBlockBtnList.length; a++) {\n toggleCodeBlockBtnList[a].classList.remove(\"Button--active\");\n }\n let hidden;\n switch (codeBlockState) {\n case true: // Show code blocks below (flowed); checkbox\n hidden = false;\n break;\n case false: // Hidden code blocks; checkbox\n hidden = true;\n break;\n case 2: // Show code blocks inline (floated)\n toggleCodeBlockBtnFloat.classList.add(\"Button--active\");\n codeBlockView.classList.add(\"Columns__right--float\");\n codeBlockView.classList.remove(\"Columns__right--full\");\n hidden = false;\n break;\n case 1: // Show code blocks below (flowed)\n case \"checked\":\n toggleCodeBlockBtnBelow.classList.add(\"Button--active\");\n codeBlockView.classList.remove(\"Columns__right--float\");\n codeBlockView.classList.add(\"Columns__right--full\");\n hidden = false;\n break;\n case 0: // Hidden code blocks\n default:\n toggleCodeBlockBtnHide.classList.add(\"Button--active\");\n codeBlockView.classList.remove(\"Columns__right--float\");\n codeBlockView.classList.add(\"Columns__right--full\");\n hidden = true;\n break;\n }\n for (let a = 0; a < codeBlocks.length; a++) {\n if (hidden) {\n codeBlocks[a].classList.add(\"Hidden\");\n } else {\n codeBlocks[a].classList.remove(\"Hidden\");\n }\n }\n try {\n localStorage.setItem(\"codeBlockState\", +codeBlockState);\n } catch (e) {\n // local storage operations can fail with the file:// protocol\n }\n}\n\nfunction enableToggler() {\n const toggleCodeBlockBtnList = toggleCodeSection.querySelectorAll(\n \".CodeToggler__button\"\n );\n const toggleCodeBlockBtnSet = toggleCodeSection.querySelector(\n \".CodeToggler__button--main\"\n ); // available when floating is disabled\n const toggleCodeBlockBtnHide = toggleCodeSection.querySelector(\n \".CodeToggler__button--hide\"\n );\n const toggleCodeBlockBtnBelow = toggleCodeSection.querySelector(\n \".CodeToggler__button--below\"\n );\n const toggleCodeBlockBtnFloat = toggleCodeSection.querySelector(\n \".CodeToggler__button--float\"\n );\n const codeBlockView = document.querySelector(\".Columns__right\");\n const floating = document.body.classList.contains(\"with-float\");\n\n const setStyle = style => {\n setCodeBlockStyle(\n style,\n toggleCodeBlockBtnList,\n toggleCodeBlockBtnFloat,\n toggleCodeBlockBtnBelow,\n toggleCodeBlockBtnHide,\n codeBlockView\n );\n };\n\n if (floating) {\n toggleCodeBlockBtnHide.addEventListener(\n \"click\",\n () => {\n setStyle(0);\n },\n false\n );\n toggleCodeBlockBtnBelow.addEventListener(\n \"click\",\n () => {\n setStyle(1);\n },\n false\n );\n toggleCodeBlockBtnFloat.addEventListener(\n \"click\",\n () => {\n setStyle(2);\n },\n false\n );\n } else {\n toggleCodeBlockBtnSet.addEventListener(\n \"change\",\n ev => {\n se
|