This commit is contained in:
parent
fcc146842c
commit
fe9a0c750b
1 changed files with 3 additions and 1 deletions
|
@ -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();
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue