Why YSK: Certain topics are stressful and tend to spread all over the site, including to unrelated communities. Blocking communities can be overkill and ineffective, and likewise for blocking individual users.
To do so, open up the uBlock Origin dashboard, go to the ‘My filters’ tab, and add this filter:
lemmy.world##article.row:has-text(/word1|word2|word3|word4/i)
For example:
lemmy.world##article.row:has-text(/Trump|Elon|Musk|nazi/i)
Then apply the changes and reload any open tabs, and all posts which contain any of your filtered words will simply not show up.
You’ll have to change “lemmy.world” at the start to whatever your actual instance is. You can filter as many or as few words as you want, just keep the / at the start, the /i at the end, and separate words with | pipes. What’s actually being filtered is a case-insensitive regex, if you want to get fancy with it.
Here are equivalent filters for reddit and Ars Technica:
reddit.com##div.thing[data-context="listing"]:has-text(/word1|word2|word3|word4/i)
arstechnica.com##article:has-text(/word1|word2|word3|word4/i)
As a disclaimer, I made these myself, and I’m not particularly familiar with creating uBlock Origin filters. There may be better ways to do this. Also the reddit one is specific to old.reddit.com, and the lemmy filter is made to work with the default lemmy.world web UI and may not work on other UIs without tinkering.
Yes, I know I’m just hiding my head in the sand.
How would one implement these filters but EXCLUDE certain things … like say … filter anything with “MAGA” but allow it if there’s also mention of “Leopards” is still allowed? :)
lemmy.world##article.row:has-text(/word1|word2|word3/i):not(:has-text(/word4|word5|word6/i))
or
lemmy.world##article.row:has-text(/maga/i):not(:has-text(/leopard/i))
will do what you want - it’ll block any posts which contain words from the first regex, unless it also has some words from the second regex
So, adding the not clause works but only if the leopard is within the title row I believe. I can go to the leopards ate my face and see posts, but those with the block words are still being filtered. Since you’re now our IT support for UBO and Regex do you by chance know if it’s possible to connect the title and community rows into a UBO filter for the :not part?
I’m not sure I follow - the filter seems to work as-is to me. It allows posts on both the front page and the !leopardsatemyface@lemmy.world to bypass the filter for me.
To be clear, it’s not only applying to the title row - the
article
tag it targets contains the entire post as it appears in the post feed, including the title, community name, the person who submitted it, the timestamp, etc. So if anything there contains a filtered or whitelisted word it should trigger the filter.I wouldn’t have necessarily expected the whitelist filter to work directly on the leopards community page, since posts on community feeds don’t include the community name, but it works anyways because, it seems, there’s a hidden mod option in the HTML with the community name in it:
<div class="modal-body text-center align-middle text-body">Are you sure you want to transfer leopardsatemyface@lemmy.world to TheBat@lemmy.world?</div>
not all heroes wear capes!!!
This works like a charm… Thanks!
It helps, and thanks for ublock idea for web browser users.
but because post titles aren’t required to contain the keywords, I still see a lot of political crap.
Was literally updating my filtered words just now. I use Voyager app on iOS and it can be done in the settings.
Was literally updating my filtered words just now.
Not just figuratively updating them.
On Android, in Connect and Voyager you can block URLs too, hence getting rid of toxic / clickbaity sources beyond filtering for specific keywords
That’s just great, thanks Connect and Voyager devs!
Voyager has a wonderful filter list under Settings -> Filters & Blocks. Works great and you can back up your settings to a json file in case you need to reload them.
I’ve been using similar, but slighly different ones that I assume do the same thing. You can also copy the filter and just replace the filter word rather than including them all in one. Naturally here the instance name must be also changed to that of yours.
lemmy.world##div.post-listing:has(span:has-text("/trump/i"))
And for filtering comments:
lemmy.world##article.comment-node:has(div.comment-content:has(p:has-text(/trump/i)))
At one point I had the very similar filter
lemmy.world##.post-listing:has-text(/trump/i)
, but I wasn’t happy with it because it would also remove post content on actual post pages, not just the post feed. That was the whole reason I swapped to the article.row solution instead - posts in the feed have the row class while posts on their own page don’t. But it looks like you found an alternate solution to achieve essentially the same thing. Neat!I have no real interest in filtering out comments, but it’s nice to have that option there for people who do.
ideally, this is a native feature in lemmy
Eterity app can do that on Android
my title filters btw:
Orban,Trump,Vance,Elon,Musk,NATO,Scholz,Merz,Habeck,AOC,Thunberg,Tunberg,Greta,Mr. Beast,MrBeast,Bitcoin,Putin,Russia,Kremlin,AfD,Grünen,Gaza,Israel,Palestine,Democrat,Republican,Surpreme,Abortion,Taliban,China,Chinese,Harris,Biden,Genocide,Tory,Brexit,Google,Microsoft,Windows,Apple,iPhone,Android,OpenAI,ChatGPT,Lora,intel,nvidia,arch,mint,ubuntu,framework,raspberry,pihole,pipewire,linux,bezos,amazon,fairphone,Europeans,Brics,leyen,swift,immigrant,Santis,California,Youtube,Montag, Laberfaden,G'sudert wird,Bluesky,Twitter,Montagslaberfaden,blsky,bluesky,isglitch.com,Gaetz,Kulturfreitag,Jimmy Carter,Boebert,Pokemon
are there even any posts left?
yeah, mostly interesting cool stuff
Yoink
I would like to see less posts about Judd Trump.
Is there some kind of combination of words to filter out post removed about having to see posts?
You can hide specific posts on Lemmy 0.19.4, unfortunately LW is still on 0.19.3