diff --git a/static/js/cours.js b/static/js/cours.js index 74459a2..abc754a 100644 --- a/static/js/cours.js +++ b/static/js/cours.js @@ -148,14 +148,17 @@ window.addEventListener("load", () => { dataElement.remove(); // Open nested openeded directories - const fullpath = window.location.href.split("?")[1].substring(2); - const path = fullpath.substring(0, fullpath.lastIndexOf("/")); - const last_openeded = deepestNodeOpened( - path.split("/"), - fileTreeElement.querySelector("ul").childNodes - ); + const infoURL = window.location.href.split("?"); + if (infoURL.length > 1) { + const fullpath = infoURL[1].substring(2); + const path = fullpath.substring(0, fullpath.lastIndexOf("/")); + const last_openeded = deepestNodeOpened( + path.split("/"), + fileTreeElement.querySelector("ul").childNodes + ); - uncollapse(last_openeded); + uncollapse(last_openeded); + } // Fix SVG images svgDarkTheme();