summaryrefslogtreecommitdiffstats
path: root/js/public/app.js
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-06-07 19:02:54 +0200
committerMorris Jobke <morris.jobke@gmail.com>2013-06-07 19:02:54 +0200
commitfa7553a05d27b6a8179aa609d4d2a26490d0b64a (patch)
tree8d8ec1aeb24002fc40e563d2c7a4e279f14f081e /js/public/app.js
parent4fe9d788174e513db005eae167fea986113bec74 (diff)
add shortcut to open current item
Diffstat (limited to 'js/public/app.js')
-rw-r--r--js/public/app.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/js/public/app.js b/js/public/app.js
index 7a2da9d99..bd8afeac7 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -146,7 +146,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
angular.module('News').directive('itemShortcuts', [
'$window', function($window) {
return function(scope, elm, attr) {
- var getCurrentItem, jumpTo, jumpToNextItem, jumpToPreviousItem, keepUnreadCurrentItem, starCurrentItem;
+ var getCurrentItem, jumpTo, jumpToNextItem, jumpToPreviousItem, keepUnreadCurrentItem, openCurrentItem, starCurrentItem;
jumpTo = function($scrollArea, $item) {
var position;
position = $item.offset().top - $scrollArea.offset().top + $scrollArea.scrollTop();
@@ -212,6 +212,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
$item = getCurrentItem(scrollArea);
return $item.find('.star').trigger('click');
};
+ openCurrentItem = function(scrollArea) {
+ var $item;
+ $item = getCurrentItem(scrollArea);
+ return $item.find('.item_title a').trigger('click');
+ };
return $($window.document).keydown(function(e) {
var focused, scrollArea;
focused = $(':focus');
@@ -228,6 +233,8 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
} else if (e.keyCode === 72) {
starCurrentItem(scrollArea);
return jumpToNextItem(scrollArea);
+ } else if (e.keyCode === 79) {
+ return openCurrentItem(scrollArea);
}
}
});