Resolved error from comment on commit b5013b58
.
This commit is contained in:
parent
b5013b5817
commit
bc96f42268
@ -1,21 +1,13 @@
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
if (window.location.search.indexOf("darkmode=false") > -1) {
|
||||
document.cookie = "darkmode=false; path=/";
|
||||
try {
|
||||
if (document.getElementById("content") !== null) {
|
||||
document.getElementById("content").classList.remove("dark-mode");
|
||||
} catch (error) {
|
||||
if (error.message !== "document.getElementById(...) is null") {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
} else if (window.location.search.indexOf("darkmode=true") > -1 || document.cookie.indexOf("darkmode=true") > -1) {
|
||||
document.cookie = "darkmode=true; path=/";
|
||||
try {
|
||||
if (document.getElementById("content") !== null) {
|
||||
document.getElementById("content").classList.add("dark-mode");
|
||||
} catch (error) {
|
||||
if (error.message !== "document.getElementById(...) is null") {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user