There are likely various edge cases I've missed, and I am not too sure on performance compared to a purpose-built userscript, but these seem to work well enough for my use cases.
Throw these to My filters in uBO settings. May also work with AdGuard, but I can't support you there as I don't use it. Other ad blockers probably won't work, but then why are you using an ad blocker that isn't uBO anyway?
Remove the exclamation mark preceding the rules and adjust the placeholders accordingly. If you need multiple filters copy paste the appropriate lines.
You may need to replace the lemmy.*
part if your home instance is on a different (sub)domain. I'm not using .lemmy-site
and a global selector for performance reasons.
! Post filters use :has instead of :upward to take advantage of native CSS support on browsers that implement it.
! If :has is not implemented, uBO will emulate it via JS. :upward might be more efficient on those cases.
! Lemmy: Filter post by link domain
! lemmy.*##.post-listing:has(.fst-italic[href*="example.com"])
! Lemmy: Filter post by keyword in title
! lemmy.*##.post-listing:has(.post-title:has-text(/\bkeyword\b/i))
! Lemmy: Filter post by author instance
! lemmy.*##.post-listing:has(.person-listing[title$="@example.com"])
! Lemmy: Filter post by community instance
! lemmy.*##.post-listing:has(.community-link[title$="@example.com"])
! Lemmy: Filter post by instance (author or community)
! lemmy.*##.post-listing:has([title$="@example.com"]:is(.person-listing, .community-link))
! Lemmy: Filter post by community name (any remote instance)
! lemmy.*##.post-listing:has(.community-link[title^="!politics@"])
! Lemmy: Filter post by community name (home instance, though in this case you can just use lemmy's own blocking)
! lemmy.*##.post-listing:has(.community-link[title="!politics"])
! Lemmy: Filter comment by keyword
! lemmy.*##.md-div:has-text(/\bkeyword\b/i):upward(.comment)
! Lemmy: Filter comment by author instance
! lemmy.*##.person-listing[title$="@example.com"]:upward(.comment)
! Lemmy: Filter both by author instance
! lemmy.*##.person-listing[title$="@example.com"]:upward(:is(.post-listing, .comment))
Doesn't help. Everything from the meme/joke/fun communities you'd expect people to use to tune out The Horrors™ to discussion about the ActivityPub standards (what little exists that doesn't conflate it with Just Lemmy or Just Mastodon) devolve to US politics in like two comments. For me at least this entire section of fedi is a US politics-radioactive one I try spending as little time as possible (that includes posting non-politics!)
I find myself having significantly more fun on the microblogging side of the fedi, ruining jokes to ground in like 4 minutes with my oomfs and making followup meta jokes about how jokes only last 4 minutes. People actually use content warnings to hide away The Horrors™ when they want to talk about it, which means filters actually work. (Things like alt text for images also helps with word filters!)