You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
653 B
JavaScript
30 lines
653 B
JavaScript
|
|
function hugotOverrideFirstNext(func){
|
|
document.hugotOverrideFirstNext = func;
|
|
}
|
|
|
|
document.onkeydown = function (event) {
|
|
switch (event.keyCode) {
|
|
case 37:
|
|
//left key
|
|
document.getElementById('previous').click();
|
|
case 38:
|
|
console.log("Up key is pressed.");
|
|
break;
|
|
case 39:
|
|
//right key
|
|
if (document.hugotOverrideFirstNext) {
|
|
let func = document.hugotOverrideFirstNext;
|
|
document.hugotOverrideFirstNext = null;
|
|
func();
|
|
return;
|
|
}
|
|
|
|
document.getElementById('next').click();
|
|
break;
|
|
case 40:
|
|
console.log("Down key is pressed.");
|
|
break;
|
|
}
|
|
};
|