add keybind for random (r)

This commit is contained in:
Flummi 2017-05-08 04:58:29 +02:00
parent afff24ea5d
commit a590dbb3d7

View File

@ -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;