diff --git a/tools/brouter-web/baldav-custom.js b/tools/brouter-web/baldav-custom.js index 9fac9fb..b922f20 100644 --- a/tools/brouter-web/baldav-custom.js +++ b/tools/brouter-web/baldav-custom.js @@ -1,31 +1,60 @@ (function () { var LS_DARK = "baldav_bw_dark"; - function apply() { document.body.classList.toggle("bw-dark", localStorage.getItem(LS_DARK) === "1"); } - function toggle() { - var on = localStorage.getItem(LS_DARK) !== "1"; - localStorage.setItem(LS_DARK, on ? "1" : "0"); - apply(); - var b = document.getElementById("baldav-daynight"); - if (b) b.textContent = on ? "☀" : "☾"; // sun / moon + function isDark() { try { return localStorage.getItem(LS_DARK) === "1"; } catch (e) { return false; } } + + // Inject the dark rules as a