|
|
@ -1,23 +1,21 @@
|
|
|
|
class View {
|
|
|
|
class View {
|
|
|
|
constructor() {}
|
|
|
|
constructor() {}
|
|
|
|
|
|
|
|
|
|
|
|
hloubka = 1;
|
|
|
|
drawDirTree(dirtree, ulToAdd = document.getElementsByTagName("ul")[0]) {
|
|
|
|
|
|
|
|
|
|
|
|
drawDirTree(dirtree) {
|
|
|
|
|
|
|
|
var dirtreeul = document.getElementsByTagName("ul");
|
|
|
|
var dirtreeul = document.getElementsByTagName("ul");
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
var text = document.createTextNode(dirtree[0]);
|
|
|
|
var text = document.createTextNode(dirtree[0]);
|
|
|
|
tag.appendChild(text);
|
|
|
|
tag.appendChild(text);
|
|
|
|
tag.style.fontWeight = "bold";
|
|
|
|
tag.style.fontWeight = "bold";
|
|
|
|
|
|
|
|
|
|
|
|
dirtreeul[dirtreeul.length - this.hloubka].appendChild(tag);
|
|
|
|
ulToAdd.appendChild(tag);
|
|
|
|
if (dirtree.length > 1) {
|
|
|
|
if (dirtree.length > 1) {
|
|
|
|
var newul = document.createElement("ul");
|
|
|
|
var newul = document.createElement("ul");
|
|
|
|
|
|
|
|
|
|
|
|
tag.parentElement.append(newul);
|
|
|
|
tag.parentElement.appendChild(newul);
|
|
|
|
for (let i = 1; i < dirtree.length; i++) {
|
|
|
|
for (let i = 1; i < dirtree.length; i++) {
|
|
|
|
if (Array.isArray(dirtree[i])) {
|
|
|
|
if (Array.isArray(dirtree[i])) {
|
|
|
|
this.drawDirTree(dirtree[i]);
|
|
|
|
this.drawDirTree(dirtree[i], newul);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
var text = document.createTextNode(dirtree[i]);
|
|
|
|
var text = document.createTextNode(dirtree[i]);
|
|
|
@ -25,7 +23,6 @@ class View {
|
|
|
|
newul.appendChild(tag);
|
|
|
|
newul.appendChild(tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.hloubka++;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|