Created
March 7, 2015 19:50
-
-
Save hikari-no-yume/358ae78a9961e6abad57 to your computer and use it in GitHub Desktop.
FEMINIZER X9001 (the 1 is significant)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function misandry() { | |
var replaceables = Object.keys(reptable) | |
/* sort by length descending, value ascending | |
this is to ensure greedy matching */ | |
.sort((s1, s2) => { | |
const lengthOrder = s2.length - s1.length; | |
const valueOrder = (s1 === s2) ? 0 : (s1 < s2) ? -1 : 1; | |
return lengthOrder ? lengthOrder : valueOrder; | |
}), | |
ueberRegex = new RegExp('\\b(' + replaceables.join('|') + ')\\b', 'gm'), | |
evilXML = document.getElementById('sexist').innerHTML; | |
/* find successive matches */ | |
var match; | |
while ((match = ueberRegex.exec(evilXML)) !== null) { | |
/* substitute! */ | |
evilXML = evilXML.substr(0, match.index) | |
+ reptable[match[0]] | |
+ evilXML.substr(match.index + match[0].length); | |
} | |
/* crush the patriarchy! */ | |
document.getElementById('sexist').innerHTML = evilXML; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment