use jQuery instead of JS + change spacing to tabs

this should fix IE/browser problems (see: #349)
This commit is contained in:
Daku 2014-02-19 06:23:08 +00:00
parent 5df6c09da6
commit fe6b83412f

View file

@ -31,20 +31,14 @@ class ArrowkeyNavigation extends Extension {
global $page;
$page->add_html_header("<script type=\"text/javascript\">
document.onkeyup=checkKeycode;
function checkKeycode(e)
{
var keycode;
if(window.event) keycode=window.event.keyCode;
else if(e) keycode=e.which;
if (e.srcElement.tagName != \"INPUT\")
{
if(keycode==\"37\") window.location.href='$prev_url';
else if(keycode==\"39\") window.location.href='$next_url';
}
}
</script>");
(function($){
$(document).keyup(function(e) {
if($(e.target).is('input', 'textarea')){ return; }
if (e.keyCode == 37) { window.location.href = '{$prev_url}'; }
else if (e.keyCode == 39) { window.location.href = '{$next_url}'; }
});
})(jQuery);
</script>", 60);
}
# returns info about the current page number
@ -61,7 +55,6 @@ class ArrowkeyNavigation extends Extension {
$total_pages = ceil($database->get_one(
"SELECT COUNT(*) FROM images") / $images_per_page);
}
else { // if there are tags, use pages with tags
$prefix = $event->get_arg(0)."/";
$page_number = (int)$event->get_arg(1);