2015-03-07 21:52:03 +00:00
|
|
|
function navigateKeyboard(leftURL, rightURL) {
|
|
|
|
window.addEventListener("keypress", function (event) {
|
|
|
|
var key = event.which || event.keyCode; // event.keyCode is used for IE8 and earlier versions
|
|
|
|
switch (key) {
|
|
|
|
case 37:
|
2015-03-07 22:59:27 +00:00
|
|
|
goLeft(leftURL);
|
2015-03-07 21:52:03 +00:00
|
|
|
break;
|
2015-03-07 22:59:27 +00:00
|
|
|
|
2015-03-07 21:52:03 +00:00
|
|
|
case 39:
|
2015-03-07 22:59:27 +00:00
|
|
|
goRight(rightURL);
|
2015-03-07 21:52:03 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}, false);
|
2015-03-07 22:59:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
function goLeft(leftURL) {
|
|
|
|
if (leftURL != "?view=view&id=") {
|
|
|
|
window.location = window.location.origin + window.location.pathname + leftURL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function goRight(rightURL) {
|
|
|
|
if (rightURL != "?view=view&id=") {
|
|
|
|
window.location = window.location.origin + window.location.pathname + rightURL;
|
|
|
|
}
|
2015-03-07 21:52:03 +00:00
|
|
|
}
|