The best stuff out there is uBlock Origin. It supports so-called "cosmetic filtering" in addition to run-of-the-mill static rules. Be sure to install the latest development release for that, though - the filtering language is getting closer and closer to being Turing-complete with each build.
Procedural cosmetic filters can now be chained and recursive (something which was planned) . Examples:
Chained: example.com##.item:matches-css-after(position: fixed):has-text(Promoted)
Recursive: mobile.twitter.com##main [role="region"] > [role="grid"] > [role="rowgroup"] [role="row"]:if(div:last-of-type span:has-text(/^Promoted by/))
(actually a real use case).
There is no limit on the number of operators chained, or the number of recursion level, aside common sense. As a reminder, use procedural cosmetic filters only for when plain CSS selectors won't solve a case.
New procedural cosmetic filter operators:
:has-text(argument):
to filter elements according to whether they have a specific text string found in them. Use /.../
to match a literal regular expression instead of plain text.
:if()/:if-not(argument):
use to implement recursion, argument is itself a valid procedural cosmetic filter, but can also be a plain CSS selector.
Any of the operator which accept a text string value to match can also accept of literal regular expression value.
The :xpath()
operator can now accept a plain CSS selector as prefix (i.e. example.com##.item:xpath(...)
), just like all other operators. The XPath evaluation will use whatever element matches the CSS selector as the context node for the XPath
If you feel it's insufficient, you can install uMatrix from the same author.
Disclaimer: I have no relationship to Gorhill, I'm simply awed by the guy's selfless work.
https://github.com/gorhill/uBlock/releases