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 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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue