From 973f03fc7053ebe469b7805cd89bd67b7725812f Mon Sep 17 00:00:00 2001 From: Wim Brand Date: Sat, 10 Aug 2019 14:15:54 +0200 Subject: [PATCH] File viewer fixes --- res/static/script/Keyboard.js | 37 ------------------------------ res/static/script/Viewer.js | 37 ++++++++++++++++++++++++++++++ res/static/script/compiled/home.js | 1 - res/static/style/viewer.css | 18 +++++---------- res/static/typescript/home/home.ts | 1 - res/template/file_viewer.html | 12 +++++----- res/template/home.html | 10 -------- res/template/paste.html | 22 ++++++++++++------ 8 files changed, 64 insertions(+), 74 deletions(-) delete mode 100644 res/static/script/Keyboard.js diff --git a/res/static/script/Keyboard.js b/res/static/script/Keyboard.js deleted file mode 100644 index ab6cb1c..0000000 --- a/res/static/script/Keyboard.js +++ /dev/null @@ -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; - } -}); diff --git a/res/static/script/Viewer.js b/res/static/script/Viewer.js index c711e4d..d871af5 100644 --- a/res/static/script/Viewer.js +++ b/res/static/script/Viewer.js @@ -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; + } +}); diff --git a/res/static/script/compiled/home.js b/res/static/script/compiled/home.js index 9b939a5..f39a63f 100644 --- a/res/static/script/compiled/home.js +++ b/res/static/script/compiled/home.js @@ -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))); diff --git a/res/static/style/viewer.css b/res/static/style/viewer.css index 7d4e3e0..f2406a4 100644 --- a/res/static/style/viewer.css +++ b/res/static/style/viewer.css @@ -88,8 +88,8 @@ body{ min-width: 100px; text-align: center; vertical-align: middle; - transition: left 1s, top 1.5s; - overflow: auto; + transition: left 1s; + overflow: hidden; } /* Toolbars */ @@ -106,7 +106,7 @@ body{ padding: 0; text-align: left; box-shadow: 2px 2px 8px var(--shadow_color); - transition: left 1s, top 1.5s; + transition: left 1s; } .file_viewer > .file_viewer_window > .file_viewer_sharebar{ position: absolute; @@ -122,7 +122,7 @@ body{ text-align: center; z-index: 48; overflow: hidden; - transition: left 1s, top 1.5s; + transition: left 1s; } /* ===================== @@ -130,10 +130,6 @@ body{ =====================*/ .image-container{ position: relative; - top: 0px; - left: 0px; - right: 0px; - bottom: 0px; height: 100%; width: 100%; text-align: center; @@ -152,10 +148,8 @@ body{ background: #333 none; position: relative; text-align: left; - top: 0; - bottom: 0; - left: 0; - right: 0; + height: 100%; + width: 100%; padding: 5px 5px 5px 20px; box-sizing: border-box; } diff --git a/res/static/typescript/home/home.ts b/res/static/typescript/home/home.ts index cbe5910..9d17c36 100644 --- a/res/static/typescript/home/home.ts +++ b/res/static/typescript/home/home.ts @@ -80,7 +80,6 @@ class UploadProgressBar implements FileUpload { function handleUploads(files: FileList) { if (uploader === null){ uploader = new UploadManager() - queueDiv.style.height = "340px" } for (var i = 0; i < files.length; i++) { diff --git a/res/template/file_viewer.html b/res/template/file_viewer.html index 85aa1a7..af8d8b5 100644 --- a/res/template/file_viewer.html +++ b/res/template/file_viewer.html @@ -162,15 +162,15 @@ - - - - - + + + {{template "analytics"}} diff --git a/res/template/home.html b/res/template/home.html index 0f03255..1860596 100644 --- a/res/template/home.html +++ b/res/template/home.html @@ -5,16 +5,6 @@ {{template "meta_tags" "Free file sharing service"}} {{template "user_style" .}} - diff --git a/res/template/paste.html b/res/template/paste.html index c8529e0..95a1f34 100644 --- a/res/template/paste.html +++ b/res/template/paste.html @@ -5,7 +5,7 @@ {{template "meta_tags" "Text Upload"}} {{template "user_style" .}} - +