Skip to content

Loading…

No asterisk‬‏s (*) in filters on element properties? #334

Closed
Mikey1993 opened this Issue · 5 comments

2 participants

@Mikey1993

Given this annoying site (though pretty popular in Israel): http://forum.vgames.co.il/

which does anything it can to evade adblockers.
I was unsuccessful to block it's ads, maybe because of my poor filtering skills, or may it be the lack of implemintation on uBlock's side.

Steps:

1) Go to: http://forum.vgames.co.il/forumdisplay.php?f=494
2) Enter any thread, like: http://forum.vgames.co.il/showthread.php?t=1558906
3) Observe the ad in the middle of the page.
4) Try to block it with Element Picker - Success.
5) Enter another thread on the list, like: http://forum.vgames.co.il/showthread.php?t=1558891
6) Observe the same ad on the page.
7) Dig some more with the element picker in Chrome.
8) Get the fact that this site does anything to make your life harder to block ads - generated unique class names per thread, URL background of divs...
9) OK, I can block the net request of the background URL with the following rule reliably:
data.vgames.co.il/campaigns/*/coralworld/*.jpg,
but how can I block the div element itself?
10) Oh, it's generating a unique class name and unique background URL for each thread...
So I can probably block that reliably too!
11) Let's try... this:
##div[style="margin: 5px; background: url(http://data.vgames.co.il/campaigns/*/coralworld/*.jpg);"]
(Note the asterisk‬‏s)... well, this just doesn't work...
12) Maybe this?
##div[class="boX*"]
Nope...

So... does uBlock lack this kind of filter implementation (asterisk‬‏s in element properties), or I am doing something really silly and not realising it?

Thanks :)

@gorhill

Cosmetic filters have to be valid CSS selectors.

##div[style="margin: 5px; background: url(http://data.vgames.co.il/campaigns/*/coralworld/*.jpg);"]

Is a valid CSS selector but the browser interprets this literally. There is no CSS selectors which can do what you are trying to make it to do above.

This one though:

##div[class="boX*"]

Should be rewritten

##div[class*="boX"]

Meaning: a div with the substring boX somewhere in its class attribute.

@Mikey1993

Thanks, that worked flawlessly!

"...There is no CSS selectors which can do what you are trying to make it to do above."

So I will ask: Why?

@gorhill

It's a big question, which you may want to ask the W3C: http://www.w3.org/TR/css3-selectors/

@Mikey1993

Right...

Oh, and is it just me, or the rule:
##div[class^="boX"]
just adds a display: none !important to the element style properties?
It doesn't really removes the element from the page no matter if the Hide placeholders of blocked elements checkbox is checked.

This doesn't let me to remove the div entirely from the page.

Why so?

@gorhill

Cosmetic filters are just that, cosmetic. Whether it's removed or hidden the purpose of the filter is accomplished.

@gorhill gorhill closed this
@andre-hub andre-hub pushed a commit to andre-hub/uBlock that referenced this issue
@gorhill gorhill this addresses #334 19d34d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.