FCLT#59401 Single page als gebouwdashboard - optimalisatie gebruikte plug-ins

svn path=/Website/trunk/; revision=45845
This commit is contained in:
Alex Tiehuis
2020-02-13 09:40:10 +00:00
parent 208993598a
commit b3382cf088
111 changed files with 8231 additions and 5 deletions

View File

@@ -0,0 +1,27 @@
(function() {
var darkSwitch = document.getElementById("darkSwitch");
if (darkSwitch) {
initTheme();
darkSwitch.addEventListener("change", function(event) {
resetTheme();
});
function initTheme() {
var darkThemeSelected =
localStorage.getItem("darkSwitch") !== null &&
localStorage.getItem("darkSwitch") === "dark";
darkSwitch.checked = darkThemeSelected;
darkThemeSelected
? document.body.setAttribute("data-theme", "dark")
: document.body.removeAttribute("data-theme");
}
function resetTheme() {
if (darkSwitch.checked) {
document.body.setAttribute("data-theme", "dark");
localStorage.setItem("darkSwitch", "dark");
} else {
document.body.removeAttribute("data-theme");
localStorage.removeItem("darkSwitch");
}
}
}
})();