Page 1 of 1

Removing a div containing a string

PostPosted: Thu Nov 24, 2016 11:18 am
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/

Re: Removing a div containing a string

PostPosted: Sat Nov 26, 2016 1:39 pm
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

Re: Removing a div containing a string

PostPosted: Sat Nov 26, 2016 7:13 pm
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