View Single Post
Old 2009-05-26, 17:02   #9
CRGreathouse
 
CRGreathouse's Avatar
 
Aug 2006

5,987 Posts
Default

I wrote this Greasemonkey script for the more sensitive members of the forums.
Click image for larger version

Name:	safe-for-kids.png
Views:	131
Size:	2.5 KB
ID:	3702
Code:
scr_meta=<><![CDATA[
// ==UserScript==
// @name           Mersenne cleanmouth
// @description    Censor a certain bad word from the Mersenne forums.
// @include        http://www.mersenneforum.org/*
// ==/UserScript==
]]></>.toString();

badWord = new RegExp('\\bparadigms?\\b', 'gi');
var posts = document.evaluate("//td[@class='alt1']", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
for (var i = 0; i < posts.snapshotLength; i++) {
    var par = posts.snapshotItem(i);
    var txt = par.innerHTML;
    if (txt.match(badWord))
	    par.innerHTML = txt.replace(badWord, '****');
}
CRGreathouse is offline   Reply With Quote