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