
// This script was modified from Mark Pilgrim's Dive Into Greasemonkey tutorials.
// Please see his original at http://diveintogreasemonkey.org.
// I am pretty sure that I am not properly following the GPL in releasing this.
// If anyone would like to set me straight about how to properly do this,
// please contact me at d (at) mentalfloss.ca

// Arse Feck, v0.1
// David McCallum, 2006
// sintheta.org
//
// This script corrects curse words in dove.org's movie reviews.
// It does not work 100% correctly, as Dove is inconsistent with its
// fucking abbreviations. Please contact me if you notice any that need
// to be added to the list.
//
// I'm also sure that the script could be smarter if I only understood
// regular expressions properly.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name          ArseFeck
// @namespace     http://sintheta.org
// @description   Correct PCisms in dove.org's movie reviews
// @include       http://*dove.org/*
// ==/UserScript==
//
// --------------------------------------------------------------------
//

var replacements, regex, key, textnodes, node, s;

replacements = {
    "S/BS-": "SHIT/BULLSHIT-",
    "H-": "HELL-",
	"SOB-": "SON OF A BITCH-",
	"B-": "BITCH-",
    "F-": "FUCK-",
    "PO-": "PISSED OFF-",
    "S-": "SHIT-",
    "N-": "NIGGER-",
    "GD-": "GOD DAMN-",
    "D-": "DAMN-",
    "OMG-": "OH MY GOD-",
    "A-": "ASS-",
    "N\\*gger-": "NIGGER-",
    "N-": "NIGGER-",
    "J-": "JESUS-",
    "JC-": "JESUS CHRIST-",
    "C-": "CHRIST-",
    "Ch*ist": "CHRIST",
    "C sake": "CHRIST SAKE-",
    "P-": "PUSSY-",
    "Slang for male and female genitalia": "WORDS LIKE COCK, PUSSY, DICK, AND CUNT-",
    "slang for female genitles-": "WORDS LIKE PUSSY, CUNT, BEAVER, BLOODY GASH, AND TUNA TACO-",
    "Slang for female genitals-": "WORDS LIKE PUSSY, CUNT, BEAVER, BLOODY GASH, AND TUNA TACO-",
    "Slang for male genitles": "WORDS LIKE COCK, DICK, ROD, SHAFT, AND LINGAM",
    "Slang for male genitals": "WORDS LIKE COCK, DICK, ROD, SHAFT, AND LINGAM",
    "Slang for male genitalia": "WORDS LIKE COCK, DICK, ROD, SHAFT, AND LINGAM",
    "Slang for male/female genitalia-":"WORDS LIKE COCK, PUSSY, DICK, AND CUNT-",
    "OG-": "OH GOD-",
    "G-": "GOD-",
    "Sh\\*g": "SHAG",
    "B*st*rd-": "BASTARD-",
    "OG/": "OH GOD/",
    "J/C-": "JESUS CHRIST-",
    "JC/C-": "JESUS CHRIST/CHRIST-",
    "SOB-": "SON OF A BITCH-",
    "P\\*ss-": "PISS-",
    "Pi\\*s-": "PISS-",
    "Bi\\*ch-": "BITCH-",
    "Bi\\*ches-": "BITCHES-",
    "B\\*tch-": "BITCH-",
    "Cr\\*p-": "CRAP-",
    "Da\\*n": "Damn",
    "D\\*mn": "Damn",
    "T\\*ts": "TITS",
    "oral sex": "sucking cock or eating box",
    "Su\\*k": "SUCK"
};

regex = {};
for (key in replacements) {
    regex[key] = new RegExp(key, 'g');
}

textnodes = document.evaluate(
    "//text()",
    document,
    null,
    XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
    null);
for (var i = 0; i < textnodes.snapshotLength; i++) {
    node = textnodes.snapshotItem(i);
    s = node.data;
    for (key in replacements) {
		s = s.replace(regex[key], replacements[key]);
    }
    node.data = s;
}
