😭 MAGA 的恩情还不完😭

😭Long live The King😭

// ==UserScript==
// @name         😭 MAGA 的恩情还不完😭
// @namespace    http://tampermonkey.net/
// @version      0.41
// @description  😭Long live The King😭
// @author       DeepSeek R1
// @match        https://www.whitehouse.gov/*
// @grant        GM_addStyle
// @run-at       document-idle
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    const TARGETS = [
        'Donald J. Trump',
        'Trump',
        // '特朗普' 
    ].sort((a, b) => b.length - a.length);

    const styleClass = `th-mod-${Math.random().toString(36).substr(2, 5)}`;
    GM_addStyle(`.${styleClass}{font-size:calc(100% + 5px)!important;font-weight:bold!important;display:inline-block;}`);

    let isProcessing = false;

    const regex = new RegExp(
        '\\b(' +
        TARGETS.map(t =>
            t.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
        ).join('|') +
        ')\\b',
        'gi'
    );

    function safeProcess(node) {
        if (
            node.nodeType !== Node.TEXT_NODE ||
            node.parentElement.classList.contains(styleClass) ||
            ['SCRIPT', 'STYLE', 'NOSCRIPT'].includes(node.parentNode.nodeName)
        ) return;

        const content = node.textContent;
        if (!regex.test(content)) return;

        isProcessing = true;
        const wrapper = document.createElement('span');
        wrapper.innerHTML = content.replace(regex, `<span class="${styleClass}">$1</span>`);
        const fragment = document.createDocumentFragment();
        while (wrapper.firstChild) fragment.appendChild(wrapper.firstChild);
        node.parentNode.replaceChild(fragment, node);
        isProcessing = false;
    }

    function fastWalker(root) {
        const walker = document.createTreeWalker(
            root,
            NodeFilter.SHOW_TEXT,
            {
                acceptNode: node =>
                    node.parentNode.nodeType === Node.ELEMENT_NODE &&
                    !node.parentNode.closest('script, style, noscript') &&
                    regex.test(node.textContent)
                        ? NodeFilter.FILTER_ACCEPT
                        : NodeFilter.FILTER_SKIP
            },
            false
        );

        let currentNode;
        const batch = [];
        while ((currentNode = walker.nextNode())) batch.push(currentNode);
        batch.forEach(safeProcess);
    }

    const observer = new MutationObserver(mutations => {
        if (isProcessing) return;
        mutations.forEach(mutation => {
            if (mutation.type === 'childList') {
                mutation.addedNodes.forEach(node => {
                    if (node.nodeType === Node.ELEMENT_NODE) fastWalker(node);
                });
            }
        });
    });

    fastWalker(document.body);
    observer.observe(document.body, {childList: true, subtree: true});

    let retryCount = 0;
    const checkCompletion = () => {
        if (retryCount++ < 3) {
            fastWalker(document.body);
            setTimeout(checkCompletion, 500);
        }
    };
    window.addEventListener('load', checkCompletion);
})();