From 317da9022c4096fe1892cfa365b0be8b0fa1a828 Mon Sep 17 00:00:00 2001 From: GilbN Date: Thu, 7 Oct 2021 23:09:57 +0200 Subject: [PATCH] injectTheme fix --- Resources/landing-page/js/scripts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Resources/landing-page/js/scripts.js b/Resources/landing-page/js/scripts.js index 08da6aab..49c4ca45 100644 --- a/Resources/landing-page/js/scripts.js +++ b/Resources/landing-page/js/scripts.js @@ -79,12 +79,13 @@ function injectTheme(theme,container="head") { if (container === "head") { html_element = document.head; } else html_element = document.body; - let link = document.createElement("link"); + let themeOption = document.getElementById("theme-option") + let link = themeOption ? themeOption : document.createElement("link"); url = "/CSS/variables/" link.type = "text/css"; link.rel = "stylesheet"; link.href = `${url}/${theme.toLowerCase()}.css`; - + link.id = `theme-option` html_element.appendChild(link); }