m7r-227 / Corinne

// ==UserScript==
// @name         Corinne
// @version      1.0.1
// @description  Corinne
// @author       m7r-277
// @licence      MIT
// @match        */*
// @grant        none
// @noframes
// ==/UserScript==

(function () {
    'use strict';

    const regex = /hapsatou/gi;
    const includesHapsatou = (node) => node.nodeValue.match(regex) !== null;
    const replaceHapsatou = (node) => node.nodeValue = node.nodeValue.replace(regex, 'Corinne');
    const browseNode = function (node) {
        const walker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT, includesHapsatou);
        while (walker.nextNode()) {
            replaceHapsatou(walker.currentNode);
        }
    }

    browseNode(document.body);

    const observer = new MutationObserver(replace);
    observer.observe(document.body, { childList: true, subtree: true });

    function replace(records) {
        for (const record of records) {
            for (const node of record.addedNodes) {
                browseNode(node);
            }
        }
    }
})();