diff options
-rw-r--r-- | CHANGELOG | 1 | ||||
-rw-r--r-- | js/app/directives/itemshortcuts.coffee | 7 | ||||
-rw-r--r-- | js/public/app.js | 11 |
3 files changed, 14 insertions, 5 deletions
@@ -1,5 +1,6 @@ owncloud-news (1.205) * Also allow magnet urls in articles +* When jumping to the next item after the last one, also mark the last item as read owncloud-news (1.204) * Fix problem that caused python updater script to exit because of maximum recursion 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; |