Auto Cookie Clicker
This commit is contained in:
parent
29af9ccc56
commit
a3699fb789
1 changed files with 43 additions and 0 deletions
43
cookie.clicker.user.js
Normal file
43
cookie.clicker.user.js
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// ==UserScript==
|
||||
// @name Auto Cookie Clicker
|
||||
// @namespace danielrayjones
|
||||
// @description Plays Cookie Clicker for you
|
||||
// @include http://orteil.dashnet.org/cookieclicker/
|
||||
// @version 0.0.2
|
||||
// ==/UserScript==
|
||||
|
||||
let AutoClicker = {stop: false};
|
||||
unsafeWindow.AutoClicker = AutoClicker;
|
||||
|
||||
document.addEventListener('load', function () {
|
||||
'use strict';
|
||||
|
||||
let cookie = document.getElementById('bigCookie');
|
||||
let shimmers = document.getElementById('shimmers');
|
||||
|
||||
function clickCookie() {
|
||||
AutoClicker.cookie.click();
|
||||
if (!AutoClicker.stop) {
|
||||
setTimeout(clickCookie, 5);
|
||||
}
|
||||
}
|
||||
|
||||
let shimmerObserver = new MutationObserver(function (mutations) {
|
||||
mutations.forEach(function (mutation) {
|
||||
mutation.addedNodes.forEach(function (shimmer) {
|
||||
console.log('clicking', shimmer);
|
||||
shimmer.click();
|
||||
});
|
||||
})
|
||||
});
|
||||
shimmerObserver.observe(shimmers, { childList: true});
|
||||
|
||||
AutoClicker.cookie = cookie;
|
||||
AutoClicker.shimmers = shimmers;
|
||||
AutoClicker.clickCookie = clickCookie;
|
||||
AutoClicker.shimmerObserver = shimmerObserver;
|
||||
|
||||
for (let i = 0; i < 20; i++) {
|
||||
clickCookie();
|
||||
}
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue