summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-08-14 12:15:19 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-08-14 12:15:19 +0200
commit259dcbe5a0179582988c50cfaea77b68af10bb9d (patch)
tree5fb6a331f22fff41ffdd257e720d14d1435c5e9e /js
parent4a20d87d1654b364cda7ce42f68ea5506f473147 (diff)
When jumping to the next item after the last one, also mark the last item as read, fix #213
Diffstat (limited to 'js')
-rw-r--r--js/app/directives/itemshortcuts.coffee7
-rw-r--r--js/public/app.js11
2 files changed, 13 insertions, 5 deletions
diff --git a/js/app/directives/itemshortcuts.coffee b/js/app/directives/itemshortcuts.coffee
index 076da571e..d78af0c15 100644
--- a/js/app/directives/itemshortcuts.coffee
+++ b/js/app/directives/itemshortcuts.coffee
@@ -52,11 +52,18 @@ angular.module('News').directive 'itemShortcuts', ['$window', ($window) ->
jumpToNextItem = (scrollArea) ->
$scrollArea = $(scrollArea)
$items = $scrollArea.find('.feed_item')
+ jumped = false
for item in $items
$item = $(item)
if $item.position().top > 1
+ jumped = true
jumpTo($scrollArea, $item)
break
+ # in case this is the last item it should still scroll below the
+ # top
+ if jumped == false
+ $scrollArea.scrollTop($scrollArea.prop('scrollHeight'))
+
getCurrentItem = (scrollArea) ->
diff --git a/js/public/app.js b/js/public/app.js
index 39cd509c4..33c54c0e5 100644
--- a/js/public/app.js
+++ b/js/public/app.js
@@ -225,21 +225,22 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
}
};
jumpToNextItem = function(scrollArea) {
- var $item, $items, $scrollArea, item, _i, _len, _results;
+ var $item, $items, $scrollArea, item, jumped, _i, _len;
$scrollArea = $(scrollArea);
$items = $scrollArea.find('.feed_item');
- _results = [];
+ jumped = false;
for (_i = 0, _len = $items.length; _i < _len; _i++) {
item = $items[_i];
$item = $(item);
if ($item.position().top > 1) {
+ jumped = true;
jumpTo($scrollArea, $item);
break;
- } else {
- _results.push(void 0);
}
}
- return _results;
+ if (jumped === false) {
+ return $scrollArea.scrollTop($scrollArea.prop('scrollHeight'));
+ }
};
getCurrentItem = function(scrollArea) {
var $item, $items, $scrollArea, item, _i, _len;