diff --git a/js/auto-reload.js b/js/auto-reload.js index 3e291f01..bdeb06db 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -231,8 +231,37 @@ $(document).ready(function(){ url: document.location, success: function(data) { var loaded_posts = 0; // the number of new posts loaded in this update + var removed_posts = 0; + var data_replies = $(data).find('div.post.reply'); + var data_ids = new Set (data_replies.map ((k, e) => e.id)); + var islast50page = /[+]50[.]html/.test (document.location.href); + var removed_class = 'auto-reload-removed'; + var removal_scan = 'div.post.reply:not(.post-hover):not(.' + removed_class + ')'; + + if (islast50page) { + var have_present = false; + // mark posts only after the first post present in data + // earlier ones are assumed to have slid out + $(removal_scan).each ((k, e) => { + if (!data_ids.has (e.id)) { + if (have_present) { + $(e).addClass (removed_class); + removed_posts++; + } + } else { + have_present = true; + } + }); + } else { + $(removal_scan).each ((k, e) => { + if (!data_ids.has (e.id)) { + $(e).addClass (removed_class); + removed_posts++; + } + }); + } - $(data).find('div.post.reply').each(function() { + data_replies.each(function() { var id = $(this).attr('id'); // check that this post doesn't already exist diff --git a/stylesheets/style.css b/stylesheets/style.css index 1803bb9a..c59e5687 100644 --- a/stylesheets/style.css +++ b/stylesheets/style.css @@ -501,6 +501,10 @@ div.post div.body { white-space: pre-wrap; } +div.post.reply.auto-reload-removed { + border: 3px dashed; +} + div.post.reply { background: #D6DAF0; margin: 0.2em 4px;