freecog.net

xkcdenhancer.user.js

Also see Install.

   1 // ==UserScript==
   2 // @name           xkcd Enhancer
   3 // @namespace      http://freecog.net/2006/
   4 // @description    Shows the "title text" below the comic.
   5 // @include        http://xkcd.com/
   6 // @include        http://www.xkcd.com/
   7 // @include        http://xkcd.com/c*.html
   8 // @include        http://www.xkcd.com/c*.html
   9 // ==/UserScript==
  10 
  11 
  12 var img = document.getElementById('middleContent').getElementsByTagName('img')[0];
  13 if (!img.title) return;
  14 var p = document.createElement('p');
  15 var s = p.style;
  16     s.padding = '0';
  17     s.margin = '-5px auto 0 auto';
  18     s.width = (img.width - 4*2) + 'px';
  19     //s.borderBottom = s.borderLeft = s.borderRight = '1px solid black';
  20     s.padding = '4px';
  21     s.fontSize = '14px';
  22     s.minHeight = '34px'; // Don't shift the nav around so much.
  23     s.fontVariant = 'normal';
  24 p.appendChild(document.createTextNode(img.title));
  25 if (img.nextSibling) {
  26     img.parentNode.insertBefore(p, img.nextSibling);
  27 } else {
  28     img.parentNode.appendChild(p);
  29 }