>>/10580/

Thanks! Great script!

I improved this a bit. Instead of polling every 5 seconds, it polls two seconds after the actual refresh request (4 assets, generally takes about 1 second to apply new messages).

Feel free to increase that timeout if you want, it works well for me, and saves a ton of useless loops when nothing could have possibly updated.

var nav = document.querySelector('nav')

var span1 = document.createElement('span')
span1.innerText = '[ postCount: ';

var postCount = document.createElement('span');
postCount.id = 'postCount';

postCount.innerText = Array.from(
document.querySelectorAll('div.innerPost')
).length;

var span2 = document.createElement('span')
span2.innerText = ']';

nav.appendChild(span1);
nav.appendChild(postCount);
nav.appendChild(span2);
var _x_refreshPosts = refreshPosts;
window.refreshPosts = function(x) { _x_refreshPosts(x); setTimeout(() => { postCount.innerText = Array.from(
document.querySelectorAll('div.innerPost')).length }, 2000);
}