Removing a div containing a string

Everything about using Adblock Plus on Microsoft Edge

Removing a div containing a string

Postby GTXPlayer » Thu Nov 24, 2016 11:18 am

Hi,

I'm trying to remove a DIV or set of DIV's that contain a specific string.

The problem is that the DIVs name is changed every time the page is loaded, so you can't specify the DIVs name and hide the entire DIV. However the string contained within the DIV is always the same. Another problem is that the DIV is contained within another 10 or so randomly generated divs, so if it's possible, the root DIV would need to be deleted. The most notable point is that these DIVs contain nothing that needs to be kept for the sites function; deleting the root div would be totally workable.

I'm not so fluent with writing filters but I know a good bit of HTML. I'm struggling to think of how the code would form to accomplish this task. Here's more info on the site:

Site name:
Code: Select all
http://www.tweaktown.com/

Element type: <div>
String to validate: "Please consider disabling your ad blocker or watching a video ad to support us." - This is the lowest DIV embedded within each set of Divs. So deleting this all the way to the parent DIV would be the best method.
Amount of DIV's: There are 8 Divs, including the parent DIV at the top and the lowest DIV at the bottom. Their names and class ID's are all randomly generated.

An image for better explanation:
https://postimg.org/image/yeel6fmmx/
GTXPlayer
 

Re: Removing a div containing a string

Postby mapx » Sat Nov 26, 2016 1:39 pm

add these filters

Code: Select all
@@||tweaktown.com^$generichide
@@||ad.doubleclick.net/ddm/ad/*$domain=tweaktown.com
@@||global.ssl.fastly.net^$domain=tweaktown.com
User avatar
mapx
 
Posts: 21944
Joined: Thu Jan 06, 2011 3:01 pm

Re: Removing a div containing a string

Postby lewisje » Sat Nov 26, 2016 7:13 pm

Hiding based on text content cannot be done with CSS, but it is possible to use XPath queries for this purpose.

uBlock Origin supports XPath in non-generic hiding rules: https://github.com/gorhill/uBlock/wiki/ ... ntax#xpath
ABP is considering supporting XPath (also in non-generic hiding rules): https://issues.adblockplus.org/ticket/2360
There's a buzzin' in my brain I really can't explain; I think about it before they make me go to bed.
lewisje
 
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm


Return to Adblock Plus for Edge support

Who is online

Users browsing this forum: No registered users and 4 guests