Compare commits

..

2 commits

View file

@ -320,12 +320,16 @@ document.addEventListener("keydown", (e) => {
} }
const list = side != 1 ? focusListMain : focusListSecond const list = side != 1 ? focusListMain : focusListSecond
const currentFocus = list.indexOf(focused) const currentFocus = list.indexOf(focused)
switch(e.key) { switch(e.code) {
case "Escape": case "Escape":
tui.home() tui.home()
break break
case "ArrowRight": case "ArrowRight":
case "ArrowDown": case "ArrowDown":
case "KeyL":
case "KeyJ":
case "KeyD":
case "KeyS":
if (list.length > 0) { if (list.length > 0) {
if (currentFocus < list.length - 1) { e.preventDefault() } if (currentFocus < list.length - 1) { e.preventDefault() }
if (side < 1 && currentFocus == -1) { if (side < 1 && currentFocus == -1) {
@ -338,6 +342,10 @@ document.addEventListener("keydown", (e) => {
break break
case "ArrowLeft": case "ArrowLeft":
case "ArrowUp": case "ArrowUp":
case "KeyH":
case "KeyK":
case "KeyA":
case "KeyW":
if (list.length > 0) { if (list.length > 0) {
if (currentFocus > 0) { e.preventDefault() } if (currentFocus > 0) { e.preventDefault() }
if (side < 1 && currentFocus == -1) { if (side < 1 && currentFocus == -1) {
@ -349,7 +357,8 @@ document.addEventListener("keydown", (e) => {
} }
break break
case "Enter": case "Enter":
case " ": case "Space":
case "KeyE":
const skipDiv = document.getElementsByClassName("skip-animation")[0] const skipDiv = document.getElementsByClassName("skip-animation")[0]
if (skipDiv) { if (skipDiv) {
if (window.getComputedStyle(skipDiv).visibility != "hidden") {skipAnimation()} if (window.getComputedStyle(skipDiv).visibility != "hidden") {skipAnimation()}
@ -359,6 +368,7 @@ document.addEventListener("keydown", (e) => {
focused.click() focused.click()
break break
case "Tab": case "Tab":
case "KeyQ":
e.preventDefault() e.preventDefault()
if (side >= 0) {side = (side + 1) % 2} if (side >= 0) {side = (side + 1) % 2}
if (side == 0) { if (side == 0) {