Javascript – Detecting Opinionated Text

I’m trying write a script that detects, and highlights, opinionated strings in web pages. I can highlight the text just fine, but I’m having trouble detecting the opinionated text. As an alpha version, maybe simply putting in a list of strings (ei: I think, This is, etc) and if it detects those strings, highlighting the entire sentence they’re in. I’m not sure how complicated the code will have to be to make this, but currently I’m not sure how to even test this current function because I don’t know how to execute it, to make it running every time you open a new web page. Would I put it in background.js? This code is currently in a file named algorithm.js. Thanks!

 var result;
 var scanned;
 function opinion(); {
     if (
  (
    document.documentElement.textContent || document.documentElement.innerText
  ).indexOf('I think', 'This is', 'He is', 'She is') > -1
) {
  var result = 1;
  console.log('Detected Opinion');
  return;
}