Merge branch 'f0ckdev' into 'master'

add keybind for random (r)

See merge request !107
This commit is contained in:
Flummi 2017-05-08 02:59:57 +00:00
commit b5fdf6d040

View File

@ -1,26 +1,27 @@
function arrowKeys(e) { function arrowKeys(e) {
switch(e.keyCode) { switch(e.keyCode) {
case 39: case 39:
var prev = document.getElementById('prev'); var prev = document.getElementById('prev');
if(prev) prev.click(); if(prev) prev.click();
break; break;
case 37: case 37:
var next = document.getElementById('next'); var next = document.getElementById('next');
if(next) next.click(); if(next) next.click();
break; break;
} case 82:
var random = document.getElementById('random');
if(random) random.click();
}
} }
if(document.readyState == 'complete' || document.readyState == 'loaded') if(document.readyState == 'complete' || document.readyState == 'loaded')
document.addEventListener('keydown', arrowKeys); document.addEventListener('keydown', arrowKeys);
else { else {
if(/Chrome/i.test(navigator.userAgent)) if(/Chrome/i.test(navigator.userAgent))
window.addEventListener('load', function () { window.addEventListener('load', function () {
document.addEventListener('keydown', arrowKeys); document.addEventListener('keydown', arrowKeys);
}); });
else else
document.addEventListener('DOMContentLoaded', function () { document.addEventListener('DOMContentLoaded', function () {
document.addEventListener('keydown', arrowKeys); document.addEventListener('keydown', arrowKeys);
}); });
} }
if(x = document.getElementById("player"))
x.volume = 0.3;