From 67926e312b4524bcf30021474cb559b700c5121e Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 15 Dec 2024 16:50:56 +0100 Subject: [PATCH] fix filetree --- static/js/cours.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/static/js/cours.js b/static/js/cours.js index 807a996..f606472 100644 --- a/static/js/cours.js +++ b/static/js/cours.js @@ -93,7 +93,10 @@ const deepestNodeOpened = (path, options) => { // Iterate over possible options for (let i = 0; i < options.length; ++i) { // If the directory and the current path match - if (decodeURI(path[0]) === options[i].firstChild.nodeValue) { + if ( + decodeURI(path[0]).toLowerCase() === + options[i].firstChild.nodeValue.toLowerCase() + ) { if (path.length === 1) { // We found it return options[i]; @@ -172,7 +175,13 @@ window.addEventListener("load", () => { // Bold opened file const openedFile = decodeURI(fullpath.split("/").at(-1)); currentlyOpen.querySelector("ul").childNodes.forEach((el) => { - if (el.innerText === openedFile) { + const elementToCompare = decodeURI( + el.firstChild.search + ? el.firstChild.search.substring(3).split("/").at(-1) + : el.firstChild.data + ); + + if (elementToCompare === openedFile) { el.style.fontWeight = "bold"; } });