Add arrow keys support

This commit is contained in:
Paweł Pastuszak 2016-04-05 22:29:58 +02:00
parent d3b794c9da
commit 6a7792239e
3 changed files with 7 additions and 7 deletions

View file

@ -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);
}
}

View file

@ -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() {
});

View file

@ -60,7 +60,7 @@
</tr>
<tr>
<td><code>[A]</code> and <code>[D]</code></td>
<td><code>[A]</code> and <code>[D]</code><br/><code>[Left]</code> and <code>[Right]</code> arrow keys</td>
<td>Go to newer/older page or post</td>
</tr>