Calvin and Hobbes, gocomics and dotjs

Ok. So, I like comics. It’s not something I write about, but at any given time I probably have a dozen webcomics that I’m actively subscribed to (by the way, if you’re not, you should be reading Schlock Mercenary and Girl Genius. Not what this post is about, just a heads up).

One thing I really like is discovering large archives of comics I’ve not read, or read a long time ago but had forgotten about / not realised they were available online.

So I was pretty excited when a friend pointed out that Calvin and Hobbes was available on gocomics (or if you don’t want to hunt for the first comic, here it is) especially when I realised to my surprise that I actually didn’t recognise a lot of the most recent ones. I’m pretty sure there aren’t new Calvin and Hobbes, but apparently I’ve read less of it than I thought. So as far as I’m concerned: Yay, new Calvin and Hobbes!

There’s just one problem. The gocomics interface is terrible for reading comic archives. And there’s a lot of archive here. I don’t think I’d be able to make it through this without developing acute RSI.

But! I am a programmer. Solving irritating problems with software is basically my job description. So I shopped around for a way to solve this and came across dotjs (the original is OSX specific, but there’s a fork that works on linux too which is what I’m using). It’s just a nice easy way of injecting site specific javascript.

So, I installed this, created ~/.js/ and added the following code to it:

function followLinkLike(matcher){
  document.location = $(matcher)[0]["href"]
document.onkeydown = function(e){
    case 74: followLinkLike("a.prev"); break;
    case 75: followLinkLike(""); break;

Problem solved. Gocomics now has keyboard navigation. j will take you backwards, k will take you forwards (I’m a vim user ok. So sue me).

dotjs is a really nice solution to this sort of problem. I’m definitely going to be on the look out for broader applications of it.

This entry was posted in Code on by .