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 = {
|
const clickOnElementBinding = selector => {
|
||||||
"ArrowLeft": clickOnElementBinding("#next"),
|
|
||||||
"ArrowRight": clickOnElementBinding("#prev"),
|
|
||||||
"r": clickOnElementBinding("#random")
|
|
||||||
};
|
|
||||||
|
|
||||||
const clickOnElementBinding(selector) = () => {
|
|
||||||
return () => {
|
return () => {
|
||||||
const elem = document.querySelector(selector);
|
const elem = document.querySelector(selector);
|
||||||
if(elem)
|
if(elem)
|
||||||
|
@ -12,6 +6,12 @@ const clickOnElementBinding(selector) = () => {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const keybindings = {
|
||||||
|
"ArrowLeft": clickOnElementBinding("#next"),
|
||||||
|
"ArrowRight": clickOnElementBinding("#prev"),
|
||||||
|
"r": clickOnElementBinding("#random")
|
||||||
|
};
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
document.addEventListener("keydown", e => {
|
document.addEventListener("keydown", e => {
|
||||||
if(e.key in keybindings) {
|
if(e.key in keybindings) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user