I've only tested in firefox, but it should be easily adaptable to other browsers:
Code: Select all
// ==UserScript==
// @name SMBC Buttons
// @description Adds the next/previous/random buttons at the bottom
// @include http://www.smbc-comics.com/*
// @version 1
// ==/UserScript==
(function() {
'use strict';
var nextButtons = document.querySelectorAll('img[usemap="#buttons"]')[0],
lineBreak = document.createElement('br'),
newNextButtons = nextButtons.cloneNode(true),
comicTable = nextButtons.nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling;
// make sure nothing is wrong
if (!nextButtons || !comicTable || comicTable.nodeName.toUpperCase() !== 'TABLE') {
alert('something went wrong');
}
// insert a line break first
comicTable.parentNode.insertBefore(lineBreak, comicTable.nextSibling);
// then a copy of the buttons image
comicTable.parentNode.insertBefore(newNextButtons, comicTable.nextSibling);
} ());