From a590dbb3d741ba27bc2ca3403e0d1a060d260c79 Mon Sep 17 00:00:00 2001 From: Flummi Date: Mon, 8 May 2017 04:58:29 +0200 Subject: [PATCH] add keybind for random (r) --- s/shit.js | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/s/shit.js b/s/shit.js index 5335d52..470026a 100644 --- a/s/shit.js +++ b/s/shit.js @@ -1,26 +1,27 @@ function arrowKeys(e) { - switch(e.keyCode) { - case 39: - var prev = document.getElementById('prev'); - if(prev) prev.click(); - break; - case 37: - var next = document.getElementById('next'); - if(next) next.click(); - break; - } + switch(e.keyCode) { + case 39: + var prev = document.getElementById('prev'); + if(prev) prev.click(); + break; + case 37: + var next = document.getElementById('next'); + if(next) next.click(); + break; + case 82: + var random = document.getElementById('random'); + if(random) random.click(); + } } if(document.readyState == 'complete' || document.readyState == 'loaded') - document.addEventListener('keydown', arrowKeys); + document.addEventListener('keydown', arrowKeys); else { - if(/Chrome/i.test(navigator.userAgent)) - window.addEventListener('load', function () { - document.addEventListener('keydown', arrowKeys); - }); - else - document.addEventListener('DOMContentLoaded', function () { - document.addEventListener('keydown', arrowKeys); - }); + if(/Chrome/i.test(navigator.userAgent)) + window.addEventListener('load', function () { + document.addEventListener('keydown', arrowKeys); + }); + else + document.addEventListener('DOMContentLoaded', function () { + document.addEventListener('keydown', arrowKeys); + }); } -if(x = document.getElementById("player")) - x.volume = 0.3; \ No newline at end of file