User:Sid/Anti-Hackery-Link-Rewrite

From RationalWiki
Jump to navigation Jump to search

UPDATE: Hack was undone, so this script has been obsoleted.

Quick Greasemonkey script to avoid clicking on scam links:

If you're using Greasemonkey (Firefox extension, grab it from the Mozilla Extensions site), you can just create a new script (right-click on the monkey head, enter a name like "CP Link Rewrite" and hit Okay) and replace any pre-made content with the stuff below. It's just a quick fix, so there might be bugs. Lemme know if so.

Note: If you can't use Greasemonkey (IE user, for example), but are able to edit on CP, you can try the Userscript version of this.

// ==UserScript==
// @name           CP Link Rewrite
// @namespace      http://rationalwiki.com
// @description    Rewrite links
// @include        http://www.conservapedia.com/*
// @include        http://conservapedia.com/
// ==/UserScript==

(function(){
var allElements, thisElement, bluh, blah;
allElements = document.getElementsByTagName('a');
for (var i = 0; i < allElements.length; i++)
{
	thisElement = allElements[i];
	if (thisElement.href.match(/index\.php/i))
	{
	}
	else
	{
		blah = thisElement.href;
		bluh = blah.split('conservapedia.com/');
		blah = bluh[0]+'conservapedia.com/index.php?title='+bluh[1];
		thisElement.href=blah;
	}
}

})();