|
|
@ -10,6 +10,8 @@ class Controller {
|
|
|
|
var settingsBtn = document.getElementsByClassName("settingsBtn")[0];
|
|
|
|
var settingsBtn = document.getElementsByClassName("settingsBtn")[0];
|
|
|
|
var settingsClose = document.getElementsByClassName("close");
|
|
|
|
var settingsClose = document.getElementsByClassName("close");
|
|
|
|
var settingsSubmit = document.getElementById("settingsSubmit");
|
|
|
|
var settingsSubmit = document.getElementById("settingsSubmit");
|
|
|
|
|
|
|
|
var textArea = document.getElementsByTagName("textarea")[0];
|
|
|
|
|
|
|
|
var saveBtn = document.getElementById("saveBtn");
|
|
|
|
|
|
|
|
|
|
|
|
cloneBtn.addEventListener("click", this.cloneRep.bind(this));
|
|
|
|
cloneBtn.addEventListener("click", this.cloneRep.bind(this));
|
|
|
|
purgeBtn.addEventListener("click", this.wipeFS.bind(this));
|
|
|
|
purgeBtn.addEventListener("click", this.wipeFS.bind(this));
|
|
|
@ -18,6 +20,17 @@ class Controller {
|
|
|
|
settingsClose[i].addEventListener("click", view.closeSettings.bind(this));
|
|
|
|
settingsClose[i].addEventListener("click", view.closeSettings.bind(this));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
settingsSubmit.addEventListener("click", this.saveSettings.bind(this));
|
|
|
|
settingsSubmit.addEventListener("click", this.saveSettings.bind(this));
|
|
|
|
|
|
|
|
textArea.addEventListener("keyup", this.saveButton.bind(this));
|
|
|
|
|
|
|
|
saveBtn.addEventListener("click", this.saveFile.bind(this));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveButton() {
|
|
|
|
|
|
|
|
var textArea = document.getElementsByTagName("textarea")[0];
|
|
|
|
|
|
|
|
if (textArea.value != this.openedFileValue) {
|
|
|
|
|
|
|
|
this.view.showSaveButton(true);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
this.view.showSaveButton(false);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
wipeFS() {
|
|
|
|
wipeFS() {
|
|
|
@ -27,14 +40,13 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
cloneRep(repurl) {
|
|
|
|
cloneRep(repurl) {
|
|
|
|
var that = this;
|
|
|
|
|
|
|
|
var loading = document.getElementsByClassName("loading")[0];
|
|
|
|
var loading = document.getElementsByClassName("loading")[0];
|
|
|
|
loading.style.display = "grid";
|
|
|
|
loading.style.display = "grid";
|
|
|
|
this.model.cloneRep().then(
|
|
|
|
this.model.cloneRep().then(
|
|
|
|
function (value) {
|
|
|
|
function (value) {
|
|
|
|
loading.style.removeProperty("display");
|
|
|
|
loading.style.removeProperty("display");
|
|
|
|
that.redrawDirTree(that.view);
|
|
|
|
this.redrawDirTree(this.view);
|
|
|
|
},
|
|
|
|
}.bind(this),
|
|
|
|
function (error) {}
|
|
|
|
function (error) {}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -63,11 +75,20 @@ class Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
loadFile(file) {
|
|
|
|
loadFile(file) {
|
|
|
|
|
|
|
|
this.openedFile = file;
|
|
|
|
this.model.readFile(file).then(
|
|
|
|
this.model.readFile(file).then(
|
|
|
|
function (value) {
|
|
|
|
function (value) {
|
|
|
|
|
|
|
|
this.openedFileValue = value;
|
|
|
|
this.view.openFile(value);
|
|
|
|
this.view.openFile(value);
|
|
|
|
}.bind(this),
|
|
|
|
}.bind(this),
|
|
|
|
function (error) {}
|
|
|
|
function (error) {}
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
saveFile() {
|
|
|
|
|
|
|
|
var textArea = document.getElementsByTagName("textarea")[0];
|
|
|
|
|
|
|
|
this.model.saveFile(this.openedFile, textArea.value)
|
|
|
|
|
|
|
|
this.openedFileValue = textArea.value;
|
|
|
|
|
|
|
|
this.saveButton()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|