Learning how to write adblock rules has significantly increased my satisfaction with using the internet. I think many people don't realize how powerful adblock rules can be — you can run somewhat complex transforms of the presentation of websites using a relatively simple and lightweight tool that you likely already have installed. In this post, I'll quickly go over some examples of uBlock rules that were simple to write and made me much happier. I use uBlock Origin, but you should be able to get similar results with any adblocker.
Blocking Youtube Recommendations
I used to find it really easy to get sucked into spending a lot of time on Youtube, following recommended video rabbit holes. I didn't want to quit Youtube entirely, since there are some people on Youtube that make videos I enjoy, I just don't want to get sucked into watching recommended video after recommended video. Fixing this is three simple adblock rules, that took about 15 minutes to write:
www.youtube.com##ytd-watch-next-secondary-results-renderer.ytd-watch-flexy.style-scope www.youtube.com##a.ytp-suggestion-set.ytp-videowall-still www.youtube.com##ytd-browse[page-subtype=home]
Muting Lobste.rs Users
I find several posters on Lobsters annoying, but it's simple to mute them:
Muting Zulip Users
subdomain.zulipchat.com##.sender_name:has-text(username):upward(5) .message_content subdomain.zulipchat.com##.sender_name:has-text(username):upward(5) .inline_profile_picture:style(visibility:hidden;height:1px!important)
This way, we'll still see that the user sent a message, but the contents will be hidden, and it'll only take up one vertical line of text to display their username.
EDIT: This doesn't quite work as is — it probably needs to be rweritten using xpath to work for the case where a muted user posts multiple messages one after another
If you want to disable a distracting website completely, that's simple:
You could just have the entire rule be
badwebsite.com, but then uBlock will offer a UI to blow through the block if I visit the site, which usually isn't what I want.
Removing Distracting Sci-Hub Gif
When you view a paper on Sci-Hub, it shows a gif of Alexandra Elbakyan waving at you. While I appreciate everything she's done for science, I find the gif distracting, so I remove it like so:
Adblock filters are an excellent tool for making the web work the way you want them to, but they can be intimidating to learn! For simple stuff, you can open the "Element Picker" interface, but for more complicated rules I usually open up the inspector and sometimes look at the uBlock wiki. I've found a lot of value in realizing that I can customize my web experience and investing a bit of time in learning how to write adblock rules. I hope you consider writing some rules for yourself!