diff options
| author | eltrac <hi@eltr.ac> | 2026-05-01 12:05:03 +0800 |
|---|---|---|
| committer | eltrac <hi@eltr.ac> | 2026-05-01 12:05:03 +0800 |
| commit | 17fcd3cecec9e3a9a67c3b0cf15c936d6b1d20c0 (patch) | |
| tree | c8cd794d5df321aa8254a3f186da4a9e4e58b742 | |
| parent | 547fc9e22c9b7fbaf444925555c7eee07b210a06 (diff) | |
fix: error when themeSelect is not present in DOM
| -rw-r--r-- | layouts/_partials/scripts.html | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html index 9a1ba09..b21a88f 100644 --- a/layouts/_partials/scripts.html +++ b/layouts/_partials/scripts.html @@ -2,8 +2,10 @@ <script> document.addEventListener("DOMContentLoaded", () => { const themeSelect = document.getElementById('theme-select') - themeSelect.value = localStorage.getItem('geedeapro.theme') - themeSelect.onchange = () => switchTheme(themeSelect.value, true) + if (themeSelect) { + themeSelect.value = localStorage.getItem('geedeapro.theme') + themeSelect.onchange = () => switchTheme(themeSelect.value, true) + } }) </script> |
