aboutsummaryrefslogtreecommitdiff
path: root/p/scripts/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'p/scripts/main.js')
-rw-r--r--p/scripts/main.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/p/scripts/main.js b/p/scripts/main.js
index a1cf5d8ae..1dce5f9fc 100644
--- a/p/scripts/main.js
+++ b/p/scripts/main.js
@@ -1857,6 +1857,12 @@ let url_load_more = '';
let load_more = false;
let box_load_more = null;
+function remove_existing_posts() {
+ document.querySelectorAll('.flux, .day').forEach(function (div) {
+ div.remove();
+ });
+}
+
function load_more_posts() {
if (load_more || !url_load_more || !box_load_more) {
return;
@@ -1868,6 +1874,11 @@ function load_more_posts() {
req.open('GET', url_load_more, true);
req.responseType = 'document';
req.onload = function (e) {
+ if (context.sort === 'rand') {
+ document.scrollingElement.scrollTop = 0;
+ remove_existing_posts();
+ }
+
const html = this.response;
const streamFooter = document.getElementById('stream-footer');