summaryrefslogtreecommitdiff
path: root/layouts/_partials/scripts.html
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-02-10 16:00:14 +0800
committereltrac <hi@eltr.ac>2026-02-10 16:00:14 +0800
commit9a0f7b785ed13f0506b2c7ab8c7da6b0ca398450 (patch)
tree292a496eca1f8f434e45e35a7909a2b15c23c008 /layouts/_partials/scripts.html
parent044bc2ed2b2d48b8d7a2f4c53e49eba2da8ada1a (diff)
fix: theme switch not showing currently selected theme
- set theme select value after DOMConentLoaded - refactor: move inline `onchange` to `<script>`
Diffstat (limited to 'layouts/_partials/scripts.html')
-rw-r--r--layouts/_partials/scripts.html9
1 files changed, 9 insertions, 0 deletions
diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html
index 6ad03632..f7e9c36b 100644
--- a/layouts/_partials/scripts.html
+++ b/layouts/_partials/scripts.html
@@ -1,3 +1,12 @@
+<!-- Theme Switch -->
+<script>
+document.addEventListener("DOMContentLoaded", () => {
+ const themeSelect = document.getElementById('theme-select')
+ themeSelect.value = localStorage.getItem('geedeapro.theme')
+ themeSelect.onchange = () => switchTheme(themeSelect.value, true)
+})
+</script>
+
<!-- global JS -->
{{ $commonJS := slice
(resources.Get "js/tooltip.js")