uBlock-LLC / uBlock

uBlock: a fast, lightweight, and lean blocker for Chrome, Firefox, and Safari.
https://ublock.org/
GNU General Public License v3.0
8.18k stars 437 forks source link

Support `* * * [action]` for dynamic filtering #682

Closed gorhill closed 9 years ago

gorhill commented 9 years ago

https://twitter.com/comex/status/562800585473544195:

* * * allow
* youtube.com * noop

The fix is very trivial, though I didn't go through thoroughly to see all the consequences, if any. But it worked as intended. Interesting use case, I didn't think about this being useful.

One could as well use:

* * * block

To block everywhere by default, which may also be sought after by many advanced users, as default-deny is a common mode for those using RequestPolicy and such.

gorhill commented 9 years ago

Just for the record, the fix is different than what I suggested in my twitter answer: I had forgotten to take into account precedence logic. Still trivial though.

mcdado commented 9 years ago

Thanks, I will experiment it!

gorhill commented 9 years ago

For Crowdin translators:

a

all means any type of resources from anywhere.

gorhill commented 9 years ago

@mcdado Just in case it's not clear how to achieve "blacklist mode", these are the steps:

c

Nothing will be blocked, static filtering is completely bypassed: "green" means "allow unconditionally".

To "blacklist" a site:

This will cause the current site to become subjected to static filtering (EasyList, EasyPrivacy etc, i.e. whatever filter lists is in effect).

a

Dynamic filtering disengaged for current site: "gray" means disengage dynamic filtering, but apply static filtering.

In the screenshots above, 3rd-party frames are blocked to remind this is a good habit in general, and to illustrate that narrower dynamic rules prevails over more generic ones.

gorhill commented 9 years ago

Similarly as above, to use uBlock's dynamic filtering in default-deny mode, it's just a matter of globally blocking the all cell, then to noop specific cells as needed (typically local cells).

Reminder: noop disengage dynamic filtering but keep static filtering engaged.

mcdado commented 9 years ago

So, if I were to manually edit the "My rules" list, it would look something like this right?

* * * allow
* * 3p-frame block
facebook.com * * noop
speedtest.net * * noop
spotify.com * * noop
youtube.com * * noop

Right now I cannot test it because I didn't figure out how (or whether it is possible) to compile the development version, so I have to wait for 0.8.7.0. As the reporter on Twitter says, it still blocks all sites.

gorhill commented 9 years ago

Ok, I will create a bleeding edge "use-at-your-own-risk" dev version.

gorhill commented 9 years ago

Here: https://github.com/gorhill/uBlock/releases

gorhill commented 9 years ago

Also, be aware of issue #689.

mcdado commented 9 years ago

What I meant is that the guy on twitter that you linked to at the top of this issue said the same thing: as of 0.8.6, that type of configuration blocks all sites.

mcdado commented 9 years ago

I just tested it like so:

* * * allow
* * 3p-frame block
* youtube.com * noop
gazzetta.it * * noop
youtube.com * * noop

Ads are blocked on the specified sites (gazzetta.it and youtube.com) while are not blocked on a site such as smashingmagazine.com This very unscientific test shows that it works as expected, embed youtube videos work thanks to * youtube.com * noop

gorhill commented 9 years ago

I removed the all row in c9ef3068dfa9f63a25461416cbdeec7c9812b7b5.

It's just the UI counterpart I removed, * * * [allow|block|noop] is still supported.

The thinking is that the all row is very unlikely to be used by anyone: it makes little sense to block all, and for the blacklist mode, the rule * * * allow can be added manually, and once this is done, clicking the local setting of the 3rd-party row and the current site row will effectively engage static filtering for the current site.

The vertical space is precious and limited, so I decided to remove the all row given that it's very unlikely anyone will use it.

Mikey1993 commented 9 years ago

@gorhill can we then get back the domains connected count back? :)

chrisaljoudi commented 9 years ago

@Mikey1993 it is back.

Domain count

gorhill commented 9 years ago

@Mikey1993 https://github.com/gorhill/uBlock/wiki/Quick-guide:-popup-user-interface#the-number-of-domains-connected

Mikey1993 commented 9 years ago

@chrisaljoudi Oh, this is per page, not global stats? Sorry, I was a bit lazy downloading the dev version.