Chrome – Amazon Deterrent and Whackamole (in progress)

Chrome – Amazon Deterrent and Whackamole (in progress)

Extensions

First extension is simple – it just replaces all images on amazon with a simple message of advice:

Second one is an unfinished attempt to make a window based whack-a-mole game. So far, I’ve only implemented opening up a new window that jumps to a new location when you click it. Ideally it would pass a message back to the background page that increments a counter to keep score, which would then be displayed in a separate small window. We’ll get there.

Reverse Engineering

I spent a while trying to find an extension and eventually came across this really simple one that reminds you to drink water – Drink!. It’s a small, unminified code base and super easy to deconstruct.

It uses a background page and a popup, as well as an omnibox keyword, which allows the user to type “drink” into the omnibox and hit tab, and then enter some data. The background page is persistent, because it’s a counter, it needs to be running all the time, so that makes sense.

It’s all very simple, the button in the popup starts a countdown timer. On each iteration of the timer, a message is passed using chrome.runtime.sendMessage. When the counter gets to zero, it calls another function that creates a popup.