Hey guys. Yesterday I made the following greasemonkey script. It adds a "Random" link under all the buttons that are normally beneath a Penny Arcade comic, which (unsurprisingly) links to a random comic. I don't know if something like this has been done before, but if not, I thought some of you might enjoy that functionality.
// ==UserScript==
// @name Penny Arcade Random Button
// @namespace pennyarcade@random.button
// @description Adds a random comic button to penny-arcade.com
// @include http://*penny-arcade.com/comic*
// ==/UserScript==
GM_xmlhttpRequest({
method: 'GET',
url: 'http://www.penny-arcade.com/archive/',
onload: function(responseDetails) {
var parser = new DOMParser();
var xmlDoc = parser.parseFromString(responseDetails.responseText,"application/xml");
var comics = xmlDoc.getElementById('id_comic');
var n = comics.options.length;
var myLink=comics.options[Math.floor(Math.random()*n)].value;
var btns = document.forms[0].parentNode;
if(btns)
{
var newElement = document.createElement('a');
newElement.innerHTML='Random';
newElement.href=myLink;
btns.appendChild(newElement);
}
}
});
Installation instructions:
1. You will need to be using Firefox to use this script
2. If you have never added the Greasemonkey add-on, add it
here.
3. Copy the code above and save it to a file on your hard drive called "penny_arcade_random.user.js"
4. In Firefox, go to File > Open file... and open the file you just created. Greasemonkey will prompt you to install the script.
Let me know if there are any problems.
Comments?
Posts
think you could make a script to make double clicking a thread's blue dot mark the thread as read?
This works pretty well, but is there a way you could add a button and maybe one for the news posts?
@gamefacts - Totally and utterly true gaming facts on the regular!