title: Executing an onclick event, without clicking.
body: <p>I'm using a script called photobooth for JavaScript where the user is supposed to click the camera icon to take a picture, but instead I want it to be code executed. Here is the snippet of code that I believe to be the photobooth take picture event. </p>
  
  <pre><code>var L = g("blind");
  g("trigger").onclick = function () {
      L.className = "blind", L.style.opacity = 1, setTimeout(function () {
          L.className = "blind anim", L.style.opacity = 0
      }, 50);
      var e = {};
      C.isActive() ? e = C.getData() : f ? e = {
          x: (p - T.videoWidth) / 2,
          y: (d - T.videoHeight) / 2,
          width: T.videoWidth,
          height: T.videoHeight
      } : e = {
          x: 0,
          y: 0,
          width: p,
          height: d
      };
      var t = y("canvas");
      t.width = e.width, t.height = e.height;
      if (f) t.getContext("2d").drawImage(T, Math.max(0, e.x - (p - T.videoWidth) / 2), Math.max(e.y - (d - T.videoHeight) / 2), e.width, e.height, 0, 0, e.width, e.height);
      else {
          var n = x.getImageData(e.x, e.y, e.width, e.height);
          t.getContext("2d").putImageData(n, 0, 0)
      }
      h.onImage(t.toDataURL())
  };
  </code></pre>
  
  <p>I would like to call that event or change it so I can call it, I'm not very good with js so any help would be great! </p>
  
  <p>here is the source: <a href="http://wolframhempel.github.io/photobooth-js" rel="nofollow">photobooth js</a></p>