mirror of
https://github.com/Damillora/Yuika
synced 2024-11-14 14:07:31 +00:00
fix(theme): fix persistence of dark mode
This commit is contained in:
parent
c7187ebcc4
commit
fa3ce87d57
@ -1,5 +1,5 @@
|
|||||||
function setDarkMode() {
|
function setDarkMode() {
|
||||||
if (!window.localStorage.getItem('theme') && window.document.body.getAttribute("data-theme")){
|
if (window.document.body.getAttribute("data-theme")){
|
||||||
window.localStorage.setItem('theme', window.document.body.getAttribute("data-theme"));
|
window.localStorage.setItem('theme', window.document.body.getAttribute("data-theme"));
|
||||||
}
|
}
|
||||||
if (window.document.body.getAttribute("data-theme") == "dark") {
|
if (window.document.body.getAttribute("data-theme") == "dark") {
|
||||||
@ -10,6 +10,7 @@ function setDarkMode() {
|
|||||||
$("#darkMode p").text("Dark Mode");
|
$("#darkMode p").text("Dark Mode");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.localStorage.getItem('theme')) {
|
if (window.localStorage.getItem('theme')) {
|
||||||
window.document.body.setAttribute("data-theme", window.localStorage.getItem("theme"));
|
window.document.body.setAttribute("data-theme", window.localStorage.getItem("theme"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user