Hi,<p>I don't think HN has this capability so I was trying to craft something via ublock origin.<p>I added:<p>news.ycombinator.com##div:has(a[href*="user?id=example"])<p>however, that only hid the div where the user's name was shown, not the comment itself as that's in another subsequent div.
Is there an argument I can pass so that it will hide the next div as well?<p>Some context on why I'm trying to achieve this - there's a small subset of users that insert political comments in highly interesting threads and I'm trying to avoid politics as much as possible so I'd like to "ban" those users by automatically hiding everything they say. I know it's a sledgehammer approach but the vast majority of HN content is extremely interesting and I really enjoy being part of the community.<p>Thank you.
I use this in ViolentMonkey<p><pre><code> for (let idiot of ['alice','bob','carol','dick','eve']){
for ( let a of document.querySelectorAll('a[href="user?id=' + idiot + '"]') ){
let node = a.parentNode.parentNode.parentNode.parentNode
if (node.tagName !== 'TABLE') { node.style.display = 'none' }
}
}</code></pre>
I think you just have to select the right ancestor element.<p><pre><code> news.ycombinator.com##.athing:has(a[href="user?id=example"])
</code></pre>
seems to work.
You grow up and learn to accept that there are lots of unsavory things in this world. Part of being mature means facing difficult things instead of hiding them or running away from them