Former-commit-id: ae54ba4ce48c1e4bb374894acc11c07bc3edfd65
This commit is contained in:
Henrique Dias
2016-12-31 21:04:47 +00:00
parent 8deaf9a914
commit a26a7d2e60
4 changed files with 106 additions and 25 deletions

View File

@@ -217,7 +217,12 @@ listing.handleSelectionChange = function(event) {
}
if (selectedNumber == 1) {
buttons.open.classList.remove("disabled");
if (document.getElementById(selectedItems[0]).dataset.dir == "true") {
buttons.open.classList.add("disabled");
} else {
buttons.open.classList.remove("disabled");
}
buttons.rename.classList.remove("disabled");
}
@@ -310,18 +315,28 @@ listing.updateColumns = function(event) {
}
// Keydown events
document.addEventListener('keydown', (event) => {
window.addEventListener('keydown', (event) => {
if (event.keyCode == 27) {
listing.unselectAll();
if (document.querySelectorAll('.prompt').length) {
closePrompt(event);
}
}
if (event.keyCode == 113) {
listing.rename();
}
if (event.ctrlKey || event.metaKey) {
console.log("hey")
switch (String.fromCharCode(event.which).toLowerCase()) {
case 's':
event.preventDefault();
window.location = "?download=true"
}
}
});
window.addEventListener("resize", () => {
@@ -334,6 +349,7 @@ document.addEventListener('DOMContentLoaded', event => {
buttons.rename = document.getElementById("rename");
buttons.upload = document.getElementById("upload");
buttons.new = document.getElementById('new');
buttons.download = document.getElementById('download');
if (user.AllowEdit) {
buttons.rename.addEventListener("click", listing.rename);