My first browser extension

UPDATE 06.10.2022: I have extended this extension to also highlight new (blue) and seen (red) domains. You can see the addition in the repo

One of my hobbies is to hunt for what I call "rare domains", these can either be domains that once was owned by someone important (kirk1.no) earlier owned by Den Norske Kirke), names (siri.no), potential for me to commercialize (meditering.no) or for some other novel reason. My primary way of hunting is to look for dropped domains.

For a couple of years my routine has been look through the lists one time a week and create reminders for when interesting domains get dropped. These lists are around 30-60 pages to go through and I have to click the "next" link on the bottom page with my mouse like a neanderthal.

This tedious repetitive task is an insult to the biology of humans and enhances my carpal tunnel syndrome. Unacceptable.

Clicking is boring

How should I solve this?

So I had some criteria to the solution to this unlivable problem.

  1. Do not interfere with any other websites
  2. Mouseless
  3. Go to the next page
  4. Go to previous page

This is should be easy enough. Earlier when I had a long backlog I just opened the console and wrote a easy event listener to click the link for the next page.

1addEventListener("keydown", function (event) { 2 if (event.key === "ArrowRight") { 3 document.querySelector(".next").click() 4 } 5})

Hello 'NEXT!!'

But when I do this for the second time, I waste my valuable time. So I thought "How hard can it be to create a extension to handle this on specific pages".

The answer is that it's extremely easy.

Say hello to "NEXT!!" (inspired by this meme) the highly specialized pagination extension to go to next/previous page on expireddomains.net.

It consists of two parts: manifest.json and rlkeylistener.js.

For the manifest file the only thing that is interesting is content_script (documentation). Here I match the domain the script should trigger on and what script it should trigger. Easy.

I use manifest v3 that have some controversies, but I will not dive into them here.

1// manifest.json 2{ 3 "name": "NEXT!!", 4 "version": "1.0.0", 5 "description": "Add eventlistener to left/right keypress", 6 "manifest_version": 3, 7 "author": "Kent Are Torvik", 8 "content_scripts": [ 9 { 10 "matches": ["https://*.expireddomains.net/*"], 11 "js": ["js/rlkeylistener.js"] 12 } 13 ] 14}

I wrapped everything in a try/catch since I don't care if it fails and I dont want to produce unnecessary errors on pages that does not have any elements with the class next/prev.

1// rlkeylistener.json 2addEventListener("keydown", function (event) { 3 try { 4 if (event.key === "ArrowRight") { 5 document.querySelector(".next").click() 6 } 7 8 if (event.key === "ArrowLeft") { 9 document.querySelector(".prev").click() 10 } 11 } catch {} 12})

If you find yourself in the same niche situation as me, feel free to use it by downloading the repo from my github and activate the extension in chrome.

extensions -> enable developer mode -> load unpacked

Peace.