diff options
| author | 2016-10-16 16:12:38 +0200 | |
|---|---|---|
| committer | 2016-10-16 16:12:38 +0200 | |
| commit | f5143ed98d01f8728f4c8abd9eb3abea7a40488b (patch) | |
| tree | 7fcf3bdeb12d234e838f7afaa50769b4e5d468d2 | |
| parent | 77ceec127779cbcc3aa722693f8bfd2a73b65f7a (diff) | |
| parent | 6cd38d73d0b41ea7cd4da1fe611d761d7d442f2b (diff) | |
Merge pull request #1327 from Alkarex/scroll-keep-as-unread
Scroll as read: keep unread function
| -rw-r--r-- | p/scripts/main.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 47d651d5b..51323a969 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -116,8 +116,8 @@ function incUnreadsFeed(article, feed_id, nb) { var pending_entries = {}; function mark_read(active, only_not_read) { - if (active.length === 0 || active.attr('id') == '' || - (only_not_read === true && !active.hasClass("not_read"))) { + if ((active.length === 0) || (!active.attr('id')) || + (only_not_read && !active.hasClass("not_read"))) { return false; } @@ -142,8 +142,9 @@ function mark_read(active, only_not_read) { if (active.hasClass("not_read")) { active.removeClass("not_read"); inc--; - } else if (only_not_read !== true || active.hasClass("not_read")) { + } else { active.addClass("not_read"); + active.addClass("keep_unread"); inc++; } $r.find('.icon').replaceWith(data.icon); @@ -451,7 +452,7 @@ function auto_share(key) { function scrollAsRead(box_to_follow) { var minTop = 40 + (context.current_view === 'global' ? box_to_follow.offset().top : box_to_follow.scrollTop()); - $('.not_read:visible').each(function () { + $('.not_read:not(.keep_unread):visible').each(function () { var $this = $(this); if ($this.offset().top + $this.height() < minTop) { mark_read($this, true); |
