Removing a div containing a string

Everything about using Adblock Plus on Microsoft Edge
Post Reply
GTXPlayer

Removing a div containing a string

Post by GTXPlayer »

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/
User avatar
mapx
Posts: 21940
Joined: Thu Jan 06, 2011 2:01 pm

Re: Removing a div containing a string

Post by mapx »

add these filters

Code: Select all

@@||tweaktown.com^$generichide
@@||ad.doubleclick.net/ddm/ad/*$domain=tweaktown.com
@@||global.ssl.fastly.net^$domain=tweaktown.com
lewisje
Posts: 2743
Joined: Mon Jun 14, 2010 12:07 pm

Re: Removing a div containing a string

Post by lewisje »

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.
Post Reply