|
|
|
@ -1,7 +1,11 @@
|
|
|
|
|
class View {
|
|
|
|
|
constructor() {}
|
|
|
|
|
|
|
|
|
|
drawDirTree(dirtree, ulToAdd = document.getElementsByTagName("ul")[0]) {
|
|
|
|
|
drawDirTree(
|
|
|
|
|
dirtree,
|
|
|
|
|
ulToAdd = document.getElementsByTagName("ul")[0],
|
|
|
|
|
parrentObj
|
|
|
|
|
) {
|
|
|
|
|
var dirtreeul = document.getElementsByTagName("ul");
|
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
|
var text = document.createTextNode(dirtree[0]);
|
|
|
|
@ -16,17 +20,25 @@ class View {
|
|
|
|
|
tag.parentElement.appendChild(newul);
|
|
|
|
|
for (let i = 1; i < dirtree.length; i++) {
|
|
|
|
|
if (Array.isArray(dirtree[i])) {
|
|
|
|
|
this.drawDirTree(dirtree[i], newul);
|
|
|
|
|
this.drawDirTree(dirtree[i], newul, parrentObj);
|
|
|
|
|
} else {
|
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
|
var text = document.createTextNode(dirtree[i]);
|
|
|
|
|
tag.appendChild(text);
|
|
|
|
|
newul.appendChild(tag);
|
|
|
|
|
var _this = this;
|
|
|
|
|
tag.addEventListener("click", function () {
|
|
|
|
|
parrentObj.loadFile(dirtree[0] + dirtree[i]);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
openFile(fileread) {
|
|
|
|
|
let textArea = document.getElementsByTagName("textarea")[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
removeDirTree() {
|
|
|
|
|
let mainul = document.getElementsByTagName("ul")[0];
|
|
|
|
|
while (mainul.firstChild) {
|
|
|
|
@ -61,7 +73,7 @@ class View {
|
|
|
|
|
let repo = document.getElementById("inputRepository");
|
|
|
|
|
let baseDir = document.getElementById("inputBaseDir");
|
|
|
|
|
|
|
|
|
|
repo.value = localStorage.getItem("repo")
|
|
|
|
|
repo.value = localStorage.getItem("repo");
|
|
|
|
|
baseDir.value = localStorage.getItem("baseDir");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|