I believe this is close JavaScript: Overriding alert() 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.
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.
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.
foo.create(t,e);
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.
oldfoocreate=foo.create;
foo.create(t,e){
alert(JSON.stringify(t) + " ? " + JSON.stringify(e));
oldfoocreate(t,e);
}
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:
this._fooBar is not a function
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.
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!