# The Case for Learning Adblock

November 3, 2020

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.

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


## Muting Lobste.rs Users

I find several posters on Lobsters annoying, but it's simple to mute them:

lobste.rs##.byline a:has-text(username):upward(3)


## Muting Zulip Users

Zulip is a really great group chat app, but it doesn't currently let you mute users. Not to worry though, we can quickly build this ourselves:

subdomain.zulipchat.com##.sender_name:has-text(username):upward(5) .message_content


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

## Disabling Websites

If you want to disable a distracting website completely, that's simple:

badwebsite.com##html:remove()


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:

sci-hub.st###minime
sci-hub.do###minime