Page 1 of 1

greasemonkey script to "hide" the flash map

Posted: Thu Jul 08, 2010 2:00 pm
by pSub
Hi,

I like the challenges and games on hacker.org, but annoyed of the flash map. To get rid of it, I've written two greasemonkey scripts. The first one replaces on the front page the link to the flash map with a link to the text version. The second adds a link to "Top Hackers" and the forum to the page of the textversion.

So here they are, I hope you will find them useful:

Code: Select all

// ==UserScript==
// @name           hacker-org-challenges
// @namespace      document
// @include        http://www.hacker.org/
// ==/UserScript==

replacelink("challenge/","challenge/text.php");

Code: Select all

// ==UserScript==
// @name           hacker-org-challenges
// @namespace      document
// @include        http://www.hacker.org/challenge/text.php
// ==/UserScript==

replacelink('<a href=".">Back to map...</a>','<a href="../../challenge/top.php">Top Hackers</a> | <a href="../../../forum">Forum</a>');
And the replacelink function:

Code: Select all

function replacelink(needle, replacement){
        haystack = document.getElementsByTagName("body")[0];
        haystack.innerHTML = (haystack.innerHTML).replace(new RegExp(needle, "ig"), replacement);
}