summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.rst3
-rw-r--r--js/app/directives/itemshortcuts.coffee11
-rw-r--r--js/public/app.js10
3 files changed, 21 insertions, 3 deletions
diff --git a/README.rst b/README.rst
index a4fa9353d..09d54281c 100644
--- a/README.rst
+++ b/README.rst
@@ -107,7 +107,8 @@ Keyboard shortcuts
* **Previous item**: p / k / left arrow
* **Star current item**: s / i
* **Keep current item unread**: u
-* **Star item and jump to next one**: h
+* **Star item and jump to next one**: h
+* **Open current item**: o
Mobile Clients
--------------
diff --git a/js/app/directives/itemshortcuts.coffee b/js/app/directives/itemshortcuts.coffee
index 9045ea949..076da571e 100644
--- a/js/app/directives/itemshortcuts.coffee
+++ b/js/app/directives/itemshortcuts.coffee
@@ -79,6 +79,11 @@ angular.module('News').directive 'itemShortcuts', ['$window', ($window) ->
$item.find('.star').trigger('click')
+ openCurrentItem = (scrollArea) ->
+ $item = getCurrentItem(scrollArea).find('.item_title a')
+ $item.trigger('click')
+ window.open($item.attr('href'), '_blank')
+
$($window.document).keydown (e) ->
# only activate if no input elements is focused
@@ -102,7 +107,7 @@ angular.module('News').directive 'itemShortcuts', ['$window', ($window) ->
# u
else if e.keyCode == 85
keepUnreadCurrentItem(scrollArea)
-
+
# s or i or l
else if e.keyCode == 73 or e.keyCode == 83 or e.keyCode == 76
starCurrentItem(scrollArea)
@@ -112,5 +117,9 @@ angular.module('News').directive 'itemShortcuts', ['$window', ($window) ->
starCurrentItem(scrollArea)
jumpToNextItem(scrollArea)
+ # o
+ else if e.keyCode == 79
+ openCurrentItem(scrollArea)
+
] \ No newline at end of file
diff --git a/js/public/app.js b/js/public/app.js
index 7a2da9d99..c345d54d5 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,12 @@ 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).find('.item_title a');
+ $item.trigger('click');
+ return window.open($item.attr('href'), '_blank');
+ };
return $($window.document).keydown(function(e) {
var focused, scrollArea;
focused = $(':focus');
@@ -228,6 +234,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);
}
}
});