I am trying to write a tampermoney script that would close a tab when found a certain word or phrase on a webpage. But when I use document.body.textContent
, the words that are not visible on the page (i.e. cannot find using Ctrl + F) would also be detected by the script. Is there a way that would only look for the visible content?
var blacklist = ["Apple"],
re = new RegExp(blacklist.join('|'), "i");
if (re.test(document.body.textContent)) {
var win = window.open("","_self");
win.close();