diff options
| author | 2019-04-03 23:08:46 +0200 | |
|---|---|---|
| committer | 2019-04-03 23:08:46 +0200 | |
| commit | 452419bf83b2b124bb05c58f48b459107595ce0a (patch) | |
| tree | 9357aae42c5b6b41e0c311253389b64e7e0204c1 /p | |
| parent | 59b326040ada9faf363fe74d05760a296a512632 (diff) | |
Fix auto_remove_article (#2334)
* Fix auto_remove_article
https://github.com/FreshRSS/FreshRSS/issues/2323
* Second attempt
* Third attempt
Diffstat (limited to 'p')
| -rw-r--r-- | p/scripts/main.js | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index e8b5dbd4f..192d0bdf3 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -590,23 +590,24 @@ function onScroll() { }); } if (context.auto_remove_article) { - let maxTop = box_to_follow.scrollTop, - scrollOffset = 0; - document.querySelectorAll('.flux:not(.active):not(.keep_unread)').forEach(function (div) { + let scrollTop = box_to_follow.scrollTop; + let dirty = false; + document.querySelectorAll('.flux:not(.active):not(.not_read)').forEach(function (div) { if (!pending_entries[div.id] && div.offsetHeight > 0 && - div.offsetParent.offsetTop + div.offsetTop + div.offsetHeight < maxTop) { + div.offsetParent.offsetTop + div.offsetTop + (div.offsetHeight * 2) < scrollTop) { const p = div.previousElementSibling, n = div.nextElementSibling; if (p && p.classList.contains('day') && n && n.classList.contains('day')) { + scrollTop -= p.offsetHeight; p.remove(); } - maxTop -= div.offsetHeight; - scrollOffset -= div.offsetHeight; + scrollTop -= div.offsetHeight; div.remove(); + dirty = true; } }); - if (scrollOffset != 0) { - box_to_follow.scrollTop += scrollOffset; + if (dirty) { + box_to_follow.scrollTop = scrollTop; return; //onscroll will be called again } } |
