2018-10-03 08:25:05 -05:00
|
|
|
// ==UserScript==
|
|
|
|
|
// @name Auto Cookie Clicker
|
|
|
|
|
// @namespace danielrayjones
|
|
|
|
|
// @description Plays Cookie Clicker for you
|
|
|
|
|
// @include http://orteil.dashnet.org/cookieclicker/
|
2020-06-05 14:48:01 -05:00
|
|
|
// @version 0.0.4
|
2018-10-03 08:25:05 -05:00
|
|
|
// ==/UserScript==
|
|
|
|
|
|
2020-06-05 14:48:01 -05:00
|
|
|
/* jshint esversion: 6 */
|
|
|
|
|
|
2018-10-03 08:25:05 -05:00
|
|
|
let AutoClicker = {stop: false};
|
|
|
|
|
unsafeWindow.AutoClicker = AutoClicker;
|
|
|
|
|
|
2018-10-03 08:26:09 -05:00
|
|
|
window.addEventListener('load', function () {
|
2018-10-03 08:25:05 -05:00
|
|
|
'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();
|
|
|
|
|
});
|
2020-06-05 14:48:01 -05:00
|
|
|
});
|
2018-10-03 08:25:05 -05:00
|
|
|
});
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
});
|