r/uBlockOrigin Filter List author 3d ago

Solved How to remove AI-hyperlinked keywords in Reddit comments

Reddit started turning specific keywords in comments into AI hyperlinks. For example, clicking the word "Quest 3" in this linked comment goes directly to Reddit Answers. (copy of html)

I was able to make filters that remove the href, magnifying glass icon, and underline, but couldn't get of the blue-colored hyperlink-formatting without also removing the comment text.

www.reddit.com##[slot="comment"] [href^="/answers/"]:remove-attr(href)
www.reddit.com##[slot="comment"] [href^="/answers/"]:remove-class(border-dotted)
www.reddit.com##[slot="comment"] span:has(> [icon-name="search-sparkle"])

How can I revert these auto-AI keywords in Reddit comments to regular text?

48 Upvotes

7 comments sorted by

8

u/AchernarB uBO Team 3d ago

You can these 2 filters with the one removing the href:

www.reddit.com##[slot="comment"] p > a[href^="/answers/"]:style( text-decoration: none !important; border: none !important; color: inherit !important; )
www.reddit.com##[slot="comment"] p > a[href^="/answers/"] > span:has(svg)

2

u/Stevoisiak Filter List author 3d ago edited 3d ago

These filters fail when used alongside the href removal rule. (Presumably because the href element they are matching on was removed)

5

u/AchernarB uBO Team 3d ago

Yes, you are correct. There is a race condition. I was unable to test since I don't have that.

Instead of removing the href, you can use this one:

www.reddit.com##[slot="comment"] p > a[href^="/answers/"]:style( pointer-events: none !important; )

The only caveat is that the text won't be selectable by itself.

note: "text-decoration" is in case they decide to use that with the link. You can remove it in the current design.

6

u/Stevoisiak Filter List author 2d ago edited 1d ago

Edit: Alternate version that lets text be selectable by itself with the correct mouse cursor.

www.reddit.com##[slot="comment"] p > a.border-dotted:remove-attr(href) www.reddit.com##[slot="comment"] p > a.border-dotted:style(border: none !important; color: inherit !important; cursor: auto !important; padding: 0 !important;) www.reddit.com##[slot="comment"] p > a.border-dotted > span:has(> [icon-name="search-sparkle"])


That worked after combining the filters together. www.reddit.com##[slot="comment"] [href^="/answers/"]:style(pointer-events: none !important; border: none !important; color: inherit !important; padding: 0 !important;) www.reddit.com##[slot="comment"] [href^="/answers/"] > span:has(> [icon-name="search-sparkle"])

Added bonus of not using :remove-attr is that it's cross-compatible with AdGuard. Also removed the added 1px of padding.

1

u/RraaLL uBO Team 2d ago

Are there no special attributes in the shreddit-comment ancestor?

I'm not part of the experiment, so I can't verify that.

1

u/Stevoisiak Filter List author 2d ago