From 87293eadf48408d81db0ff2e83319b023a8b20bc Mon Sep 17 00:00:00 2001 From: Adrian Winterstein Date: Tue, 3 Dec 2024 08:39:36 +0100 Subject: [PATCH] Removed Java Script code that was left over from the highlight switching --- src/js/main.js | 8 -------- static/js/main.js | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/js/main.js b/src/js/main.js index ab3335a..eaa3a75 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1,12 +1,4 @@ document.addEventListener("DOMContentLoaded", function() { - // ---------------- Switch Theme ------------------------- - // On page load or when changing themes, best to add inline in `head` to avoid FOUC - if (window.matchMedia('(prefers-color-scheme: dark)').matches) { - document.getElementById("syntax_highlight").href = "/syntax-dark.css"; - } else { - document.getElementById("syntax_highlight").href = "/syntax-light.css"; - } - // ---------------- Toggle Sidebar ------------------------- document.getElementById('toggle-sidebar')?.addEventListener('click', toggleSidebar); diff --git a/static/js/main.js b/static/js/main.js index da82602..7ecba10 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1 +1 @@ -function toggleSidebar(){var e=document.getElementById("sidebar");[...e.classList].includes("translate-x-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("translate-x-0"),e.classList.add("-translate-x-full")):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("-translate-x-full"),e.classList.add("translate-x-0"))}function toggleMobileMenu(){var e=document.querySelector("#mobile-menu div.nav-links");[...e.classList].includes("h-screen")?(document.body.classList.remove("overflow-hidden","relative"),document.documentElement.classList.remove("overscroll-none"),e.classList.remove("h-screen"),e.classList.add("h-0")):(document.body.classList.add("overflow-hidden","relative"),document.documentElement.classList.add("overscroll-none"),e.classList.remove("h-0"),e.classList.add("h-screen"))}document.addEventListener("DOMContentLoaded",function(){window.matchMedia("(prefers-color-scheme: dark)").matches?document.getElementById("syntax_highlight").href="/syntax-dark.css":document.getElementById("syntax_highlight").href="/syntax-light.css",document.getElementById("toggle-sidebar")?.addEventListener("click",toggleSidebar),document.getElementById("toggle-mobile-menu")?.addEventListener("click",toggleMobileMenu)}); \ No newline at end of file +function toggleSidebar(){var e=document.getElementById("sidebar");[...e.classList].includes("translate-x-0")?(document.body.style.removeProperty("overflow"),e.classList.remove("translate-x-0"),e.classList.add("-translate-x-full")):(document.body.style.setProperty("overflow","hidden"),e.classList.remove("-translate-x-full"),e.classList.add("translate-x-0"))}function toggleMobileMenu(){var e=document.querySelector("#mobile-menu div.nav-links");[...e.classList].includes("h-screen")?(document.body.classList.remove("overflow-hidden","relative"),document.documentElement.classList.remove("overscroll-none"),e.classList.remove("h-screen"),e.classList.add("h-0")):(document.body.classList.add("overflow-hidden","relative"),document.documentElement.classList.add("overscroll-none"),e.classList.remove("h-0"),e.classList.add("h-screen"))}document.addEventListener("DOMContentLoaded",function(){document.getElementById("toggle-sidebar")?.addEventListener("click",toggleSidebar),document.getElementById("toggle-mobile-menu")?.addEventListener("click",toggleMobileMenu)}); \ No newline at end of file