Cannot block elements using a class starting with underscore

Everything about using Adblock Plus on Google Chrome

Cannot block elements using a class starting with underscore

Postby seanb » Wed May 25, 2016 2:31 am

Hello,

I am trying to add a filter for blocking an element starting with underscore, but I can't get it to work. I've tried escaping the character and using the attribute selector, but this isn't working either.
The element only shows up when adblock plus is already enabled since the site replaces the blocked ads with the element I am trying to block.

The specific page is
Code: Select all
http://myanimelist.net/anime/813/Dragon_Ball_Z
and the class is '_unit'.

I've tried the following:
myanimelist.net##div._unit
myanimelist.net##div[class~="_unit"]
myanimelist.net##div.\_unit
myanimelist.net##div.\\_unit
myanimelist.net##div.__unit

The first two actually select the element I want with jQuery. The last three were various failed attempts at escaping the underscore.

I appreciate your help!
seanb
 
Posts: 4
Joined: Wed May 25, 2016 2:21 am

Re: Cannot block elements using a class starting with underscore

Postby mapx » Wed May 25, 2016 8:38 am

add
Code: Select all
@@||myanimelist.net^$generichide
myanimelist.net##DIV[style^="padding: 20px"]


the _unit class can't be directly hidden due to !important stuff

<div class="_unit" style="width:336px; height:280px; display: block !important;">
User avatar
mapx
 
Posts: 21917
Joined: Thu Jan 06, 2011 3:01 pm

Re: Cannot block elements using a class starting with underscore

Postby seanb » Thu May 26, 2016 12:06 am

Thanks! What is the purpose of the first line containing "generichide"? I mostly understand what the docs said about this, but I'm not sure what the impact would be for my use case.

Thanks again.

EDIT: Can you think of a way to still use the "_unit" class by capturing all elements inside of that element? Would doing this get around the "!important" issue?
seanb
 
Posts: 4
Joined: Wed May 25, 2016 2:21 am

Re: Cannot block elements using a class starting with underscore

Postby mapx » Thu May 26, 2016 12:17 am

"they" are testing if some elements are on page (exactly some css elements whitelisted by generichide keyword). So, they'll think there is no adblock there and they wont push on page those annoying _unit classes.
User avatar
mapx
 
Posts: 21917
Joined: Thu Jan 06, 2011 3:01 pm

Re: Cannot block elements using a class starting with underscore

Postby seanb » Thu May 26, 2016 1:39 am

Okay, thanks a lot!
seanb
 
Posts: 4
Joined: Wed May 25, 2016 2:21 am

Re: Cannot block elements using a class starting with underscore

Postby LordZounds » Sat May 28, 2016 5:41 pm

Hi,

I haven't done much with filters before, so I'm not entirely sure what I'm doing.

It seems the solution mapx post mostly works, but it doesn't always remove the spacing for the ads. It seems to only remove the spacing for the two ads in the middle of anime pages, but not for example the one at the bottom. For a more clear example, it does not remove the one in the top-right on this page:

http://myanimelist.net/search/all?q=test

Is there a way to modify that second line for different pages?
LordZounds
 
Posts: 3
Joined: Sat May 28, 2016 5:36 pm

Re: Cannot block elements using a class starting with underscore

Postby mapx » Sat May 28, 2016 6:43 pm

in this specific case it's not possible due to !important keyword used by the site.

However, you could use (install it) tampermonkey extension, then go to
https://greasyfork.org/en/scripts/14720 ... -important

and install that userscript (just click "install this script") in tampermonkey

add then this filter
Code: Select all
myanimelist.net##._unit


The userscript above can help in many other cases (it helps disabling that !important stuff)
User avatar
mapx
 
Posts: 21917
Joined: Thu Jan 06, 2011 3:01 pm

Re: Cannot block elements using a class starting with underscore

Postby LordZounds » Sat May 28, 2016 6:52 pm

mapx, that worked perfectly, thanks a lot!

Can using that script and ignoring the !important keyword cause any problems on other sites?
LordZounds
 
Posts: 3
Joined: Sat May 28, 2016 5:36 pm

Re: Cannot block elements using a class starting with underscore

Postby mapx » Sat May 28, 2016 7:07 pm

Not as far as I know, they are only enforcing those elements using !important style.
User avatar
mapx
 
Posts: 21917
Joined: Thu Jan 06, 2011 3:01 pm

Re: Cannot block elements using a class starting with underscore

Postby LordZounds » Sat May 28, 2016 7:09 pm

Alright, great. Thanks again!
LordZounds
 
Posts: 3
Joined: Sat May 28, 2016 5:36 pm

Re: Cannot block elements using a class starting with underscore

Postby tonylee123321 » Sun Apr 28, 2019 8:08 am

I am testing my website but it is not effective. :cry:
Please check for me :
Code: Select all
https://365manga.net/
tonylee123321
 
Posts: 1
Joined: Sun Apr 28, 2019 7:53 am

Re: Cannot block elements using a class starting with underscore

Postby alicetaylor1 » Sat May 18, 2019 5:17 am

I know it's a matter of preference but can someone point to articles or the though process for these kind of patterns? Is there a move towards a particular convention or is there a popular set of convention people seem to agree/follow?
alicetaylor1
 
Posts: 1
Joined: Sat May 18, 2019 5:13 am


Return to Adblock Plus for Chrome support

Who is online

Users browsing this forum: No registered users and 9 guests