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))
    • kopper [they/them]@lemmy.blahaj.zoneOP
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Joking aside, you could always temporarily change the filter to block another instance, see if it worked, and change it back. uBO’s element picker (right click > block element) will highlight which elements a filter will block, so you can copy the filter there (without the preceding lemmy.* part) and experiment in real time.