TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How do I hide a user's comments?

2 pointsby ogeiczvmalmost 3 years ago
Hi,<p>I don&#x27;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*=&quot;user?id=example&quot;])<p>however, that only hid the div where the user&#x27;s name was shown, not the comment itself as that&#x27;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&#x27;m trying to achieve this - there&#x27;s a small subset of users that insert political comments in highly interesting threads and I&#x27;m trying to avoid politics as much as possible so I&#x27;d like to &quot;ban&quot; those users by automatically hiding everything they say. I know it&#x27;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.

4 comments

thomassmith65almost 3 years ago
I use this in ViolentMonkey<p><pre><code> for (let idiot of [&#x27;alice&#x27;,&#x27;bob&#x27;,&#x27;carol&#x27;,&#x27;dick&#x27;,&#x27;eve&#x27;]){ for ( let a of document.querySelectorAll(&#x27;a[href=&quot;user?id=&#x27; + idiot + &#x27;&quot;]&#x27;) ){ let node = a.parentNode.parentNode.parentNode.parentNode if (node.tagName !== &#x27;TABLE&#x27;) { node.style.display = &#x27;none&#x27; } } }</code></pre>
评论 #31967423 未加载
lovelearningalmost 3 years ago
I think you just have to select the right ancestor element.<p><pre><code> news.ycombinator.com##.athing:has(a[href=&quot;user?id=example&quot;]) </code></pre> seems to work.
评论 #31967417 未加载
water8almost 3 years ago
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
评论 #31971741 未加载
评论 #31970543 未加载
krappalmost 3 years ago
Install a browser plugin or userscript with that capability.