
There are two immediately invoked function expressions to demonstrate different scopes. const hijackedInterval = tInterval īelow is a demo. Caution should be taken when using this because if there is an interval that is never cleared and it performs memory intensive tasks then it could crash your browser/computer. The below will hijack setInterval and cause intervals to run (as close as possible to) immediately. I don't think such a complex solution is necessary for what you want here, so let's just manipulate the timer by hijacking it. Take a look at sinonjs/fake-timers for what complexity could be involved. If not, then you may need to manipulate the timer.

If they've declared it in the global scope doing c = -1 should work. This is only really possible if the website author has declared sec in the global scope. You'll need to find if it's possible to make manipulations in the same scope as where sec is declared by the website. As a result you're not setting the value on the same sec. The likely problem is the declaration of sec is in a different scope to the sec declared in the website's script. So can either of those be done? If so, how can you do it? change the countDown milliseconds from 1150 to 0.I think any of these two methods would work, but not sure how to do it: So far I have tried the following but didn't work: // =/UserScript= (a few items were substituted with 'REMOVE' but should not have effect I don't think) This is the JavaScript from the page source: var sec = 60, sInt, s = 'Please wait %s before downloading.' ĭ.html(s.replace('%s', sec +' second'+ (sec != 1 ? 's' : ''))) I'm trying to bypass a 60 second countdown timer using Tampermonkey.
