diff options
| author | 2022-08-27 17:11:41 +0800 | |
|---|---|---|
| committer | 2022-08-27 11:11:41 +0200 | |
| commit | ef84343576f671163b11811f59294e72e1da2b36 (patch) | |
| tree | 71b19ffe80ccd3158f78eeeb2cbb64d2867ce907 /p/scripts | |
| parent | 03f5a42640928a11cbf5e7c63642c0e7eeca4706 (diff) | |
Fix #4231 (#4541)
Actually, there are two issues to be fixed:
1. Since `div.flux_content` has been changed to `article.flux_content`
in HTML, we should address that in JS too. Or, to take one step
further, select it using `.flux_content` directly.
2. For the article already at the first position, its `prev_article`
would select `#new-article` whose css attribute `display` is `none`
in most cases, which breaks the new position calculation.
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 1619993c4..ad3224507 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -435,7 +435,7 @@ function toggleContent(new_active, old_active, skipping) { let new_pos = new_active.offsetParent.offsetTop + new_active.offsetTop - nav_menu_height; - if (prev_article && new_active.offsetTop - prev_article.offsetTop <= 150) { + if (prev_article && prev_article.offsetParent && new_active.offsetTop - prev_article.offsetTop <= 150) { new_pos = prev_article.offsetParent.offsetTop + prev_article.offsetTop - nav_menu_height; if (relative_move) { new_pos -= box_to_move.offsetTop; @@ -1103,7 +1103,7 @@ function init_stream(stream) { if (ev.target.closest('.content, .item.website, .item.link, .dropdown')) { return true; } - if (!context.sides_close_article && ev.target.matches('div.flux_content')) { + if (!context.sides_close_article && ev.target.matches('.flux_content')) { // setting for not-closing after clicking outside article area return false; } |
