I’m trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires.
I’m using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609
This is the full script that I’m trying to modify, changing:
window.addEventListener ('load', doStuff, false);
to
window.addEventListener ('DOMContentLoaded', doStuff, false);
So I googled greasemonkey dom ready and the first result seemed to say that the greasemonkey script is actually running at ‘DOM ready’ so you just need to remove the onload call and run the script straight away.
I removed the
window.addEventListener ('load', function() {and}, false);wrapping and it worked perfectly. It’s much more responsive this way, the page appears straight away with your script applied to it and all the unseen questions highlighted, no flicker at all. And there was much rejoicing…. yea.