From 6ade49b8a453fde18ee054021006ad8be6361865 Mon Sep 17 00:00:00 2001 From: leiyu3 Date: Thu, 17 Jul 2025 15:04:31 -0400 Subject: some fixes --- layouts/_default/baseof.html | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'layouts/_default/baseof.html') 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", () => { document.addEventListener("DOMContentLoaded", () => { const toggle = document.getElementById("toggle-chords"); - toggle?.addEventListener("change", () => { + if (!toggle) return; + + // ✅ Restore saved state + const savedState = localStorage.getItem("chords-toggle"); + if (savedState !== null) { + const isChecked = savedState === "true"; + toggle.checked = isChecked; + document.body.classList.toggle("hide-chords", !isChecked); + } + + // ✅ Save on change + toggle.addEventListener("change", () => { + localStorage.setItem("chords-toggle", toggle.checked); document.body.classList.toggle("hide-chords", !toggle.checked); }); }); -- cgit v1.2.3