This commit is contained in:
ed 2021-10-07 23:11:11 +02:00
parent 734e9d3874
commit d500a51d97
3 changed files with 5 additions and 5 deletions

View file

@ -135,13 +135,13 @@ var md_opt = {
(function () {
var l = localStorage,
drk = l.getItem('lightmode') != 1,
drk = l.lightmode != 1,
btn = document.getElementById("lightswitch"),
f = function (e) {
if (e) { e.preventDefault(); drk = !drk; }
document.documentElement.setAttribute("class", drk? "dark":"light");
btn.innerHTML = "go " + (drk ? "light":"dark");
l.setItem('lightmode', drk? 0:1);
l.lightmode = drk? 0:1;
};
btn.onclick = f;

View file

@ -33,11 +33,11 @@ var md_opt = {
var lightswitch = (function () {
var l = localStorage,
drk = l.getItem('lightmode') != 1,
drk = l.lightmode != 1,
f = function (e) {
if (e) drk = !drk;
document.documentElement.setAttribute("class", drk? "dark":"light");
l.setItem('lightmode', drk? 0:1);
l.lightmode = drk? 0:1;
};
f();
return f;

View file

@ -80,7 +80,7 @@
<a href="#" id="repl">π</a>
<script>
if (localStorage.getItem('lightmode') != 1)
if (localStorage.lightmode != 1)
document.documentElement.setAttribute("class", "dark");
</script>