From 769f7f18dd2e148c887d696cf9b53dd411d7dfa9 Mon Sep 17 00:00:00 2001 From: mason1920 Date: Tue, 2 Feb 2021 05:25:42 -0500 Subject: [PATCH 1/3] Make a Userscript and Refer the README to It Tested and works with Greasemonkey, Tampermonkey, and Violentmonkey. --- README.md | 22 +--------------------- cookie-monster.user.js | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 cookie-monster.user.js diff --git a/README.md b/README.md index 9bac6e9..32e89ab 100644 --- a/README.md +++ b/README.md @@ -51,27 +51,7 @@ If (for some reason) the above doesn't work, trying pasting everything after the ### 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 http://orteil.dashnet.org/cookieclicker/ 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. - -```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); -})(); -``` +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. ## Bugs and suggestions diff --git a/cookie-monster.user.js b/cookie-monster.user.js new file mode 100644 index 0000000..a75d648 --- /dev/null +++ b/cookie-monster.user.js @@ -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); From f6461642e98b8480e6eb59d749cb173ac06f459a Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Wed, 3 Feb 2021 08:03:28 +0100 Subject: [PATCH 2/3] Update README.md with instruction for userscript --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 32e89ab..338c298 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ If (for some reason) the above doesn't work, trying pasting everything after the ### Userscript -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. +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. You can do this by clicking on the file in the file-list and clicking "raw". ## Bugs and suggestions From e9d7fc800ff04cfbe7f97068cdb1d6045385af1f Mon Sep 17 00:00:00 2001 From: DanielNoord Date: Wed, 3 Feb 2021 08:04:47 +0100 Subject: [PATCH 3/3] Rename cookie-monster.user.js to CookieMonster.user.js --- cookie-monster.user.js => CookieMonster.user.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cookie-monster.user.js => CookieMonster.user.js (100%) diff --git a/cookie-monster.user.js b/CookieMonster.user.js similarity index 100% rename from cookie-monster.user.js rename to CookieMonster.user.js