Add arrow keys support
This commit is contained in:
parent
d3b794c9da
commit
6a7792239e
3 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
});
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue