aboutsummaryrefslogtreecommitdiff
path: root/layouts/partials/themeSwitcher.html
diff options
context:
space:
mode:
authorJulien Dessaux2023-01-28 23:21:42 +0100
committerJulien Dessaux2023-01-28 23:21:42 +0100
commit7ab6159c7fffb99c6b594e10b3d60c27fe02f965 (patch)
tree71efb0e59fb44ab9752d415d037958252803320b /layouts/partials/themeSwitcher.html
parentHide theme switcher by default, only show it if javascript is enabled (diff)
downloadwww-7ab6159c7fffb99c6b594e10b3d60c27fe02f965.tar.gz
www-7ab6159c7fffb99c6b594e10b3d60c27fe02f965.tar.bz2
www-7ab6159c7fffb99c6b594e10b3d60c27fe02f965.zip
Fixed theme chooser not displayed upon first connection and some cleanup
Diffstat (limited to '')
-rw-r--r--layouts/partials/themeSwitcher.html6
1 files changed, 3 insertions, 3 deletions
diff --git a/layouts/partials/themeSwitcher.html b/layouts/partials/themeSwitcher.html
index 902d8e3..9781878 100644
--- a/layouts/partials/themeSwitcher.html
+++ b/layouts/partials/themeSwitcher.html
@@ -1,15 +1,15 @@
<script>
function setTheme() {
const themeName = document.getElementById('themes').value;
- localStorage.setItem('theme', themeName);
document.documentElement.className = themeName;
+ localStorage.setItem('theme', themeName);
}
(function () { // Set the theme on page load
+ const elt = document.getElementById('themes');
+ elt.style.display = 'block';
const themeName = localStorage.getItem('theme');
if (themeName) {
document.documentElement.className = themeName;
- const elt = document.getElementById('themes');
- elt.style.display = "block";
elt.value = themeName;
}
})();