greasemonkey script to "hide" the flash map

Discussion about hacker.org's server
Post Reply
pSub
Posts: 3
Joined: Tue May 26, 2009 11:28 am
Location: ZZZZZZZZ

greasemonkey script to "hide" the flash map

Post 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);
}
Post Reply