From d7683c7f82ff87171bf17192866f8a6a47185b14 Mon Sep 17 00:00:00 2001 From: cyfraeviolae Date: Sat, 26 Feb 2022 02:09:17 -0500 Subject: arrows --- static/script.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'static/script.js') diff --git a/static/script.js b/static/script.js index 9692f36..7585efa 100644 --- a/static/script.js +++ b/static/script.js @@ -167,6 +167,10 @@ function keyHandler(key) { if (key == 'Backspace') { el.innerText = ''; nextel = document.querySelector(`[data-offset="${offset-1}"]`); + } else if (key == 'ArrowLeft') { + nextel = document.querySelector(`[data-offset="${offset-1}"]`); + } else if (key == 'ArrowRight') { + nextel = document.querySelector(`[data-offset="${offset+1}"]`); } else { el.innerText = key.toUpperCase(); nextel = document.querySelector(`[data-offset="${offset+1}"]`); @@ -184,7 +188,7 @@ document.addEventListener('keydown', function(e) { // if (e.ctrlKey || e.altKey || (e.key.length != 1 && e.key != 'Backspace')) { // return; // } - if (e.ctrlKey || e.altKey || (!"ABCDEFGHIJKLMNOPQRSTUVWXYZ".includes(e.key.toUpperCase()) && e.key != 'Backspace' && e.key != 'Enter')) { + if (e.ctrlKey || e.altKey || (!"ABCDEFGHIJKLMNOPQRSTUVWXYZ".includes(e.key.toUpperCase()) && e.key != 'Backspace' && e.key != 'Enter' && e.key != 'ArrowLeft' && e.key != 'ArrowRight')) { return; } if (e.target.id == 'share') { -- cgit v1.2.3