I'm trying to write a Greasemonkey script that works with Gmail. I know how to create javascript that reacts to the user clicking on the Inbox link or the the Refresh link. My problem is that Gmail periodically refreshes the inbox with new conversations and I have no way of capturing this event. Is there any way to capture periodical Ajax events in javascript?
You could try replacing the window.setTimeout
function (and possibly window.setInterval
) with your own functions:
window._setTimeout = window.setTimeout;
window.setTimeout = function(func, delay) {
return window._setTimeout(function() {
// Your code goes here, before the client function is called
alert('A timeout event just fired!');
if (typeof func == 'string') {
eval(func);
} else {
func();
}
}, delay);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With