Delay function with greasemonkey

Posted by Riccardo on Stack Overflow See other posts from Stack Overflow or by Riccardo
Published on 2011-11-27T16:46:32Z Indexed on 2011/11/27 17:50 UTC
Read the original article Hit count: 246

Filed under:
|

I need a code that when CheckForZero happens for the first time, after 30 seconds happens again.

var waitForZeroInterval = setInterval (CheckForZero, 0);

function CheckForZero ()
{
    if ( (unsafeWindow.seconds == 0)  &&  (unsafeWindow.milisec == 0) )
    {
        clearInterval (waitForZeroInterval);

        var targButton  = document.getElementById ('bottone1799');
        var clickEvent  = document.createEvent ('MouseEvents');

        clickEvent.initEvent ('click', true, true);
        targButton.dispatchEvent (clickEvent);
    }
};

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about greasemonkey