From 8467b8bd3393160e418a47a9150f04d6dc960f5a Mon Sep 17 00:00:00 2001 From: Oj Date: Thu, 24 Mar 2022 22:24:20 +0000 Subject: [PATCH] [MainWindow] Move themesync init to last to fix erroring half way through inject --- src/mainWindowInject.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/mainWindowInject.js b/src/mainWindowInject.js index 393e0a5..2f764f1 100644 --- a/src/mainWindowInject.js +++ b/src/mainWindowInject.js @@ -17,13 +17,8 @@ const themesync = async () => { if (value !== pastValue) DiscordNative.userDataCache.cacheUserData(JSON.stringify(cached)); }; -setInterval(() => { - try { - themesync(); - } catch (e) { } -}, 10000); -themesync(); +// Settings info version injection setInterval(() => { const host = [...document.querySelectorAll('[class^="socialLinks-"] + [class^="info-"] [class^="colorMuted-"]')].find(x => x.textContent.startsWith('Host ')); if (!host || document.querySelector('#openasar-ver')) return; @@ -54,4 +49,12 @@ el.appendChild(document.createTextNode(`[class^="socialLinks-"] + [class^="info- }`)); document.body.appendChild(el); -openasar = {}; \ No newline at end of file +openasar = {}; // Define global for any mods which want to know / etc + + +setInterval(() => { // Try init themesync + try { + themesync(); + } catch (e) { } +}, 10000); +themesync(); \ No newline at end of file