Christian Vuerings

Hacking Around With Userscripts


Lately I've been hacking around with userscripts. Those scripts are JavaScript files that can enhance the experience of a user on certain websites. Here's a list to get you to start thinking:

Make a site more readable by changing the color of the text. Add support for keyboard shortcuts. Remove really annoying ads. Of course you could think of many more things, the list is literately endless.

My scripts

The Piratebay Ad Remover

My most popular script so far is an ad remover for The first version of the script was launched on the 5th of November 2010 and has had 320 downloads so far. Alternative Video Player

When looking at talks on, the default flash player always annoyed me. The full screen button didn't work and seeking through the video was buggy. Apart from that, when you go full screen, you still had the flash player controls on the top and bottom of the screen. As an alternative, I wanted to use the open-source JW Player.

mflow Keyboard Shortcuts is a great online music player for discovering new songs. The script ads some basic keyboard shortcuts to pause/resume a song or go to the next one. It was pretty straightforward to do, since I was able to access their JavaScript library.

Other scripts

You can find some of the other scripts I wrote and a more up to date list on my profile page.

Things to remember

Google Chrome compatibility issues

If you want to make sure that your script also runs in Google Chrome, do the following:

@match attribute

Next to the @include attribute, also use the @match attribute. This will make sure that the user who install the userscript will get an appropriate message:

Don't use the @require attribute.

Most of the time you don't need this, but if you do, create a script element and append it to the head or body.

Don't use the unsafeWindow variable.

Greasemonkey allows you to access global JavaScript variables through this variable, but google chrome doesn't. You can find a workaround in my mflow userscript.

More information

You can find more information about userscripts in google chrome on the chromium userscripts page.

Personal blog by Christian Vuerings
I love to share interesting ideas.