From c1dbbfb90477e5598eb361cd0005959bbb89e2c3 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 28 Nov 2024 14:54:04 +0100 Subject: [PATCH] fix crash on release --- static/js/cours.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/static/js/cours.js b/static/js/cours.js index d12ac4e..13037a3 100644 --- a/static/js/cours.js +++ b/static/js/cours.js @@ -98,15 +98,14 @@ const searchFiles = (query, parent, currentFile) => { return; } - children.forEach((item) => { + for (const item in children) { if (item.innerText.toLowerCase().includes(query.toLowerCase())) { item.style.display = ""; uncollapse(item); - console.log(query, item.innerText); - } else { - item.style.display = "none"; + continue; } - }); + item.style.display = "none"; + } }; window.addEventListener("load", () => { @@ -157,11 +156,12 @@ window.addEventListener("load", () => { fileTreeElement.style.display = "block"; content.style.display = "none"; button.textContent = "Fermer le menu"; - } else { - fileTreeElement.style.display = ""; - content.style.display = ""; - button.textContent = initialButtonTextContent; + return; } + + fileTreeElement.style.display = ""; + content.style.display = ""; + button.textContent = initialButtonTextContent; }; button.addEventListener("click", resetPage);