From 71388411b5b04ae4ab245d737a19b1702bd2592b Mon Sep 17 00:00:00 2001 From: Aktanusa Date: Sun, 4 Mar 2018 18:15:32 -0500 Subject: [PATCH] Fixed Issues #153 and #158. Thanks to @Pantalaim0n and @CrackedP0t for the suggestion with the use of unsafeWindow but I rather use @cpeter256 version with window.eval instead. --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index de05f72..c22627c 100644 --- a/README.md +++ b/README.md @@ -81,14 +81,16 @@ If you'd rather use the addon as a script via per example *Greasemonkey* or *Tam // @grant none // ==/UserScript== -(function() { +var code = "(" + (function() { var checkReady = setInterval(function() { if (typeof Game.ready !== 'undefined' && Game.ready) { - Game.LoadMod('https://aktanusa.github.io/CookieMonster/CookieMonster.js'); + Game.LoadMod('http://aktanusa.github.io/CookieMonster/CookieMonster.js'); clearInterval(checkReady); } }, 1000); -})(); +}).toString() + ")()"; + +window.eval(code); ``` If you are using the beta, use this instead: @@ -101,14 +103,16 @@ If you are using the beta, use this instead: // @grant none // ==/UserScript== -(function() { +var code = "(" + (function() { var checkReady = setInterval(function() { if (typeof Game.ready !== 'undefined' && Game.ready) { Game.LoadMod('https://aktanusa.github.io/CookieMonster/CookieMonsterBeta.js'); clearInterval(checkReady); } }, 1000); -})(); +}).toString() + ")()"; + +window.eval(code); ``` # Bugs and suggestions