Anti-Nahitan

Informar al mundo sobre Fugitivo de la justicia, Nahitan Nandez

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Anti-Nahitan
// @namespace    https://koutarou.uy/
// @version      0.1
// @description  Informar al mundo sobre Fugitivo de la justicia, Nahitan Nandez
// @author       kouta-kun
// @match *://*/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
// @grant        none
// @license      GPLv3
// ==/UserScript==

function textNodesUnder(el){
  var n, a=[], walk=document.createTreeWalker(el,NodeFilter.SHOW_TEXT,null,false);
  while(n=walk.nextNode()) a.push(n);
  return a;
}

function replacer(match, offset, string) {
    'use strict';
    const negativePrefix = "Fugitivo de la justicia, ";

    if (string.substring(offset-negativePrefix.length, offset) === negativePrefix) return match;
    return negativePrefix + match;
}

function onScrollStart() {
    'use strict';
    const searchTerm = /Nahitan N[aá]ndez/gi;

    for(let elem of textNodesUnder(document.body)) {
        if(elem.textContent.search(searchTerm) >= 0) {
            console.log(elem.textContent);
            elem.textContent = elem.textContent.replaceAll(searchTerm, replacer);
            console.log(elem.textContent);
        }
    }
}

(function() {
    'use strict';
    console.log("init script");
    window.addEventListener("scroll", onScrollStart, false);
    onScrollStart();
    // Your code here...
})();