summaryrefslogtreecommitdiffstats
path: root/sphinx/themes/scrolls/static/theme_extras.js
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/themes/scrolls/static/theme_extras.js')
-rw-r--r--sphinx/themes/scrolls/static/theme_extras.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/sphinx/themes/scrolls/static/theme_extras.js b/sphinx/themes/scrolls/static/theme_extras.js
new file mode 100644
index 0000000..df2be40
--- /dev/null
+++ b/sphinx/themes/scrolls/static/theme_extras.js
@@ -0,0 +1,12 @@
+const initialiseThemeExtras = () => {
+ const toc = document.getElementById("toc")
+ toc.style.display = ""
+ const items = toc.getElementsByTagName("ul")[0]
+ items.style.display = "none"
+ toc.getElementsByTagName("h3").addEventListener("click", () => {
+ if (items.style.display !== "none") toc.classList.remove("expandedtoc")
+ else toc.classList.add("expandedtoc");
+ })
+}
+if (document.readyState !== "loading") initialiseThemeExtras()
+else document.addEventListener("DOMContentLoaded", initialiseThemeExtras)