diff options
Diffstat (limited to 'p/scripts')
| -rw-r--r-- | p/scripts/main.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js index 2c0912a7e..fe5e81f6d 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -2009,7 +2009,7 @@ let load_more = false; let box_load_more = null; function remove_existing_posts() { - document.querySelectorAll('.flux, .day').forEach(function (div) { + document.querySelectorAll('.flux, .transition').forEach(function (div) { div.remove(); }); } @@ -2032,9 +2032,15 @@ function load_more_posts() { const html = this.response; const streamFooter = document.getElementById('stream-footer'); + const transitions = document.querySelectorAll('#stream > .transition'); + let lastTransition = transitions.length > 0 ? transitions[transitions.length - 1] : null; const streamAdopted = document.adoptNode(html.getElementById('stream')); - streamAdopted.querySelectorAll('.flux, .day').forEach(function (div) { + streamAdopted.querySelectorAll('.flux, .transition').forEach(function (div) { + if (lastTransition !== null && div.classList.contains('transition') && div.textContent === lastTransition.textContent) { + lastTransition = null; + return; // Skip duplicate transition + } box_load_more.insertBefore(div, streamFooter); }); @@ -2053,13 +2059,6 @@ function load_more_posts() { toggle_bigMarkAsRead_button(); } - document.querySelectorAll('[id^=day_]').forEach(function (div) { - const ids = document.querySelectorAll('[id="' + div.id + '"]'); - for (let i = ids.length - 1; i > 0; i--) { // Keep only the first - ids[i].remove(); - } - }); - init_load_more(box_load_more); const div_load_more = document.getElementById('load_more'); |
