Skip to content

Instantly share code, notes, and snippets.

@pvdz
Last active December 23, 2015 10:19
Show Gist options
  • Select an option

  • Save pvdz/6620522 to your computer and use it in GitHub Desktop.

Select an option

Save pvdz/6620522 to your computer and use it in GitHub Desktop.
var t = setInterval(function(){
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 1, 0, 0, 300, 400, false, false, false, false, 0, null);
document.getElementById('bigCookie').dispatchEvent(evt);
}, 20);
var c = setInterval(function(){
if (document.getElementById('goldenCookie').style.display !== 'none') {
console.log("Clicking gold");
var evt = document.createEvent("MouseEvents");
evt.initMouseEvent("click", true, true, window, 1, 0, 0, 300, 400, false, false, false, false, 0, null);
document.getElementById('goldenCookie').dispatchEvent(evt);
}
}, 500);
@bga
Copy link
Copy Markdown

bga commented Sep 20, 2013

just .click()

@zivc
Copy link
Copy Markdown

zivc commented Sep 20, 2013

@bga u ar my hero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment