Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Expand extended syntax [Important] #1395

Closed
davidhedlund opened this issue May 19, 2015 · 36 comments
Closed

Expand extended syntax [Important] #1395

davidhedlund opened this issue May 19, 2015 · 36 comments

Comments

@davidhedlund
Copy link

List of Local uBlock dynamic filtering

  • all: github.com * * block
  • images: github.com * image block
  • 3rd-party: github.com * 3p block
  • inline scripts: github.com * inline-script block
  • 1st-party scripts: github.com * 1p-script block
  • 3rd-party scripts: github.com * 3p-script block
  • 3rd-party frames: github.com * 3p-frame block

List of Global uBlock dynamic filtering

  • all: * * * block
  • images: * * image block
  • 3rd-party: * * 3p block
  • inline scripts: * * inline-script block
  • 1st-party scripts: * * 1p-script block
  • 3rd-party scripts: * * 3p-script block
  • 3rd-party frames: * * 3p-frame block

List of Local uBlock dynamic filtering translated to static filters

  • all: *$domain=github.com
  • images: ||github.com^$image
  • 3rd-party: ||github.com^$third-party
  • inline scripts: ||github.com^$inline-script
  • 1st-party scripts: ||github.com^$script
  • 3rd-party scripts: ||github.com^$third-party,script
  • 3rd-party frames: ||github.com^$subdocument

List of Global uBlock dynamic filtering translated to static filters

  • all: $domain=*
  • images: $domain=*^$image
  • 3rd-party: $domain=*^$third-party
  • inline scripts: $domain=*^$inline-script
  • 1st-party scripts: $domain=*^$script
  • 3rd-party scripts: $domain=*^$third-party,script
  • 3rd-party frames: $domain=*^$subdocument

Missing:

  • noop

Further reading

@davidhedlund davidhedlund changed the title What is the equivalent filter for blocking all local What is the equivalent filter for blocking all local? May 19, 2015
@davidhedlund davidhedlund changed the title What is the equivalent filter for blocking all local? Help with rule-like filter May 19, 2015
@davidhedlund davidhedlund changed the title Help with rule-like filter Important: Add noop to extended syntax May 19, 2015
@davidhedlund davidhedlund changed the title Important: Add noop to extended syntax Important: Add "noop" and "all" to extended syntax May 19, 2015
@davidhedlund davidhedlund changed the title Important: Add "noop" and "all" to extended syntax Important: Expand extended syntax May 19, 2015
@Snapy
Copy link

Snapy commented May 19, 2015

Try this ABP page for filter syntax.

@chrisaljoudi
Copy link
Contributor

@davidhedlund The dynamic filtering rules are handled differently from the "static net filtering" (which is what the ABP filter syntax specifies).

Check out the "My Rules" tab in uBlock's preferences to see the textual representation of the dynamic filtering rules.

@davidhedlund
Copy link
Author

@chrisaljoudi It is possible to write

||google-analytics.com^$important,third-party
but not
||google-analytics.com^$important,third-party
--gstatic.com^$important,third-party

gstatic might be a third-party of google-analytics.com. say that "--" above means "noop" which in that example will let gstatic.com to use static net filtering instead of being blocked.

@davidhedlund
Copy link
Author

@chrisaljoudi The reason why I want to write rule-like filters is because I want people to have the possibility to subscribe to them. That's not possible with rules, right?

@chrisaljoudi
Copy link
Contributor

@davidhedlund right, it's currently not possible to import/subscribe to external dynamic filtering rules.

In your example, though, I'm a bit confused.

This filter:

||google-analytics.com^$important,third-party

does not affect gstatic.com. Why would you need to "noop" gstatic.com then?

@davidhedlund
Copy link
Author

@chrisaljoudi That was just a (bad) example. Please refer to the screenshot in the top of this post. Would it hurt to add "noop" to the extended syntax?

As I see it everything should be in "My filters" (static and dynamic filters). Its simpler that way and there's not really any reason to keep My Rules if you add the requested syntax above.

@chrisaljoudi
Copy link
Contributor

@davidhedlund It's not that it would hurt, I just don't understand what it means.

Let's say we have the following (I used the -- syntax you used as an example):

||google.com^$script
--googleAnalyticsScript.js$script
*AnalyticsScript.js$script

Would google.com/googleAnalyticsScript.js be blocked or not (in the final result)?

@chrisaljoudi
Copy link
Contributor

@davidhedlund Let me see if I can communicate this better:

noop makes sense in dynamic filtering because dynamic filtering occurs as a step before static net filtering. So it just means: "okay, let it through to the second step [which is static net filtering]".

noop doesn't make sense in the context of static net filtering because there are no steps after that.

In other words, by the end of the static net filtering step, one must have either an allow or a block, not a noop.

@davidhedlund
Copy link
Author

@chrisaljoudi I suggest that you add noop syntax that can be used to write filter. Just make uBlock to start by only execute dynamic filters (like noop) and then start over again to only execute static filters.

I hope I'm clear enough even if my native language is Swedish. Do you understand me?

@chrisaljoudi
Copy link
Contributor

@davidhedlund I'm sorry, I'm afraid I don't.

How does a noop filter in static net filtering (as I understand it from your description) differ from an exception filter?

@davidhedlund
Copy link
Author

@chrisaljoudi I suggested that noop (!! might be better as Adblock Plus will read ! as comment), global, and all, can be added to My filters. The title for filters is My filters not My static filters, so there is room to expand that section to use dynamic filters too.

1: I suggest that you change the My rules syntax to filter-based syntax, example: Changing www.domain.tld * noop to !!domain.tld. It's a win-win even if you decide to stay here and not want to proceed with the next step.
2: Merge My rules to My filters and remove My rules. Then make sure that uBlock uses My filters by executing dynamic filters before static filters.

@davidhedlund
Copy link
Author

List of uBlock dynamic filtering translated to static filters

  • all: ||domain.tld^ <--------------------------------- Correct?
  • images: ||domain.tld^$image
  • 3rd-party: ||domain.tld^$third-party
  • inline scripts: ||domain.tld^$inline-script
  • 1st-party scripts: ||domain.tld^$script
  • 3rd-party scripts: ||domain.tld^$third-party,script
  • 3rd-party frames: ||domain.tld^$subdocument

@chrisaljoudi
Copy link
Contributor

@davidhedlund I get what you're saying now.

I'll have to give this some thought, because it breaks default-deny in some ways.

@davidhedlund
Copy link
Author

@chrisaljoudi Is all: ||domain.tld^ <--------------------------------- Correct?

@chrisaljoudi
Copy link
Contributor

@davidhedlund nope. More like:

*$domain=domain.tld

@davidhedlund
Copy link
Author

@chrisaljoudi Thank you! I added that to the top of the post as reference.

@chrisaljoudi
Copy link
Contributor

@davidhedlund I believe so; that would block all requests when on a page from the domain fsf.org.

@davidhedlund
Copy link
Author

@chrisaljoudi This is good. I removed the "all" problem from this post.

@davidhedlund
Copy link
Author

@chrisaljoudi What about global?

@chrisaljoudi
Copy link
Contributor

@davidhedlund what about "global"? What's an example?

@davidhedlund
Copy link
Author

@chrisaljoudi *$domain=github.com is for "all local", how would that be written for "all global"?

@chrisaljoudi
Copy link
Contributor

@davidhedlund if you mean matching every request globally:

*

@davidhedlund
Copy link
Author

@chrisaljoudi so ||* blocks everything?

@chrisaljoudi
Copy link
Contributor

@davidhedlund * matches everything, yes.

@davidhedlund
Copy link
Author

@chrisaljoudi To take a better example:

Local: ||github.com^$third-party,script
Global: ||*^$third-party,script

Is Global written correct?

@chrisaljoudi
Copy link
Contributor

@davidhedlund it would be:

*$third-party,script

@davidhedlund
Copy link
Author

@chrisaljoudi Perhaps we want to replace ||twitter.com^$important,third-party with *$important,third-party and explain that it is equivalent to global block of 3rd-party scripts in https://github.com/chrisaljoudi/uBlock/wiki/Filter-syntax-extensions#extended-syntax

What do you think about it?

@davidhedlund
Copy link
Author

@chrisaljoudi all local for github.com is *$domain=github.com. Is all global equivalent to $domain=*?

@chrisaljoudi
Copy link
Contributor

@davidhedlund yes, but $domain=* is just like not having it at all.

@davidhedlund
Copy link
Author

@chrisaljoudi when I add $domain=* (or *$domain=*) I can see everything in fsf.org but when I select all global less content of the page is showed to me. This means that the static filters $domain=* or *$domain=* is not equivalent to the dynamic filter * * * block (all global).

@davidhedlund
Copy link
Author

@chrisaljoudi Please help me proof-read these lists:

List of Local uBlock dynamic filtering

  • all: github.com * * block
  • images: github.com * image block
  • 3rd-party: github.com * 3p block
  • inline scripts: github.com * inline-script block
  • 1st-party scripts: github.com * 1p-script block
  • 3rd-party scripts: github.com * 3p-script block
  • 3rd-party frames: github.com * 3p-frame block

List of Global uBlock dynamic filtering

  • all: * * * block
  • images: * * image block
  • 3rd-party: * * 3p block
  • inline scripts: * * inline-script block
  • 1st-party scripts: * * 1p-script block
  • 3rd-party scripts: * * 3p-script block
  • 3rd-party frames: * * 3p-frame block

List of Local uBlock dynamic filtering translated to static filters

  • all: *$domain=github.com
  • images: *$domain=github.com,image
  • 3rd-party: *$domain=github.com,third-party
  • inline scripts: *$domain=github.com,inline-script
  • 1st-party scripts: *$domain=github.com,script
  • 3rd-party scripts: *$domain=github.com,third-party,script
  • 3rd-party frames: *$domain=github.com,subdocument

List of Global uBlock dynamic filtering translated to static filters

  • all: $domain=*
  • images: *$image
  • 3rd-party: *$third-party
  • inline scripts: *$inline-script
  • 1st-party scripts: *$script
  • 3rd-party scripts: *$third-party,script
  • 3rd-party frames: *$subdocument

@gwarser
Copy link

gwarser commented May 20, 2015

I think these should be rewritten:

images: ||github.com^$image
3rd-party: ||github.com^$third-party
3rd-party scripts: ||github.com^$third-party,script
3rd-party frames: ||github.com^$subdocument

in this format:

*$domain=github.com,image
...

because you don't want to block github.com/images.jpg but all images when browsing github.com

not sure about this:

inline scripts: ||github.com^$inline-script

and this:

1st-party scripts: ||github.com^$script

but might be

||github.com^$domain=github.com,script
or
||github.com^$~third-party,script

because you want to block scripts from github when you are on github

@seanrand
Copy link

Sorry, I don't understand the point of this exercise. Why are you trying to rewrite dynamic filtering rules as static filtering rules in the first place?

If

because I want people to have the possibility to subscribe to them

is the only reason, wouldn't it make more sense to define a format for sharing dynamic filter lists and adding a way to subscribe to them similar to the static 3rd party filters?

[uBlock xx]
! Title: Example of a uBlock dynamic filter subscription file
! Last modified: 19 May 2015 19:11 UTC
! Expires: 4 days (update frequency)
* * 3p-frame block
* * 3p-script block
wikipedia.org wikimedia.org * noop
www.dropbox.com dropboxstatic.com * noop
www.facebook.com akamaihd.net * noop
! etc etc etc

And if that's the only reason, I doubt that being able to subscribe to dynamic filtering rules would be very useful anyway.

For people who use default-deny, the dynamic filters are mostly a very short, personal selection of frequently visited sites. You'd have a lot of maintenance overhead to provide people with a dynamic filtering list to subscribe to that includes all their favourite websites in order to be of any use to them.

@davidhedlund davidhedlund changed the title Important: Expand extended syntax Expand extended syntax [Important] May 20, 2015
@davidhedlund
Copy link
Author

@chrisaljoudi Can you please validate the current list #1395 (comment)?

@ghost
Copy link

ghost commented Jun 10, 2015

It's worth noting that you can create static filters from the logger in uBlock Origin now.
https://github.com/gorhill/uBlock/releases - See 0.9.8.7
gorhill/uBlock@48f47a6
gorhill/uBlock@91cb61c
gorhill/uBlock@056a760

@davidhedlund
Copy link
Author

@hotdogman Thx.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants