File viewer fixes

This commit is contained in:
2019-08-10 14:15:54 +02:00
parent a2b3b265a6
commit 973f03fc70
8 changed files with 64 additions and 74 deletions

View File

@@ -1,37 +0,0 @@
/* global ListNavigator, Toolbar */
$(document).keydown(function(event){
if (event.ctrlKey || event.altKey) {
return // prevent custom shortcuts from interfering with system shortcuts
}
switch (event.which) {
case 65: // A or left arrow key go to previous file
case 37:
ListNavigator.previousItem();
break;
case 68: // D or right arrow key go to next file
case 39:
ListNavigator.nextItem();
break;
case 83:
if (event.shiftKey) {
Toolbar.downloadList(); // SHIFT + S downloads all files in list
} else {
Toolbar.download(); // S to download the current file
}
break;
case 82: // R to toggle list shuffle
ListNavigator.toggleShuffle();
break;
case 67: // C to copy to clipboard
Toolbar.copyUrl();
break;
case 73: // I to open the details window
DetailsWindow.toggle();
break;
case 81: // Q to close the window
window.close();
break;
}
});

View File

@@ -65,3 +65,40 @@ function escapeHTML(str) {
.replace(/>/g, '>')
.replace(/"/g, '"');
}
// Register keyboard shortcuts
document.addEventListener("keydown", function(event){
if (event.ctrlKey || event.altKey) {
return // prevent custom shortcuts from interfering with system shortcuts
}
switch (event.which) {
case 65: // A or left arrow key go to previous file
case 37:
ListNavigator.previousItem();
break;
case 68: // D or right arrow key go to next file
case 39:
ListNavigator.nextItem();
break;
case 83:
if (event.shiftKey) {
Toolbar.downloadList(); // SHIFT + S downloads all files in list
} else {
Toolbar.download(); // S to download the current file
}
break;
case 82: // R to toggle list shuffle
ListNavigator.toggleShuffle();
break;
case 67: // C to copy to clipboard
Toolbar.copyUrl();
break;
case 73: // I to open the details window
DetailsWindow.toggle();
break;
case 81: // Q to close the window
window.close();
break;
}
});

View File

@@ -65,7 +65,6 @@ var UploadProgressBar = /** @class */ (function () {
function handleUploads(files) {
if (uploader === null) {
uploader = new UploadManager();
queueDiv.style.height = "340px";
}
for (var i = 0; i < files.length; i++) {
uploader.uploadFile(new UploadProgressBar(files.item(i)));