diff options
author | Case Duckworth | 2022-08-19 20:25:57 -0500 |
---|---|---|
committer | Case Duckworth | 2022-08-19 20:25:57 -0500 |
commit | a7e339768797f1f809b041bb5af903b58bc82830 (patch) | |
tree | 8b247f1643c288f1121422b5e300d80066e6dcd2 /script.js | |
parent | Ignore index.html (diff) | |
download | fwendplanet-a7e339768797f1f809b041bb5af903b58bc82830.tar.gz fwendplanet-a7e339768797f1f809b041bb5af903b58bc82830.zip |
Diffstat (limited to 'script.js')
-rw-r--r-- | script.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/script.js b/script.js new file mode 100644 index 0000000..01458c9 --- /dev/null +++ b/script.js | |||
@@ -0,0 +1,11 @@ | |||
1 | // Toggle all <details> on the page (thanks elioat!) | ||
2 | |||
3 | const toggleDetails = () => { | ||
4 | document.body.querySelectorAll("details").forEach((e) => { | ||
5 | if (!e.classList.contains("info")) { | ||
6 | e.hasAttribute("open") | ||
7 | ? e.removeAttribute("open") | ||
8 | : e.setAttribute("open", true); | ||
9 | } | ||
10 | }); | ||
11 | }; | ||