From 64bad02a3be632b6e8cb19f14e2f94d91a786250 Mon Sep 17 00:00:00 2001 From: Vladimir Panteleev Date: Sat, 27 Jul 2019 22:09:35 +0000 Subject: [PATCH] assets/scripts.js: Do not trigger key events with modifier keys These key combinations usually mean something else and are not intended for the web page. --- assets/scripts.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/assets/scripts.js b/assets/scripts.js index 72d9a8f..31487c9 100644 --- a/assets/scripts.js +++ b/assets/scripts.js @@ -336,6 +336,8 @@ window.onload = function() { }; document.onkeypress = function (e) { + if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) + return; if (e.code == 'KeyF') toggleFullScreen(); if (e.code == 'KeyR') @@ -344,14 +346,13 @@ window.onload = function() { togglePlayPause(); }; - document.onkeydown = function (evt) { - var v = document.getElementById("video"); - - if (evt.key == 'ArrowLeft') { + document.onkeydown = function (e) { + if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) + return; + if (e.key == 'ArrowLeft') { jumpBack(); } - - if (evt.key == 'ArrowRight') { + if (e.key == 'ArrowRight') { jumpForward(); } };