I tried making an extension that finds all words saying "found" and replacing them with "found" just for testing. It sometimes changes 1/2 the words, sometimes all, and sometimes none.
Like this:
https://i.stack.imgur.com/z2Azq.png
after pressing a new date on the site:
https://i.stack.imgur.com/BpZpD.png
I think it's because the site updates or loads new "instances" of the word. Is there any way to keep the script updating like every second? Replacing the word again.
Manifest:
{
"manifest_version": 2,
"name": "title",
"description": "description",
"version": "4.0",
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"content.js"
],
"run_at": "document_idle"
}
]
}
content.js
var elements = document.getElementsByTagName('*');
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
for (var j = 0; j < element.childNodes.length; j++) {
var node = element.childNodes[j];
if (node.nodeType === 3) {
var text = node.nodeValue;
var replacedText = text.replace(/Turkiet/g, 'found');
if (replacedText !== text) {
element.replaceChild(document.createTextNode(replacedText), node);
}
}
}
}