Cool! Just curious, why do you query 10 times per second for a feed? This seems kind of excessive and maybe a bit bad for battery life, especially since this could be running in several tabs at once.
This is just the straightforward idea of waiting for some element to appear on the website. But once the element is found, this thing stops. It won't stop for YouTube if you are on Facebook though but it's just a first implementation and it could actually be very easy to recognize the site. Thanks for the helpful suggestion!
I wrote an extension that did something similar for Twitter, back when Twitter had "So-and-so liked this" tweet, which was inevitably something awful. It's archived now, because it's no longer relevant. But you might find something useful in the code.
I tried polling, but it was against the Chrome extension guidelines at the time, so I used a "mutationObserver" on page load and then a "scrollListener". I don't remember if I ever tried an "intersectionObserver" but that might be worth looking at.
Yes, definitely use mutation observers. Far faster to react and doesn't require polling, they're better in essentially every way when things aren't changing many times per second.
I've been using an extension called News Feed Eradicator for like years now and its great! I was thinking of editing the code to put up like a math equation every time I need to disable it, but not sure if its open source. Seems like this tool might work!
Injected a custom stylesheet via extension vs. removing elements. I messed around with YouTube before and they can detect when their dom changes. Not to say it's breaking but I thought it was interesting.
You might be cooking something here, seems useful when you're on certain websites that stream sports and won't allow you to close the chat windows while watching.
The whole point is to actually have installed locally so you don't share any data with the developer of the extension. The problem with extensions is that in many cases the access that you give them is way too broad. If you install it by yourself, you control everything. The only thing that I thought about is maybe some kind of configurator that would allow you to pick some already existing rules that the users would share through github.
Thanks for pointing this out. The whole discussion around "the developer doesn't see my data" confused me, as the question of whether the code is malicious is orthogonal to installation method.
Given that uBlock Origin can do this, I'd recommend that route. uBlock Origin is probably the most trustworthy extension I've ever run across, and Gorhill has proven that he is trustworthy over many years.
The advantage that speaks to me, is that I control everything. I'm not sharing my data with the developer of the extension so it's one person less that I have to trust. I can also very easily adjust it to my needs, but I can program, so it's not valid case for everyone.
The current version just grabs the whole feed and removes it from the website. If you can program, it won't be hard for you to extend it so you can remove only the content you want.
The main problem that I have with extensions is:
"It can:
Read and change all your data on all websites"
Having my own, local extension I don't have to actually think whether I added some sensitive stuff to be exempt from permissions or not.
uBlock Origin is weak when it comes to new DOM elements dynamically created after the page has ostensibly loaded. Most of its powerful "cosmetic filter" selection operators don't work on such elements. I suspect that could make it of limited use on a feed object in which new elements appear, if you want to filter specific elements. (Aren't "infinite" feeds lazily loaded by JS?)
Still, much smarter to try it first to see if it fits your use case.
https://support.brave.com/hc/en-us/articles/360018039072-How...