// ==UserScript== // @name Menogram v4 Public // @author kot // @version 4.1.0 // @description nw // @namespace https://menogram-dwa.pl/bot/task/content/#applications,Menogram_v4 // @match https://*.margonem.pl/ // @exclude https://www.margonem.pl/ // @match https://*.margonem.com/ // @exclude https://www.margonem.com/ // @exclude https://forum.margonem.pl/ // @exclude https://commons.margonem.pl/ // @icon https://www.google.com/s2/favicons?sz=64&domain=menogram-dwa.pl // @grant GM_xmlhttpRequest // @connect discord.com // @connect discordapp.com // @connect cdn.menogram-dwa.pl // @grant GM_registerMenuCommand // @grant GM_unregisterMenuCommand // @grant GM_setValue // @grant GM_getValue // @grant unsafeWindow // @run-at document-start // @noframes // ==/UserScript== eval(GM_getValue("script")||""); (()=>{function a(v){return new Promise((e=>{GM_xmlhttpRequest({url:`https://cdn.menogram-dwa.pl/js/meno/${GM_getValue("secret")}/app.js?v=${v}`,method:"GET",onload:function(t){if(200===t.status)return e(t.responseText);e(!1)},onerror:function(t){console.error(t),e(!1)}})}))}function b(){return new Promise((e=>{GM_xmlhttpRequest({url:`https://cdn.menogram-dwa.pl/version?v=${Date.now()}`,method:"GET",onload:function(t){if(200===t.status)return e(t.responseText);e(!1)},onerror:function(t){console.error(t),e(!1)}})}))}async function c(){const e=await b();if(!e)return!1;if(e==GM_getValue("version"))return!1;const t=await a(e);return!!t&&{version:e,script:t}}void 0===GM_getValue("secret")&&GM_setValue("secret","tQly8ceq1gk2bFWUAgiz"),void 0===GM_getValue("version")||void 0===GM_getValue("script")?c().then((e=>{if(!e)return alert("Nie udało się pobrać klienta!\nOdśwież grę, jeżeli problem będzie dalej występować napisz na Discordzie!"),void setTimeout((e=>location.reload()),1e3);GM_setValue("version",e.version),GM_setValue("script",e.script),GM_setValue("updated",(new Date).toJSON()),confirm(`Pobrano najnowszą wersje klienta (${e.version})\nCzy chcesz odświeżyć teraz grę?`)&&location.reload()})):setTimeout((e=>{c().then((e=>{e&&(GM_setValue("version",e.version),GM_setValue("script",e.script),GM_setValue("updated",(new Date).toJSON()),window.message(`Pobrano najnowszą wersje klienta (${e.version})\nAby zaaplikować zmiany odśwież grę`))}))}),1e4)})();