diff options
| author | 2022-09-05 08:53:50 +0200 | |
|---|---|---|
| committer | 2022-09-05 08:53:50 +0200 | |
| commit | e2867cfe1453f06d6bfab769552d39ba8b30df24 (patch) | |
| tree | 35273181507543bd83ea0506e4778bccd6a9cecb /p/scripts | |
| parent | fd22ee409082dd325d591bf57c73009a727122a1 (diff) | |
Shortcuts: auto-load at least a few articles (#4532)
* Auto-load at least a few articles
#fix https://github.com/FreshRSS/FreshRSS/issues/3974
* Fix init
* syntax
* Aledeg simplification
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index b0a6df01b..90e7d79c8 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -720,10 +720,14 @@ function onScroll() { } }); } - if (context.auto_load_more) { - const streamFooter = document.getElementById('stream-footer'); - if (streamFooter && box_to_follow.offsetHeight > 0 && + let streamFooter; + if (context.auto_load_more && (streamFooter = document.getElementById('stream-footer'))) { + if (box_to_follow.offsetHeight > 0 && box_to_follow.scrollTop + box_to_follow.offsetHeight + (window.innerHeight / 2) >= streamFooter.offsetTop) { + // Too close to the last pre-loaded article + load_more_posts(); + } else if (document.querySelectorAll('.flux.current ~ .flux').length <= 5) { + // Too few pre-loaded articles load_more_posts(); } } |
