Created
April 28, 2016 12:59
-
-
Save tpenguinltg/47d24f6eae33f052b8bf9d5ead158fb7 to your computer and use it in GitHub Desktop.
Allow pausing in e.ggtimer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name E.ggtimer pause | |
// @namespace tpenguinltg | |
// @description Enables pausing and resuming E.ggtimer by clicking the page | |
// @include http://e.ggtimer.com/* | |
// @version 1.0.0 | |
// @grant none | |
// ==/UserScript== | |
Egg.pause = function() { | |
if (Egg.progress == 1) { | |
location.reload(); | |
return; | |
} | |
Egg.pauseTime = new Date().getTime(); | |
clearInterval(Egg.ticker); | |
document.body.onclick = Egg.resume; | |
} | |
Egg.resume = function() { | |
var now = new Date().getTime(); | |
var offset = now - Egg.pauseTime; | |
Egg.startTime += offset; | |
Egg.endTime += offset; | |
Egg.ticker = Egg.ticker = setInterval(Egg.update, 1e3 / 4) | |
document.body.onclick = Egg.pause; | |
} | |
document.body.onclick = Egg.pause; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment