Add more keys
This commit is contained in:
parent
f6bd6476e9
commit
3e4288e31d
1 changed files with 12 additions and 2 deletions
|
|
@ -320,12 +320,16 @@ document.addEventListener("keydown", (e) => {
|
|||
}
|
||||
const list = side != 1 ? focusListMain : focusListSecond
|
||||
const currentFocus = list.indexOf(focused)
|
||||
switch(e.key) {
|
||||
switch(e.code) {
|
||||
case "Escape":
|
||||
tui.home()
|
||||
break
|
||||
case "ArrowRight":
|
||||
case "ArrowDown":
|
||||
case "KeyL":
|
||||
case "KeyJ":
|
||||
case "KeyD":
|
||||
case "KeyS":
|
||||
if (list.length > 0) {
|
||||
if (currentFocus < list.length - 1) { e.preventDefault() }
|
||||
if (side < 1 && currentFocus == -1) {
|
||||
|
|
@ -338,6 +342,10 @@ document.addEventListener("keydown", (e) => {
|
|||
break
|
||||
case "ArrowLeft":
|
||||
case "ArrowUp":
|
||||
case "KeyH":
|
||||
case "KeyK":
|
||||
case "KeyA":
|
||||
case "KeyW":
|
||||
if (list.length > 0) {
|
||||
if (currentFocus > 0) { e.preventDefault() }
|
||||
if (side < 1 && currentFocus == -1) {
|
||||
|
|
@ -349,7 +357,8 @@ document.addEventListener("keydown", (e) => {
|
|||
}
|
||||
break
|
||||
case "Enter":
|
||||
case " ":
|
||||
case "Space":
|
||||
case "KeyE":
|
||||
const skipDiv = document.getElementsByClassName("skip-animation")[0]
|
||||
if (skipDiv) {
|
||||
if (window.getComputedStyle(skipDiv).visibility != "hidden") {skipAnimation()}
|
||||
|
|
@ -359,6 +368,7 @@ document.addEventListener("keydown", (e) => {
|
|||
focused.click()
|
||||
break
|
||||
case "Tab":
|
||||
case "KeyQ":
|
||||
e.preventDefault()
|
||||
if (side >= 0) {side = (side + 1) % 2}
|
||||
if (side == 0) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue