pull down to refresh
Ohh, nice fix! Also nice edit within the 10-minute timer, haha
Mhh, node.style = "visibility: hidden" leaves empty space behind.
But node.style = "display: none" should work! The node is still there for React without taking up any space in the DOM.
With node.style = "display: none", you can also keep running it after the slightly faster DOMContentLoaded event and don't need requestAnimationFrame. The load event will also wait until images are loaded.
Thank you!!
You probably told it to run after hydration, and that’s what it did, haha
But when we don’t remove the node, we don’t interfere with hydration, so we don’t need to run it after hydration.
Edit: But sounded like it was still broken after the first prompt, so you prompted it again, and that contained the actual, inspiring fix via CSS haha
Fixes courtesy of:
runAfterHydration: GPT, Claude, Gemini and GLM (all said the same, lol)node.style = "visibility: hidden"instead ofnode.remove(): Opti, because the removal gave me errors on comment.window.addEventListener('load', () => { function runAfterHydration(callback) { requestAnimationFrame(() => { requestAnimationFrame(callback); }); } runAfterHydration(() => { function removeCollapsedComments() { document .querySelectorAll('div[class*="comment_collapsed"]') .forEach(node => { if (node.textContent.startsWith("reply from someone you muted")) { node.style = "visibility: hidden"; } }); } removeCollapsedComments(); const observer = new MutationObserver(removeCollapsedComments); observer.observe(document.body, { childList: true, subtree: true }); }); });