From fa4aed013bced545fd053b77ab629e052bb3309d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Sko=C5=99epa?= <jakub@skorepa.info> Date: Sun, 28 Feb 2016 00:06:46 +0100 Subject: [PATCH] Allow page switching with arrow keys Fixes #2 --- templates/partials/list.html.nunjucks | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/templates/partials/list.html.nunjucks b/templates/partials/list.html.nunjucks index 96aece6..fe46d6c 100644 --- a/templates/partials/list.html.nunjucks +++ b/templates/partials/list.html.nunjucks @@ -81,6 +81,11 @@ $(window).resize(onresize); $(document).load(onresize); $(document).ready(onresize); + $(document).keypress(function(e) { + if($("#search-overlay").hasClass("shown")) return; + if(e.key == "ArrowRight") window.location = "{{config.baseurl}}/{{metadata.nexturl}}"; + if(e.key == "ArrowLeft") window.location = "{{config.baseurl}}/{{metadata.prevurl}}"; + }); })(jQuery); </script> </div> <!-- #content --> -- GitLab