From 4a6cd9746eebcb51e5bd34f14976a352d9aaeef3 Mon Sep 17 00:00:00 2001 From: Peter Yuen Date: Mon, 27 Jun 2022 22:41:34 +0800 Subject: [PATCH] Fixed light mode flashing --- zola/static/js/main.js | 5 ----- zola/templates/base.html | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/zola/static/js/main.js b/zola/static/js/main.js index 9e66d7b0..f685b0fa 100644 --- a/zola/static/js/main.js +++ b/zola/static/js/main.js @@ -22,11 +22,6 @@ document.getElementById("mode").addEventListener("click", () => { } }); -// enforce local storage setting but also fallback to user-agent preferences -if (localStorage.getItem("theme") === "dark" || (!localStorage.getItem("theme") && window.matchMedia("(prefers-color-scheme: dark)").matches)) { - document.body.classList.add("dark"); -} - // Collapsible sidebar code (it's ugly but I don't care) var sections = $(".collapsible-section"); if (!sidebar_collapsed) { diff --git a/zola/templates/base.html b/zola/templates/base.html index 53a16f30..892217cd 100644 --- a/zola/templates/base.html +++ b/zola/templates/base.html @@ -32,6 +32,11 @@ {% block body %}{% set page_class="home" %}{% endblock body %} + {% block header %} {{ macros_header::header(current_section="/") }} {% endblock header %}