diff options
Diffstat (limited to 'layouts/_default/baseof.html')
| -rw-r--r-- | layouts/_default/baseof.html | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index fa1b3b7..d505868 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html | |||
| @@ -126,7 +126,19 @@ document.addEventListener("DOMContentLoaded", () => { | |||
| 126 | document.addEventListener("DOMContentLoaded", () => { | 126 | document.addEventListener("DOMContentLoaded", () => { |
| 127 | const toggle = document.getElementById("toggle-chords"); | 127 | const toggle = document.getElementById("toggle-chords"); |
| 128 | 128 | ||
| 129 | toggle?.addEventListener("change", () => { | 129 | if (!toggle) return; |
| 130 | |||
| 131 | // ✅ Restore saved state | ||
| 132 | const savedState = localStorage.getItem("chords-toggle"); | ||
| 133 | if (savedState !== null) { | ||
| 134 | const isChecked = savedState === "true"; | ||
| 135 | toggle.checked = isChecked; | ||
| 136 | document.body.classList.toggle("hide-chords", !isChecked); | ||
| 137 | } | ||
| 138 | |||
| 139 | // ✅ Save on change | ||
| 140 | toggle.addEventListener("change", () => { | ||
| 141 | localStorage.setItem("chords-toggle", toggle.checked); | ||
| 130 | document.body.classList.toggle("hide-chords", !toggle.checked); | 142 | document.body.classList.toggle("hide-chords", !toggle.checked); |
| 131 | }); | 143 | }); |
| 132 | }); | 144 | }); |
