title: Javascript Override has different this
body: <p>I believe this is close
  <a href="https://stackoverflow.com/questions/1729501/javascript-overriding-alert">JavaScript: Overriding alert()</a>
  Through all my googlefu this was the closest I could see that might relate.  The problem is I don't know exactly what the issue is only the solution I desire.</p>
  
  <p>So there's a website that I'd like to add more functionality (much needed functionality) on my client side only so I'm trying to use greasemonkey and am slowly cracking it open with Firebug.  I'm not very good at javascript, but I have years in other languages C++,C#,and java so I'm not a complete noob. </p>
  
  <p>There's a a DOM element button that is pressed and fires an event that fires another that fires another that finally fires an event that adds to a collection and most importantly the reason I think I can't get the above example to work is it takes two parameters.</p>
  
  <pre><code>foo.create(t,e);
  </code></pre>
  
  <p>I'm just trying to get in and see what's getting passed through I'd like to do more but started with just a simple alert to see what's going on.</p>
  
  <pre><code>oldfoocreate=foo.create;
  foo.create(t,e){
      alert(JSON.stringify(t) + "  ?  " + JSON.stringify(e));
      oldfoocreate(t,e);
  }
  </code></pre>
  
  <p>It works as expected on the alert I get to see the data and it is a data I expected to see however it is a very complicated web app and it fires other events ( I suppose or is expecting the event from another wrapper) because I get an error:</p>
  
  <pre><code>this._fooBar is not a function
  </code></pre>
  
  <p>I'll continue to google and try the proxy idea in different ways, but married, kids, school, and unfortunately I do manual labor for work invites me very little time for my passion.  Thank you community for the help.  </p>
  
  <p>What I'm thinking is it's expecting a wrapper of some sort an outter object calling the function???  The main reason I'm stumped is cause I said change foo.create to foo.create ohh by the way I am going from window so window.foo.create so I'm as far back as I can get.  I haven't read much on javascript this keyword so any information is also welcome!</p>