News for hackers. Stuff that matters.
Re:uBlock 1.48.0 Adds Readiness Status, Code Viewer, and Oth... by mtlmtlmtlmtl on Tuesday March 21, 2023 @04:45PM (#35252262)
I would totally use that add-on if you were interested in maintaining it as a publically available add-on.

Does it just strip out the <a> tag?

Re:uBlock 1.48.0 Adds Readiness Status, Code Viewer, and Oth... by kgwxd on Tuesday March 21, 2023 @05:41PM (#35252990)
It is in the official extension repository [1]. I had to put it there because of how difficult/impossible it is to run a local extensions. But it's definitely not designed for general use. I'll be glad to guide you if the tiny amount of help I've included isn't enough.

The source [2] is available too.

The actual idea of the extension is "Style stuff using regular expressions". So you specify a regex; what to search, attributes and/or text (text can cause a lot of undesired results so I don't use it much); and css styles to add to the elements containing matches. I only really use it to apply visibility: hidden to any element with an attribute matching one big regex that's basically just a bunch of domains regex |'d together. The example in the options UI is what I'm still using years later, I've just added more domains.

I originally started with just taking out tags but that idea was quickly shot down. Lots of links aren't <a> tags. Sometimes the domain being linked to is buried in some JS in a onX event attribute, or some data-* attr that the UI framework uses and a bunch of other oddities. So the code searches all attrs. It's not super efficient but I've never noticed it causing a slow down.

Another problem is, often, the original request doesn't even contain the links, they're loaded after. So it uses a MutationObserver and looks at the new elements for matches.

[1] https://addons.mozilla.org/en-US/firefox/addon/ssure/

[2] https://github.com/7w0/ssure/blob/master/content/content.js