Skip to content

Instantly share code, notes, and snippets.

@jimbuck
Last active August 29, 2015 14:05
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 jimbuck/4a6d73adece07bca4eae to your computer and use it in GitHub Desktop.
Save jimbuck/4a6d73adece07bca4eae to your computer and use it in GitHub Desktop.
AutoCookieClicker
//javascript:
(function(){
var bigCookie = document.getElementById('bigCookie');
var cookieClickers;
if(Notification.permission !== 'granted'){
Notification.requestPermission( function(status) {
enableNotifications();
});
} else {
enableNotifications();
}
function enableNotifications(){
if(window.cookieNotificationsEnabled) return;
setInterval(function(){
if(getComputedStyle(document.getElementById('goldenCookie')).display !== 'none')
{
window.cookieNotification = new Notification("Golden Cookie Appeared!", {
body:'Let me click that for you!',
icon:'http://orteil.dashnet.org/cookieclicker/favicon.ico'
});
document.getElementById('goldenCookie').click()
} else if(window.cookieNotification) {
window.cookieNotification.close();
}
},3000);
window.cookieNotificationsEnabled = true;
}
var numOfClickers = parseInt(prompt('How many clickers?') || 1000);
if(numOfClickers === 0 && cookieClickers){
for(var i=0;i<cookieClickers.length;i++){
clearInterval(cookieClickers[i]);
}
cookieClickers = null;
return;
}
cookieClickers = [];
for(var i=0;i<numOfClickers;i++){
cookieClickers.push(
setInterval(function(){
bigCookie.click()
}, 1)
);
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment