Skip to content

Instantly share code, notes, and snippets.

@tpenguinltg
Created April 28, 2016 12:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tpenguinltg/47d24f6eae33f052b8bf9d5ead158fb7 to your computer and use it in GitHub Desktop.
Save tpenguinltg/47d24f6eae33f052b8bf9d5ead158fb7 to your computer and use it in GitHub Desktop.
Allow pausing in e.ggtimer
// ==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