|
|
@ -1,7 +1,11 @@
|
|
|
|
class View {
|
|
|
|
class View {
|
|
|
|
constructor() {}
|
|
|
|
constructor() {}
|
|
|
|
|
|
|
|
|
|
|
|
drawDirTree(dirtree, ulToAdd = document.getElementsByTagName("ul")[0]) {
|
|
|
|
drawDirTree(
|
|
|
|
|
|
|
|
dirtree,
|
|
|
|
|
|
|
|
ulToAdd = document.getElementsByTagName("ul")[0],
|
|
|
|
|
|
|
|
parrentObj
|
|
|
|
|
|
|
|
) {
|
|
|
|
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]);
|
|
|
@ -16,17 +20,25 @@ class View {
|
|
|
|
tag.parentElement.appendChild(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], newul);
|
|
|
|
this.drawDirTree(dirtree[i], newul, parrentObj);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
var tag = document.createElement("li");
|
|
|
|
var text = document.createTextNode(dirtree[i]);
|
|
|
|
var text = document.createTextNode(dirtree[i]);
|
|
|
|
tag.appendChild(text);
|
|
|
|
tag.appendChild(text);
|
|
|
|
newul.appendChild(tag);
|
|
|
|
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() {
|
|
|
|
removeDirTree() {
|
|
|
|
let mainul = document.getElementsByTagName("ul")[0];
|
|
|
|
let mainul = document.getElementsByTagName("ul")[0];
|
|
|
|
while (mainul.firstChild) {
|
|
|
|
while (mainul.firstChild) {
|
|
|
@ -61,7 +73,7 @@ class View {
|
|
|
|
let repo = document.getElementById("inputRepository");
|
|
|
|
let repo = document.getElementById("inputRepository");
|
|
|
|
let baseDir = document.getElementById("inputBaseDir");
|
|
|
|
let baseDir = document.getElementById("inputBaseDir");
|
|
|
|
|
|
|
|
|
|
|
|
repo.value = localStorage.getItem("repo")
|
|
|
|
repo.value = localStorage.getItem("repo");
|
|
|
|
baseDir.value = localStorage.getItem("baseDir");
|
|
|
|
baseDir.value = localStorage.getItem("baseDir");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|