Fixed theme chooser not displayed upon first connection and some cleanup
This commit is contained in:
parent
9ab3804aec
commit
7ab6159c7f
3 changed files with 5 additions and 8 deletions
|
@ -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;
|
||||
}
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue