From 6a7792239eeff458fa3ad61f0fc66eee66e0b82d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pastuszak?= Date: Tue, 5 Apr 2016 22:29:58 +0200 Subject: [PATCH] Add arrow keys support --- public_html/js/Presenters/PagerPresenter.js | 4 ++-- public_html/js/Presenters/PostPresenter.js | 8 ++++---- public_html/templates/help.tpl | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/public_html/js/Presenters/PagerPresenter.js b/public_html/js/Presenters/PagerPresenter.js index caab24d8..26a61658 100644 --- a/public_html/js/Presenters/PagerPresenter.js +++ b/public_html/js/Presenters/PagerPresenter.js @@ -62,8 +62,8 @@ App.Presenters.PagerPresenter = function( .fail(loaded); if (!endlessScroll) { - keyboard.keydown('a', navigateToPrevPage); - keyboard.keydown('d', navigateToNextPage); + keyboard.keydown(['a', 'left'], navigateToPrevPage); + keyboard.keydown(['d', 'right'], navigateToNextPage); } } diff --git a/public_html/js/Presenters/PostPresenter.js b/public_html/js/Presenters/PostPresenter.js index ef395a47..1aae2617 100644 --- a/public_html/js/Presenters/PostPresenter.js +++ b/public_html/js/Presenters/PostPresenter.js @@ -92,25 +92,25 @@ App.Presenters.PostPresenter = function( if (nextPostUrl) { $nextPost.addClass('enabled'); $nextPost.attr('href', nextPostUrl); - keyboard.keyup('a', function() { + keyboard.keyup(['a', 'left'], function() { router.navigate(nextPostUrl); }); } else { $nextPost.removeClass('enabled'); $nextPost.removeAttr('href'); - keyboard.unbind('a'); + keyboard.unbind(['a', 'left']); } if (prevPostUrl) { $prevPost.addClass('enabled'); $prevPost.attr('href', prevPostUrl); - keyboard.keyup('d', function() { + keyboard.keyup(['d', 'right'], function() { router.navigate(prevPostUrl); }); } else { $prevPost.removeClass('enabled'); $prevPost.removeAttr('href'); - keyboard.unbind('d'); + keyboard.unbind(['d', 'right']); } }).fail(function() { }); diff --git a/public_html/templates/help.tpl b/public_html/templates/help.tpl index 1bb41161..c626317d 100644 --- a/public_html/templates/help.tpl +++ b/public_html/templates/help.tpl @@ -60,7 +60,7 @@ - [A] and [D] + [A] and [D]
[Left] and [Right] arrow keys Go to newer/older page or post