I'm writing a chrome extension for a specific website. That website has a javascript function like this:
function showBox(someUnrelatedParameter){
// ...
$('#something').appear({duration: 0.5}};
// ...
return false;
}
And some buttons on the website have onclick="showBox(...)"
to trigger this function.
Now what I basically want to do is to speed this up, i.e. by making #something
appear in 0.1 instead of 0.5. Is it somehow possible to inject that javascript function with my chrome extension to make it use a different duration?
Otherwise, I have a somewhat fishy idea that I could try to copy that entire function from the website, and provide it in my extension like this:
function showBoxNew(someUnrelatedParameter){
// ...
$('#something').appear({duration: 0.1}};
// ...
return false;
}
And then manipulate the DOM to replace all onclick="showBox
with onclick="showBoxNew
. The problem with this is that any changes that the website might do to that function are then lost with this extension, even though I just want to change the duration.
Any better ways?