diff options
| author | 2017-09-30 08:25:07 +0200 | |
|---|---|---|
| committer | 2017-09-30 08:25:07 +0200 | |
| commit | ee834888cd96df12d14686f3e75c82053e188a64 (patch) | |
| tree | fb922a3b8054ea50a679adf3cc573accd045f7b3 | |
| parent | e53c10f975de9d35f476343287d720350bcbcbc0 (diff) | |
Remove limitation on toggleContent (#1647)
Before, articles were repositioned only when the new and the old article were different. When they were the same, it was just closed.
It was frustrating with long articles, especially during reading.
Now, when an article is collapsed, it is repositionned no matter the collapsing method.
This should fix #1177
| -rw-r--r-- | p/scripts/main.js | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index aa2f1d58b..278ecfee9 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -266,11 +266,9 @@ function toggleContent(new_active, old_active) { new_pos += old_scroll; } - if (old_active[0] !== new_active[0]) { - new_active.children(".flux_content").first().each(function () { - box_to_move.scrollTop(new_pos).scrollTop(); - }); - } + new_active.children(".flux_content").first().each(function () { + box_to_move.scrollTop(new_pos).scrollTop(); + }); } else { if (relative_move) { new_pos += old_scroll; @@ -386,13 +384,8 @@ function last_category() { } function collapse_entry() { - isCollapsed = !isCollapsed; - var flux_current = $(".flux.current"); - flux_current.toggleClass("active"); - if (isCollapsed && context.auto_mark_article) { - mark_read(flux_current, true); - } + toggleContent(flux_current, flux_current); } function user_filter(key) { |
