Commit b5013b58 authored by Greenscreener's avatar Greenscreener

Implemented darkmode, without UI. Resolved #3.

parent a427b7a2
Pipeline #91723729 passed with stage
in 1 minute and 23 seconds
document.addEventListener("DOMContentLoaded", () => {
if (window.location.search.indexOf("darkmode=true") > -1) {
document.getElementById("content").classList.add("dark-mode");
if (window.location.search.indexOf("darkmode=false") > -1) {
document.cookie = "darkmode=false; path=/";
try {
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 {
document.getElementById("content").classList.add("dark-mode");
} catch (error) {
if (error.message !== "document.getElementById(...) is null") {
Please register or sign in to reply
throw error;
}
}
}
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment