From 63dbc44d83e6407d7f05b10274b40fc8a35e3c23 Mon Sep 17 00:00:00 2001 From: Mstrdav Date: Mon, 8 Mar 2021 20:57:25 +0100 Subject: [PATCH] fix issue with theme --- Y/Scripts/yfold.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Y/Scripts/yfold.js b/Y/Scripts/yfold.js index 0a52dd1..ea2d232 100644 --- a/Y/Scripts/yfold.js +++ b/Y/Scripts/yfold.js @@ -151,9 +151,11 @@ window.onload = function() { css_url = theme; } - let position = window.location.href.split("Y")[1].split("/").length - 1 - for (let i = 1; i<=position; i++) { - css_url = "../" + css_url + if (window.location.href.split("Y").length >1 ) { + let position = window.location.href.split("Y")[1].split("/").length - 1 + for (let i = 1; i<=position; i++) { + css_url = "../" + css_url + } } changeCSS(css_url, 0) @@ -196,10 +198,13 @@ window.onload = function() { toggler.style.outline = "none" toggler.addEventListener("change", function() { css_url = toggler.value - let position = window.location.href.split("Y")[1].split("/").length - 1 - for (let i = 1; i<=position; i++) { - css_url = "../" + css_url + if (window.location.href.split("Y").length > 1) { + let position = window.location.href.split("Y")[1].split("/").length - 1 + for (let i = 1; i<=position; i++) { + css_url = "../" + css_url + } } + changeCSS(css_url, 0) }) }