From c75ed00bccbb1a118645b61fcde81991f2a68b04 Mon Sep 17 00:00:00 2001 From: jkhsjdhjs Date: Sat, 2 Dec 2017 23:44:21 +0100 Subject: [PATCH] update keybindings --- s/shit.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/s/shit.js b/s/shit.js index 1265ce1..27fb478 100644 --- a/s/shit.js +++ b/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]();