From c861048b2217ac2763b68f59a24da9d2474e4387 Mon Sep 17 00:00:00 2001 From: Pk11 Date: Fri, 22 Oct 2021 21:16:34 -0500 Subject: [PATCH] Simply theme JS --- _includes/head.html | 2 +- assets/js/theme.js | 23 +++++------------------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/_includes/head.html b/_includes/head.html index b9213e2d..2bbf4fa0 100644 --- a/_includes/head.html +++ b/_includes/head.html @@ -15,7 +15,7 @@ {% endif %} - + {% include favicon.html %} diff --git a/assets/js/theme.js b/assets/js/theme.js index afc38dba..904e0741 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -1,22 +1,9 @@ function loadTheme() { - const themeCSS = document.getElementById("themeCSS"); - if(!localStorage.theme || localStorage.theme == "default") { - if(themeCSS) - themeCSS.remove(); - } else { - if(themeCSS) { - themeCSS.href = "/assets/css/" + localStorage.theme +".css"; - } else { - const l = document.createElement("link"); - l.rel = "stylesheet"; - l.type = "text/css"; - l.media = "screen"; - l.href = "/assets/css/" + localStorage.theme +".css" - l.id = "themeCSS"; - - document.head.appendChild(l); - } - } + const themeCSS = document.getElementById("theme-css"); + if(!localStorage.theme || localStorage.theme == "default") + themeCSS.href = "/assets/css/style.css"; + else + themeCSS.href = "/assets/css/" + localStorage.theme + ".css"; } function setTheme(theme) {