From 044fa9a6a5f23d7ce7587f6a62445bd608d760e8 Mon Sep 17 00:00:00 2001 From: Leonard Jonathan Oh Date: Sat, 11 Sep 2021 14:27:07 +0000 Subject: [PATCH] Enhancement (keyboard): Support scrolling to beginning at end, and to end from beginning This improves navigational flow as it should be in line with user expectation. The user should not have to press HOME or END keys to go back to the desired position in the document. Add support for: - RIGHT and DOWN arrow keys to go back to beginning when at end - LEFT and UP arrow keys to go back to end when at beginning --- README.md | 6 +++--- webize | 6 ++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3cef262..71b8989 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,10 @@ Keyboard shortcuts: |---|---| | LEFT | Previous image | RIGHT | Next image -| UP | Previous image (of previous row in tiled view) -| DOWN | Next image (of next row in tiled view) +| UP | Previous image, or previous row in tile mode +| DOWN | Next image, or next row in tile mode | ENTER | Expand image -| BACKSPACE | Back to tiled view +| BACKSPACE | Back to tile mode | SPACE | Next image | ESC | Escape from full screen, or back to tile mode | `F` | Mode: Full screen diff --git a/webize b/webize index 4a0ba71..f2b92b6 100755 --- a/webize +++ b/webize @@ -578,7 +578,8 @@ cat - >> "$indexHtm" <<'EOF' var setPreviousImageAsActiveImage = function() { if (activeImageIndex <= 0) { - setActiveImageIndex(0, true); + // Go to end + setActiveImageIndex(images.length - 1, true); }else { var imageholder = images[activeImageIndex].parentNode; var idx = Array.from(imageholder.parentNode.children).indexOf(imageholder); // Wrapper @@ -589,7 +590,8 @@ cat - >> "$indexHtm" <<'EOF' var setNextImageAsActiveImage = function() { if (activeImageIndex >= images.length - 1) { - setActiveImageIndex(images.length - 1, true); + // Go to start + setActiveImageIndex(0, true); }else { var imageholder = images[activeImageIndex].parentNode; var idx = Array.from(imageholder.parentNode.children).indexOf(imageholder); // Wrapper