X-Git-Url: https://git-public.kairo.at/?p=slides.git;a=blobdiff_plain;f=linuxwochen2018%2Fslides.js;h=4153c42b0ca19e1f9547a903777ae8d4275388f5;hp=310728982513215f05f36426dd88da13b9ea72dc;hb=7cd9ccaadd06571eabfcfc65041c87dcf3a6a1ed;hpb=163f61857dbdc27f2c79951de98e98ea06632db7;ds=sidebyside diff --git a/linuxwochen2018/slides.js b/linuxwochen2018/slides.js index 3107289..4153c42 100644 --- a/linuxwochen2018/slides.js +++ b/linuxwochen2018/slides.js @@ -192,25 +192,39 @@ function timerFired() { function handleKeyPress(e) { e = e || event; - switch (e.keyCode) { + switch (e.key) { // See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode#Constants_for_keyCode_value - case e.DOM_VK_LEFT: - case e.DOM_VK_DOWN: - case e.DOM_VK_PAGE_DOWN: - case e.DOM_VK_H: //8bitdo Zero "X" + case "ArrowLeft": + case "ArrowDown": + case "Left": // non-standard, old browsers + case "Down": // non-standard, old browsers + case "PageDown": + case "P": + case "p": + case "H": //8bitdo Zero "X" + case "h": //8bitdo Zero "X" go("prev"); break; - case e.DOM_VK_RIGHT: - case e.DOM_VK_UP: - case e.DOM_VK_PAGE_UP: - case e.DOM_VK_J: //8bitdo Zero "B" + case "ArrowRight": + case "ArrowUp": + case "Right": // non-standard, old browsers + case "Up": // non-standard, old browsers + case "PageUp": + case "N": + case "n": + case "J": //8bitdo Zero "B" + case "j": //8bitdo Zero "B" go("next"); break; - case e.DOM_VK_HOME: + case "Home": + case "I": //8bitdo Zero "Y" + case "i": //8bitdo Zero "Y" go("start"); break; - case e.DOM_VK_END: + case "End": + case "G": //8bitdo Zero "A" + case "g": //8bitdo Zero "A" go("toc"); break; } } window.onclick = handleClick; - window.onkeypress = handleKeyPress; + window.onkeydown = handleKeyPress; })();