The Binary Bin
Published in

The Binary Bin

Stop Scrolling!

Photo by Patrick Tomasso on Unsplash

You just can’t help it. You fire up your web browser, open up your social media feeds, and before you know it, you’ve lost an hour (or half) of your life that you won’t be getting back.

Well, you can put a stop to that. Stop the internet from stealing away your time that is. Here’s a handy little extension for chrome I’d written, that has saved me loads of time. How? It simply shows a tiny alert when I’ve been scrolling too much.

If you try it out and see that you like it, then great! I’m glad to have saved you precious moments of your life. If you don’t, then maybe you can consider tweaking it to suit your needs better. Here’s how you can go about it.

Get the source from GitHub (and no, this isn’t a GitHub tutorial)

Learn How Extensions are Written (or don’t, and skip to the next part)

You can refer to the official docs to learn how to write extensions from scratch.

Each extension has a manifest that specifies the parts of the extension, like its name, the icons, user commands, and scripts. There are two kinds of scripts — content scripts that can read and modify content on the pages you visit, and background scripts that listen for user events. You can communicate between the two by passing messages.

Understand the Script (can’t skip this one)

If you skipped the previous section (boo-hoo), don’t despair. You can put your focus on the contentScript.js file. It adds a listener for scroll events. If the scrolled pixels exceed the allowed distance, an alert shows (that you can ignore if you’ve succumbed to internet addiction), and the allowed distance gets increased so you can scroll some more. This happens forever (theoretically), so you’re never truly lost.

Make it work for you!

Now that you know how the extension works (kind of), you can go about tweaking it however you wish! Here are some ideas:

  1. A full-screen popup that forces you to stop.
  2. Display the time you’ve spent scrolling so far.
  3. Display random evil insults using a certain generator API.

Stop Scrolling

Yes, you’ve reached the end of this article. I hope I didn’t waste your time. But if I did, I find solace in not being the only one to do so.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store