2017-04-18 22:21:18 +02:00
|
|
|
$(function () {
|
|
|
|
$('#page-switcher').on('change', function(e) {
|
|
|
|
var page = $(e.target).val();
|
|
|
|
window.location = '/page/' + page;
|
|
|
|
});
|
2017-04-25 23:32:56 +02:00
|
|
|
|
|
|
|
$(document).on('keydown', function(e) {
|
2017-05-17 21:49:12 +02:00
|
|
|
// Only replace the arrow key functionif there are not needed
|
|
|
|
if ($('form input, form textarea').filter(':focus').length > 0)
|
|
|
|
return;
|
|
|
|
|
2017-04-25 23:32:56 +02:00
|
|
|
switch (e.keyCode) {
|
|
|
|
case 76: // l
|
|
|
|
case 39: // -->
|
|
|
|
var prevUrl = $('#prev-image').attr('href');
|
|
|
|
if (prevUrl !== undefined) window.location = prevUrl;
|
|
|
|
break;
|
|
|
|
case 72: // h
|
|
|
|
case 37: // <--
|
|
|
|
var nextUrl = $('#next-image').attr('href');
|
|
|
|
if (nextUrl !== undefined) window.location = nextUrl;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
});
|
2017-04-18 22:21:18 +02:00
|
|
|
});
|