JSFiddle - React, Tailwind, and code Playground
JavaScript
@resource mylist https://example.com/mylist.json
(function(){
var theList = JSON.parse(GM_getResourceText("mylist"));
var regexp = new RegExp('\\b(' + mylist.join('|') + ')\\b(?!\\)\\))', "gi");
function walk(node) {
var child, next;
switch ( node.nodeType )
{
case 1:
case 9:
case 11:
child = node.firstChild;
while ( child )
{
next = child.nextSibling;
walk(child);
child = next;
}
break;
case 3:
handleText(node);
break;
}
}
function handleText(textNode) {
textNode.nodeValue = textNode.nodeValue.replace(regexp, 'REPLACED!');
}
walk(document.body);
})();