fix keybindings
This commit is contained in:
parent
c75ed00bcc
commit
f73b67d74f
14
s/shit.js
14
s/shit.js
|
@ -1,10 +1,4 @@
|
|||
const keybindings = {
|
||||
"ArrowLeft": clickOnElementBinding("#next"),
|
||||
"ArrowRight": clickOnElementBinding("#prev"),
|
||||
"r": clickOnElementBinding("#random")
|
||||
};
|
||||
|
||||
const clickOnElementBinding(selector) = () => {
|
||||
const clickOnElementBinding = selector => {
|
||||
return () => {
|
||||
const elem = document.querySelector(selector);
|
||||
if(elem)
|
||||
|
@ -12,6 +6,12 @@ const clickOnElementBinding(selector) = () => {
|
|||
};
|
||||
};
|
||||
|
||||
const keybindings = {
|
||||
"ArrowLeft": clickOnElementBinding("#next"),
|
||||
"ArrowRight": clickOnElementBinding("#prev"),
|
||||
"r": clickOnElementBinding("#random")
|
||||
};
|
||||
|
||||
(() => {
|
||||
document.addEventListener("keydown", e => {
|
||||
if(e.key in keybindings) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user