update keybindings
This commit is contained in:
parent
c572b84026
commit
c75ed00bcc
16
s/shit.js
16
s/shit.js
|
@ -1,19 +1,19 @@
|
|||
const keybindings = {
|
||||
'ArrowLeft': clickOnElementBinding('#next'),
|
||||
'ArrowRight': clickOnElementBinding('#prev'),
|
||||
'r': clickOnElementBinding('#random')
|
||||
"ArrowLeft": clickOnElementBinding("#next"),
|
||||
"ArrowRight": clickOnElementBinding("#prev"),
|
||||
"r": clickOnElementBinding("#random")
|
||||
};
|
||||
|
||||
function clickOnElementBinding(selector) {
|
||||
const clickOnElementBinding(selector) = () => {
|
||||
return () => {
|
||||
let elem = document.querySelector(selector);
|
||||
const elem = document.querySelector(selector);
|
||||
if(elem)
|
||||
elem.click();
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
(function() {
|
||||
document.addEventListener('keydown', e => {
|
||||
(() => {
|
||||
document.addEventListener("keydown", e => {
|
||||
if(e.key in keybindings) {
|
||||
e.preventDefault();
|
||||
keybindings[e.key]();
|
||||
|
|
Loading…
Reference in New Issue
Block a user