xkcd Greasemonkey script
Nick put me on to xkcd.com a while ago. One thing that’s annoyed me about it for quite some time is that to read some of the joke you have to hover over the image to read the title attribute; and if that attribute’s value is too long you end up having to view the source to read it. Boring.
Greasemonkey to the rescue! I heard about this extension for firefox before but had no need of it, it allows you to write some javascript that will get executed for a particular website. Cool.
Before
After
Script (Download xkcd.com comic title greasemonkey script)
// ==UserScript==
// @name xkcd comic title
// @namespace http://xkcd.com
// @include http://*xkcd.com/*
// ==/UserScript==
var arrObjImages = document.getElementsByTagName(”img”);
var iImg;
for(iImg = 0; iImg < arrObjImages.length; iImg++){
var objImage = arrObjImages[iImg];
var sImgTitle = objImage.getAttribute("title");
if(sImgTitle != null && sImgTitle.length > 0){
//image title
objImage.parentNode.insertBefore(document.createTextNode(sImgTitle),
objImage.nextSibling);
//two line breaks
objImage.parentNode.insertBefore(document.createElement(”br”), objImage.nextSibling);
objImage.parentNode.insertBefore(document.createElement(”br”), objImage.nextSibling);
};//end if
};//end for
Dive into Greasemonkey (Sounds a perverted don’t you think?)
Start Slide Show with PicLens Lite