Saturday, April 24, 2010

Wikipedia Footnotes Bookmarklet And Greasemonkey Script

I’ve recently begun reading Lukas Mathis’ blog, ignore the code – it’s pretty interesting and insightful. I usually read posts from within my feed reader and rarely actually visit a site, so I missed this neat script he has, which pops up a small ‘floating’ div when the reader hovers over the footnote superscript number. He explains why he does this as well as how on his post titled Footnotes. He's also modified his script to create a bookmarklet for Daring Fireball.

The first thing I thought was, this would be pretty useful for Wikipedia articles, where there are usually tons of citations and references. So I adapted the bookmarklet for Wikipedia. Now you probably wouldn’t want to load the bookmarklet for every Wikipedia page, especially if you really do read the citations often. So I’ve also modified the script for use with Greasemonkey.

This is what you should get after you use either of these scripts:

You’ll find both scripts on the project page on my site (along with some basic instructions on setup). Or if that’s too many page views in a day for you, this is the bookmarklet which you should bookmark, and this is a direct link to install the Greasemonkey script from

The idea and most of the code, are both courtesy Lukas; I’ve only tweaked it a bit for use with Wikipedia. Any mistakes are mine. And JavaScript isn’t really my forte so the code is probably not as elegant as it could be. All the same, it works for me (the bookmarklet on Firefox and Chrome; the GM script on Firefox only, of course and Chrome 4. IE, with it’s non-standard event handling isn’t supported); if you do have some problems getting it to work, let me know.

 UPDATE [0006 01 May 2010]: Wow! The script was featured on everybody's favorite productivity and tips site Lifehacker, and I've been so busy with dead week, that I didn't even notice! That explains the 507 installs in one day!

 UPDATE [2210 02 May 2010]: Chrome 4 supports Greasemonkey scripts natively and most scripts should work properly; this one in particular does!