From 4a232151e065400495ec2ed0ca57dff8da84c4b7 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 25 Mar 2017 12:21:25 -0700 Subject: more keyboard shortcuts --- ext/mixed/js/display.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 050caf4e..f3423878 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -140,9 +140,8 @@ class Display { } entryScroll(index, smooth) { - if (index < 0 || index >= this.definitions.length) { - return; - } + index = Math.min(index, this.definitions.length - 1); + index = Math.max(index, 0); $('.current').hide().eq(index).show(); @@ -217,6 +216,14 @@ class Display { this.entryScroll(this.definitions.length - 1, true); }, + 33: /* page up */ () => { + this.entryScroll(this.index - 3, true); + }, + + 34: /* page down */ () => { + this.entryScroll(this.index + 3, true); + }, + 38: /* up */ () => { this.entryScroll(this.index - 1, true); }, -- cgit v1.2.3