Basic cours support #44

Merged
Anri merged 67 commits from cours into main 2024-04-01 18:11:49 +02:00
Showing only changes of commit fe9a0c750b - Show all commits

View file

@ -14,6 +14,8 @@ const buildFileTree = (parent, data, location) => {
// Directory
li.textContent = item.name;
li.classList.add("collapsed");
// Toggle collapsing on click
li.addEventListener("click", function (e) {
if (e.target === li) {
li.classList.toggle("collapsed");
@ -43,6 +45,7 @@ const buildFileTree = (parent, data, location) => {
};
window.addEventListener("load", () => {
// Build the filetree
const fileTreeElement = document.getElementsByTagName("aside")[0];
const dataElement = fileTreeElement.getElementsByTagName("span")[0];
@ -51,6 +54,5 @@ window.addEventListener("load", () => {
JSON.parse(dataElement.getAttribute("data-json")).children,
""
);
dataElement.remove();
});