>>17783572Enter this into javascript console:
const blockedPostIds = new Set();
function removeSagePosts() {
// First collect the IDs of every sage/supersage post.
document.querySelectorAll(
'a[href="mailto:sage"], a[href="mailto:supersage"]'
).forEach(a => {
const post = a.closest('div.post');
if (!post) {
return;
}
const match = post.id.match(/^reply_(\d+)$/);
if (match) {
blockedPostIds.add(match[1]);
}
// Remove adjacent <br> elements / whitespace.
let next = post.nextSibling;
while (
next &&
(
(next.nodeType === Node.TEXT_NODE && !next.textContent.trim()) ||
next.nodeName === 'BR'
)
) {
const remove = next;
next = next.nextSibling;
remove.remove();
}
post.remove();
});
// Remove mentions pointing to removed posts.
for (const id of blockedPostIds) {
document.querySelectorAll(
`a[href="#${id}"], a.mentioned-${id}`
).forEach(a => {
// Remove whitespace immediately following the mention as well.
const next = a.nextSibling;
if (
next &&
next.nodeType === Node.TEXT_NODE &&
/^\s+$/.test(next.textContent)
) {
next.remove();
}
a.remove();
});
}
}
removeSagePosts();
new MutationObserver(() => {
removeSagePosts();
}).observe(document.body, {
childList: true,
subtree: true
});