Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add $url modifier #1551

Closed
slavaleleka opened this issue Nov 12, 2021 · 6 comments
Closed

Add $url modifier #1551

slavaleleka opened this issue Nov 12, 2021 · 6 comments

Comments

@slavaleleka
Copy link

it should be a modifier for matching page url, something like combined $domain and $path

@sxgunchenko
Copy link

sxgunchenko commented Sep 8, 2022

Here's the proposed spec:

url

$url modifier limits the rule application area to URLs matching the specified mask.

Syntax

url = pattern

where pattern is pretty much the same as pattern of the basic rules assuming that some characters must be escaped.
The special characters and regular expressions are supported as well.

Examples

  • [$url=||example.com/ads/*]##.textad — hides a div with a class textad at addresses like http://example.com/ads/banner.jpg and even http://subdomain.example.com/ads/otherbanner.jpg.
  • [$url=||example.org^]###adblock — hides an element with attribute id equals adblock at example.org and its subdomains.
  • [$url=/\[a-z\]+\\.example\\.com\\//]##.textad — this rule hides div elements of the class textad for all addresses matching the regular expression [a-z]+\.example\.com\/.

@ameshkov
Copy link
Member

ameshkov commented Sep 9, 2022

@AdguardTeam/filters-maintainers what do you think?

@zloyden
Copy link

zloyden commented Sep 9, 2022

It would be nice to use it.
I had also asked the same about blocking request rules, but as far as I've been explained, it can't be done.


[$url=||example.com/ads/*]##.textad

Can it be like this?

[$url=||example.*/ads/*]##.textad

[$url=||example.org^]###adblock

So, if I don't want to use the rule on subdomains, how to rewrite this? Something like that?

[$url=www.example.org^]###adblock

@sxgunchenko
Copy link

Can it be like this? [$url=||example.*/ads/*]##.textad

Yep

So, if I don't want to use the rule on subdomains, how to rewrite this?

May be something like this

[$url=*://example.org^]...

@zloyden
Copy link

zloyden commented Sep 9, 2022

May be something like this

[$url=*://example.org^]...

If there are no other options, then fine, but I'd rather use the same syntax as in the cosmetic rules.

www.example.org##body

@sxgunchenko
Copy link

You could use $domain + $path in that case

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

No branches or pull requests

5 participants