I don't think it is possible currently, but is it possible to have conditions? As an example use, say you want to only show ads on YouTube channels you are subscribed to. This could be easily accomplished by checking if the document contains "data-is-subscribed="true"". If it doesn't, remove ads.
I'm not really familiar with the Adblock rule syntax, but I'm thinking this could be added right in the filter rule. In addition to doing the kind of "regex" pattern thing for the domain, conditions could be added as well. The usual ||, &&, and ! could be used. Something such as "youtube.com && $document.contains(data-is-subscribed="true")" would be sufficient to define an exception rule. Of course the syntax would have to be adjusted for backwards compatibility and stuff.
[Suggestion] Conditionals
Re: [Suggestion] Conditionals
I'm tempted to link yet again to the old thread about the HTML filtering suggestion, which was rejected for performance reasons, but instead I should say that it's difficult to figure out how to implement this in a way that isn't ad-hoc (for example, not relying on implicit assumptions about the particular setup of particular websites at a particular time) and is secure (something like $condition=(<boolean-coercible JS expression>) could be a nasty vector for code injection, but maybe that could be mitigated by only supporting it in custom filters).
Reading the cookies or localStorage set by a website might work, and I could imagine a restricted key-value syntax working for that, likeetc., and I see that the Chrome extension, at least, has the necessary permissions to read cookies and localStorage.
Reading the cookies or localStorage set by a website might work, and I could imagine a restricted key-value syntax working for that, like
Code: Select all
$condition(<key>=<value)
$condition(<key>!=<value>)
$condition(<key>$=<partialValue>&&<key>^=<partialValue2>||<key2>*=<partialValue3>)
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
Re: [Suggestion] Conditionals
I've thought the same thing and looked into the source to try and implement a youtube subscription conditional.
An acceptable set-up for this would be chained filters.
Currently the following works (hides the subscription button if you have subscribed):
Now, If you define a new type of filter regex that implements chaining (for example's sake, let's set the chaining separator to , meaning the last matcher will be used and applied, we could do something like:
.
If someone from the devs could give me pointers on how to approach chainability (I should create a new Regexp type, along with implementing it in filterNotifier if I've understood things correctly), I think we could figure out a solution that isn't horribly ugly and helps people help content creators (I'm not a content creator myself, but I'd love to have this as a possibility).
Things to consider:
Should the second matcher have domain options? I think maybe not, mainly because of weird override scenarios and legiibilty, so you'd define the domain before the first selector:
However, all of the filter creation isn't well documented so I might be misinterpreting some of your syntax.
I'd love to get feedback and input from devs on this.
An acceptable set-up for this would be chained filters.
Currently the following works (hides the subscription button if you have subscribed):
Code: Select all
##.yt-uix-subscription-button[data-is-subscribed="True"]
Code: Select all
;
Code: Select all
##.yt-uix-subscription-button[data-is-subscribed="True"];@@||youtube.com^$document
If someone from the devs could give me pointers on how to approach chainability (I should create a new Regexp type, along with implementing it in filterNotifier if I've understood things correctly), I think we could figure out a solution that isn't horribly ugly and helps people help content creators (I'm not a content creator myself, but I'd love to have this as a possibility).
Things to consider:
Should the second matcher have domain options? I think maybe not, mainly because of weird override scenarios and legiibilty, so you'd define the domain before the first selector:
Code: Select all
||youtube.com##.yt-uix-subscription-button[data-is-subscribed="True"];@@^$document
I'd love to get feedback and input from devs on this.
Re: [Suggestion] Conditionals
The devs can be contacted on their irc channel
blog/adblock-plus-development-irc-channel-is-now-open
You can file an issue ("change" type) on the bug tracker
https://issues.adblockplus.org
adblock plus on github ==> https://github.com/adblockplus/
blog/adblock-plus-development-irc-channel-is-now-open
You can file an issue ("change" type) on the bug tracker
https://issues.adblockplus.org
adblock plus on github ==> https://github.com/adblockplus/