Skip to content

Commit

Permalink
Merge pull request FreshRSS#1327 from Alkarex/scroll-keep-as-unread
Browse files Browse the repository at this point in the history
Scroll as read: keep unread function
  • Loading branch information
Alkarex committed Oct 16, 2016
2 parents 981eee3 + 2926cc0 commit 10c442c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions p/scripts/main.js
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 10c442c

Please sign in to comment.