mirror of
https://github.com/Wonderfall/hugo-WonderMod.git
synced 2024-11-25 03:51:37 +01:00
Revert "theme-switch-button: improve logic"
This reverts commit 0eed773e6d
.
This commit is contained in:
parent
0eed773e6d
commit
12b6b132e4
@ -50,7 +50,7 @@
|
||||
localStorage.setItem("menu-scroll-position", document.getElementById('menu').scrollLeft);
|
||||
}
|
||||
</script>
|
||||
{{- if (and (not .Site.Params.disableThemeToggle) (not (eq .Site.Params.defaultTheme "auto"))) }}
|
||||
{{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }}
|
||||
<script>
|
||||
document.getElementById("theme-toggle").addEventListener("click", () => {
|
||||
if (document.body.className.includes("dark")) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
{{- if (and (not .Site.Params.disableThemeToggle) (not (eq .Site.Params.defaultTheme "auto"))) }}
|
||||
{{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }}
|
||||
<script>
|
||||
// load memory
|
||||
if (localStorage.getItem("pref-theme") === "dark") {
|
||||
@ -13,7 +13,7 @@
|
||||
|
||||
</script>
|
||||
{{- end }}
|
||||
{{- if (eq .Site.Params.defaultTheme "auto") }}
|
||||
{{- if (and (.Site.Params.disableThemeToggle) (eq .Site.Params.defaultTheme "auto")) }}
|
||||
<script>
|
||||
if (window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
document.body.classList.add('dark');
|
||||
@ -41,7 +41,7 @@
|
||||
{{- .Site.Params.label.text | default .Site.Title -}}
|
||||
</a>
|
||||
<span class="logo-switches">
|
||||
{{- if (not .Site.Params.disableThemeToggle) }}
|
||||
{{- if (and (not .Site.Params.disableThemeToggle) (not (or (eq .Site.Params.defaultTheme "light") (eq .Site.Params.defaultTheme "dark")))) }}
|
||||
<span class="theme-toggle">
|
||||
<a id="theme-toggle" accesskey="t">
|
||||
<svg id="moon" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"
|
||||
|
Loading…
Reference in New Issue
Block a user