fix filetree

This commit is contained in:
Mylloon 2024-12-15 16:50:56 +01:00
parent 0404b84506
commit 67926e312b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -93,7 +93,10 @@ const deepestNodeOpened = (path, options) => {
// Iterate over possible options // Iterate over possible options
for (let i = 0; i < options.length; ++i) { for (let i = 0; i < options.length; ++i) {
// If the directory and the current path match // 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) { if (path.length === 1) {
// We found it // We found it
return options[i]; return options[i];
@ -172,7 +175,13 @@ window.addEventListener("load", () => {
// Bold opened file // Bold opened file
const openedFile = decodeURI(fullpath.split("/").at(-1)); const openedFile = decodeURI(fullpath.split("/").at(-1));
currentlyOpen.querySelector("ul").childNodes.forEach((el) => { 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"; el.style.fontWeight = "bold";
} }
}); });