Need Help Hiding Specific DIV's That Contain Certain Words

Discussion of topics related to ad blocking.
Locked
AtomicGuy
New Member
New Member
Posts: 2
Joined: Fri Jan 31, 2020 6:48 pm

Need Help Hiding Specific DIV's That Contain Certain Words

Post by AtomicGuy »

I'm looking to hide DIVs on a certain forum I visit that contain specific words/phrases. The main issue is the site's own functionality to block specific posts or threads has never worked properly.

The site I'm referring to is datalounge.com

I've been using AdBlock Plus's "block an ad on this page" tool to manually block certain posts as well as some other annoyances on the site, such as:

Code: Select all

www.datalounge.com##DIV[class="advert-leader-inline advert DigitopiaInstance"]
www.datalounge.com##DIV[class="post flames-and-freaks"]
www.datalounge.com##DIV[class="row poll DigitopiaInstance"]
www.datalounge.com##DIV[id="post-14170277"][class="post"]
www.datalounge.com##DIV[id="post-14520241"][class="post"]
www.datalounge.com##DIV[id="post-15429919"][class="post"]
www.datalounge.com##DIV[id="post-15728746"][class="post"]
But I'm looking for a more proactive way to create custom filters that automatically hide DIV's based on what is in the content of the DIV, and have it be case insensitive. In other words, I already have a list of words and phrases in mind, I just need a template for the filter syntax to do so. I'm not very familiar with writing regex. My attempts at using Extended CSS Selectors have not been working either.

Any help would be greatly appreciated. Thanks in advance!
intense
Contributor
Contributor
Posts: 10500
Joined: Wed Mar 27, 2013 9:56 am

Post by intense »

use:

ABP syntax

Code: Select all

datalounge.com##.post:-abp-has(.post-body:-abp-contains(/word1|word2|word3/i))
or (using uBlock Origin adblocker)

Code: Select all

datalounge.com##.post:has(.post-body:has-text(/word1|word2|word3/i))

Example:

You want to hide / remove the posts containing Hernandez and those matching Oscars
use (uBO)
datalounge.com##.post:has(.post-body:has-text(/Hernandez|Oscars/i))

or (ABP)

Code: Select all

datalounge.com##.post:-abp-has(.post-body:-abp-contains(/Hernandez|Oscars/i))
you can write the words lowercase (hernandez, oscars) or uppercase => will be matched as well
AtomicGuy
New Member
New Member
Posts: 2
Joined: Fri Jan 31, 2020 6:48 pm

Post by AtomicGuy »

Thank you!
Locked