title: Trying to create a Tampermonkey userscript to wait for a randomized button pop-up during a video and auto click it
body: <p>This is the pop-up element that occurs randomly throughout the video, I'm trying to make something that will continually search for the buttonID and then left click the element to continue.</p>
  
  <pre><code>document.getElementById("overlay").innerHTML="&lt;button class="bcbutton" id="listening" type="button" tabindex="-1" onkeypress="return false;" onclick="register_click();"&gt;&lt;img src="http://stemplosion.com/eyesm.jpg/%22%3E&lt;br&gt;I am watching&lt;/button&gt;";
  </code></pre>
  
  <p>This is what I've come up with... but it's not working, yet. This is my first time working with JavaScript. Is it even ideal to go by the button id? I considered changing it to the class. Or maybe something to detect the loading of the image? </p>
  
  <pre class="lang-js prettyprint-override"><code>function autoClick() {
    let listenforit = (document.getElementById("listening"));
    console.log("AUTO CLICKING");
    if (listenforit != null) {
      console.log("AUTO CLICK FOUND LISTENING IT");
      listenforit.click();
    } else {
      console.log("DIDNT FIND IT");
    }
  }
  
  window.setInterval(function() {
    autoClick();
  }, 200);
  </code></pre>