Make a Userscript and Refer the README to It

Tested and works with Greasemonkey, Tampermonkey, and Violentmonkey.
This commit is contained in:
mason1920
2021-02-02 05:25:42 -05:00
parent 9e21fc8586
commit 769f7f18dd
2 changed files with 20 additions and 21 deletions

View File

@@ -51,27 +51,7 @@ If (for some reason) the above doesn't work, trying pasting everything after the
### Userscript ### Userscript
If you'd rather use the addon as a script via per example *Greasemonkey* or *Tampermonkey*, you can use the following script, which will automatically load *Cookie Monster* every time the original game loads. You may need to specify <code>http://orteil.dashnet.org/cookieclicker/</code> when asked for a *namespace* or *includes*. For how to add an userscript to your browser, refer to your browser/plugin's documentation as the method changes for each one. If you'd rather use the addon as a [userscript](https://en.wikipedia.org/wiki/Userscript) to automatically load *Cookie Monster* every time the original game loads, install the `cookie-monster.user.js` file.
```javascript
// ==UserScript==
// @name Cookie Monster
// @namespace Cookie
// @include http://orteil.dashnet.org/cookieclicker/
// @include https://orteil.dashnet.org/cookieclicker/
// @version 1
// @grant none
// ==/UserScript==
(function() {
const checkReady = setInterval(function() {
if (typeof Game.ready !== 'undefined' && Game.ready) {
Game.LoadMod('https://aktanusa.github.io/CookieMonster/CookieMonster.js');
clearInterval(checkReady);
}
}, 1000);
})();
```
## Bugs and suggestions ## Bugs and suggestions

19
cookie-monster.user.js Normal file
View File

@@ -0,0 +1,19 @@
// ==UserScript==
// @name Cookie Monster
// @include /https?://orteil.dashnet.org/cookieclicker/
// ==/UserScript==
const readyCheck = setInterval(() => {
const Game = unsafeWindow.Game;
if (
typeof Game !== "undefined" &&
typeof Game.ready !== "undefined" &&
Game.ready
) {
Game.LoadMod(
"https://aktanusa.github.io/CookieMonster/CookieMonster.js"
);
clearInterval(readyCheck);
}
}, 1000);