owo-firefox/owo.js
2022-08-01 19:41:20 -05:00

22 lines
641 B
JavaScript

function owo(text) {
text = text.replace(/(?:r|l)/g, "w");
text = text.replace(/(?:R|L)/g, "W");
text = text.replace(/n([aeiou])/g, 'ny$1');
text = text.replace(/N([aeiou])/g, 'Ny$1');
text = text.replace(/N([AEIOU])/g, 'Ny$1');
text = text.replace(/ove/g, "uv");
return text;
}
function replace_owo(element) {
for (var i = 0; i < element.childNodes.length; ++i) {
if (element.childNodes[i].nodeType == Node.TEXT_NODE) {
element.childNodes[i].textContent = owo(element.childNodes[i].textContent);
} else {
replace_owo(element.childNodes[i]);
}
}
}
replace_owo(document.body);