summaryrefslogtreecommitdiffstats
path: root/js/public/app.js
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2013-12-19 17:57:26 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2013-12-19 17:57:26 +0100
commit84b5be7f0bdfd346172c993b72cf0570bce03245 (patch)
tree510a83ecc498d373f21c8d9a11758f0056cf1817 /js/public/app.js
parent8f6ad4aaa7b85614bdfa1817f8bff5a7880c9dc7 (diff)
fix shortcuts and add shortcut to expand current item
Diffstat (limited to 'js/public/app.js')
-rw-r--r--js/public/app.js12
1 files changed, 10 insertions, 2 deletions
diff --git a/js/public/app.js b/js/public/app.js
index caaf5dc52..c729c90b0 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -196,7 +196,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, openCurrentItem, starCurrentItem;
+ var expandCurrentItem, getCurrentItem, jumpTo, jumpToNextItem, jumpToPreviousItem, keepUnreadCurrentItem, openCurrentItem, starCurrentItem;
jumpTo = function($scrollArea, $item) {
var position;
position = $item.offset().top - $scrollArea.offset().top + $scrollArea.scrollTop();
@@ -248,7 +248,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
for (_i = 0, _len = $items.length; _i < _len; _i++) {
item = $items[_i];
$item = $(item);
- if (($item.height() + $item.position().top) > 110) {
+ if (($item.height() + $item.position().top) > 30) {
return $item;
}
}
@@ -263,6 +263,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
$item = getCurrentItem(scrollArea);
return $item.find('.star').trigger('click');
};
+ expandCurrentItem = function(scrollArea) {
+ var $item;
+ $item = getCurrentItem(scrollArea);
+ return $item.find('.item_heading a').trigger('click');
+ };
openCurrentItem = function(scrollArea) {
var $item;
$item = getCurrentItem(scrollArea).find('.item_title a');
@@ -283,6 +288,9 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
} else if (e.keyCode === 85) {
e.preventDefault();
return keepUnreadCurrentItem(scrollArea);
+ } else if (e.keyCode === 69) {
+ e.preventDefault();
+ return expandCurrentItem(scrollArea);
} else if (e.keyCode === 73 || e.keyCode === 83 || e.keyCode === 76) {
e.preventDefault();
return starCurrentItem(scrollArea);