theme persistence

This commit is contained in:
Jörg Henke
2023-09-13 09:18:04 +02:00
parent 094fa3f47a
commit 4b8822e5ad
17 changed files with 303 additions and 58 deletions

View File

@ -52,24 +52,31 @@
</div>
</div>
<script type="text/javascript">
resetClock = function() {
$("#clock").empty();
var theme = $("html").attr("data-bs-theme");
var arrowcolor;
var scalecolor;
var backgroundcolor;
if (theme == "dark") {
arrowcolor = "#fff";
scalecolor = "#aaa";
backgroundcolor = "rgba(0, 0, 0, 0.3)"
} else {
arrowcolor = "#099";
scalecolor = "#000";
backgroundcolor = "rgba(0, 0, 0, 0)";
}
new Clock(38, "#clock", arrowcolor, scalecolor, backgroundcolor);
}
resetClock();
//<![CDATA[
$(document).ready(function(){
var theme = "[[${theme}]]";
$("html").attr("data-bs-theme", theme);
resetClock = function() {
$("#clock").empty();
var theme = $("html").attr("data-bs-theme");
var arrowcolor;
var scalecolor;
var backgroundcolor;
if (theme == "dark") {
arrowcolor = "#fff";
scalecolor = "#aaa";
backgroundcolor = "rgba(0, 0, 0, 0.3)"
} else {
arrowcolor = "#099";
scalecolor = "#000";
backgroundcolor = "rgba(0, 0, 0, 0)";
}
new Clock(38, "#clock", arrowcolor, scalecolor, backgroundcolor);
}
resetClock();
});
//]]>
</script>
</nav>
<main layout:fragment="content" class="page body"></main>