I have an element that looks like this on the page:
<a data-mytype="myvalue" href="http://example.com/promo/page">...</a>
This element gets hidden by the following ABP rule (present in one of the filter subscriptions I use):
##[href*="/promo"]
How do I write a whitelisting rule that will exclude that element from being hidden by Adblock Plus based on a specific attribute/value pair - like the data-mytype="myvalue"
one?
I have checked the Writing Adblock Plus filters and Adblock Plus filters explained pages, but I have not figured out how to (successfully) write a filter based on the specified attribute.
Both pages mention that standard CSS selectors should work, however this does not seem to work:
@@a[data-mytype="myvalue"]
I have also tried the following:
#@#[href*="/promo"][data-mytype="myvalue"]
What am I missing?
Note: I do not want a rule that will just cancel out the ##[href*="/promo"]
, I am looking for a rule that will whitelist elements only based on a specific attribute/value pair.
Edit (2016-03-17): Clarified my question a little bit.
You first disable the existing rule:
#@#[href*="/promo"]
Note that the selector has to be identical, otherwise element hiding exceptions won't apply. Then you can add your own rule, one that will consider the data-mytype
attribute:
##[href*="/promo"]:not([data-mytype="myvalue"])
The combination of these two rules should have the effect you want. For reference: :not() CSS pseudo-class