Whitelisting elements based on a specific attribute

Posting here is no longer possible, please use the forum of a filter list project, such as EasyList
Locked
kkmic
Posts: 11
Joined: Thu Jan 14, 2016 10:36 am

Whitelisting elements based on a specific attribute

Post by kkmic »

One of the filter subscriptions I use includes a rule like this:

Code: Select all

##[href*="/promo"]
I am building a small Firefox extension that uncloaks one specific type of shortlink, by replacing it's shortened href with the real href.

Some of these real links get hidden by that ABP rule.

I want a whitelisting rule that will prevent the uncloaked links from being hidden, WITHOUT "cancelling" the ##[href*="/promo"] blacklisting rule.

Meaning that a rule like this is NOT OK:

Code: Select all

 #@#[href*="/promo"]
I can add a custom attribute (I've added a "data" one) to the processed links, so that I can single them out with a ABP whitelisting rule.

Here is a test page: http://silviu.audiozone.ro/abp.html.

I need a rule that will prevent the #3 and #4 links from being hidden when the page loads (for #3) or when the link is changed (for #4).
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Whitelisting elements based on a specific attribute

Post by mapx »

You need a filter like this:

Code: Select all

##A[href*="/promo"]:not([data-mytype="myvalue"])
so, just ask zoso (romanian list maintainer) to modify that rule
kkmic
Posts: 11
Joined: Thu Jan 14, 2016 10:36 am

Re: Whitelisting elements based on a specific attribute

Post by kkmic »

There is no way to override a more generic blacklist rule with a more specific whitelist one?



Thing is that I cannot really ask the maintainer to include a rule like that because it will be fixed and public, meaning that people can simply add that attribute/value pair to their promotional links and keep them visible.

The plan was to have the extension generate a random data attribute and it's associated value when installed and then to ask the user to manually add a specific whitelisting rule to ABP (a rule would work only for that particular installation of the extension).


Is there no other way around this?

Is this the intended functionality, or should I file bug report? :D
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Whitelisting elements based on a specific attribute

Post by mapx »

well, ask the user to add
silviu.audiozone.ro#@#[href*="/promo"]
example.ro#@#[href*="/promo"]
kkmic
Posts: 11
Joined: Thu Jan 14, 2016 10:36 am

Re: Whitelisting elements based on a specific attribute

Post by kkmic »

It's too generic, it would invalidate the blacklisting rule everywhere.

I tried to use this whitelisting rule, but it does not work:

Code: Select all

#@#[href*="/promo"][data-mytype="myvalue"]
This one works though (but as I said, it is too genereic):

Code: Select all

#@#[href*="/promo"]
Why so? Again, is this the intended behaviour or it is a bug?

Maybe the "data" attribute it is not accepted by ABP? Should I try with a different attribute? I could add a custom class name...
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Whitelisting elements based on a specific attribute

Post by mapx »

silviu.audiozone.ro#@#[href*="/promo"]

is not generic

generic is only:
ro#@#[href*="/promo"]
kkmic
Posts: 11
Joined: Thu Jan 14, 2016 10:36 am

Re: Whitelisting elements based on a specific attribute

Post by kkmic »

kkmic wrote: I am building a small Firefox extension that uncloaks one specific type of shortlink, by replacing it's shortened href with the real href.
I thought that it goes without saying: the extension will run on various domains and will uncloak links pointing to various other domains, so that means that I need a whitelisting rule that is not bound to a domain/domains list or that will whitelist links pointing to a already known domain/domains list.

So basically, I don't know in advance on which domain a link will be processed or to which domain will it point to.
All that I know for sure is the custom attribute I am setting, so that's why the rule I'm looking for must be based on that, one way or another.

Considering the above, any other suggestions? :)
Locked