Reputation: 1197
(This is perhaps better checked with Facebook page.)
The Facebook page has a function
onclick="return fc_click(this);"
bound to any comment.
If someone clicks on a comment as above, I want to let it execute the above function. But also above that I wish to capture this function itself, for further action. Is it possible?
Upvotes: 0
Views: 164
Reputation: 163488
What you are looking for is called "monkey patching" or "duck punching". Basically, you replace that function fc_click()
with your own, and then call fc_click()
.
var old_fc_click = fc_click;
fc_click = function (thisVal) {
var result = old_fc_click.call(this, thisVal);
console.log(result);
}
Now, this won't work so great for Facebook unless you are making a browser extension, but that is the general idea.
Upvotes: 3