avatar
Untitled

Guest 97 8th Jul, 2024

MARKUP 3.76 KB
                                           
                         ===================================================================
--- Bieżąca wersja
+++ Nowa wersja
@@ -1,22 +1,20 @@
 // ==UserScript==
 // @name         Gargonem - dodatki Priweejta
 // @namespace    http://tampermonkey.net/
-// @version      0.6
+// @version      0.3
 // @description  Zestaw dodatków do nowego i starego interfejsu w grze Margonem
 // @author       Priw8
 // @match        https://*.margonem.pl/
 // @exclude      https://www.margonem.pl/
 // @icon         https://www.google.com/s2/favicons?sz=64&domain=margonem.pl
 // @grant        GM_setValue
 // @grant        GM_getValue
 // @grant        GM_deleteValue
-// @grant        GM_listValues
 // @grant        unsafeWindow
 // ==/UserScript==
 
 !function() {
-    const version = 0.6;
     const window = unsafeWindow;
 
     const gargonemMainSrc = "https://priw8.com/margo/gargonem/dist/main.js";
 
@@ -56,10 +54,8 @@
         if (gmPrivilegedScripts.includes(src)) {
             $script.GM_setValue = GM_setValue;
             $script.GM_getValue = GM_getValue;
             $script.GM_deleteValue = GM_deleteValue;
-            $script.GM_listValues = GM_listValues;
-            $script.loaderVersion = version;
             $script.gargonem = true;
             $script.addScript = addScript;
         }
         $script.src = `${src}?v=${scriptVersion}`;
@@ -74,36 +70,13 @@
     function addScript(src) {
         scriptsToLoad.push(src);
     }
 
-    function firefoxFix_waitUntilFullyLoaded() {
-        // On firefox, the userscript may somehow be executed while Engine exists but not Engine.communication
-        if (interfaceKind == InterfaceKind.NEW && typeof window.Engine.communication == "undefined") {
-            return new Promise(resolve => {
-                Object.defineProperty(window.Engine, "communication", {
-                    get() {
-                        return null;
-                    },
-                    set(v) {
-                        console.log(`[GargonemFirefoxFix]: Engine.communication loaded`);
-                        delete window.Engine.communication;
-                        window.Engine.communication = v;
-                        resolve();
-                        return true;
-                    },
-                    configurable: true
-                })
-            });
-        }
-    }
-
     let overwrittenFunction = null;
     let overwrittenFunctionThis = null;
     let overwrittenFunctionArgs = null;
     let wasOverwrittenFunctionCalled = false;
-    async function beginLoading() {
-        await firefoxFix_waitUntilFullyLoaded();
-
+    function beginLoading() {
         // Block game loading until all scripts are loaded
         if (interfaceKind == InterfaceKind.OLD) {
             overwrittenFunction = window.startGame;
             window.startGame = function() {
@@ -138,13 +111,11 @@
     async function loadBatch() {
         if (scriptsToLoad.length) {
             const toLoad = scriptsToLoad.splice(0, scriptsToLoad.length);
             const results = await Promise.allSettled(toLoad.map(loadScript));
-            for (let i=0; i<results.length; ++i) {
-                const res = results[i];
+            for (const res of results) {
                 if (res.status == "rejected") {
-                    const url = toLoad[i];
-                    console.error(`script load error for ${url}; an error message detailing the failure may be displayed above`);
+                    console.error(`script load error: ${res.reason.toString()}`);
                 }
             }
             loadBatch();
         } else {
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM