From 2597e40ba1f10f2599b8e9317802d30d7ae8133f Mon Sep 17 00:00:00 2001 From: zumbiepig <121742281+zumbiepig@users.noreply.github.com> Date: Tue, 3 Sep 2024 20:35:52 -0700 Subject: [PATCH] fix the bug where the theme flickers --- public/404.html | 4 ++-- public/home/archive/index.html | 4 ++-- public/home/clients/index.html | 4 ++-- public/home/downloads/index.html | 4 ++-- public/home/game/index.html | 4 ++-- public/mobile/index.html | 4 ++-- public/mods/mods/index.html | 4 ++-- public/mods/resourcepacks/index.html | 4 ++-- public/offline.html | 4 ++-- public/servers/index.html | 4 ++-- public/settings/index.html | 4 ++-- public/updates/index.html | 4 ++-- public/welcome/index.html | 4 ++-- src/resources/scripts/main.ts | 9 +-------- 14 files changed, 27 insertions(+), 34 deletions(-) diff --git a/public/404.html b/public/404.html index f7e185e..908c16d 100644 --- a/public/404.html +++ b/public/404.html @@ -6,12 +6,12 @@ MineXLauncher - + - +
diff --git a/public/home/archive/index.html b/public/home/archive/index.html index b054d1e..6492c25 100644 --- a/public/home/archive/index.html +++ b/public/home/archive/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/home/clients/index.html b/public/home/clients/index.html index 5960c2f..e1d62a6 100644 --- a/public/home/clients/index.html +++ b/public/home/clients/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/home/downloads/index.html b/public/home/downloads/index.html index e2ca31a..4b62449 100644 --- a/public/home/downloads/index.html +++ b/public/home/downloads/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/home/game/index.html b/public/home/game/index.html index 3c05956..c02d0c5 100644 --- a/public/home/game/index.html +++ b/public/home/game/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/mobile/index.html b/public/mobile/index.html index 77f2a4a..3396ff8 100644 --- a/public/mobile/index.html +++ b/public/mobile/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
MineXLauncher diff --git a/public/mods/mods/index.html b/public/mods/mods/index.html index 94485cd..92d58dd 100644 --- a/public/mods/mods/index.html +++ b/public/mods/mods/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/mods/resourcepacks/index.html b/public/mods/resourcepacks/index.html index 334baaa..201d096 100644 --- a/public/mods/resourcepacks/index.html +++ b/public/mods/resourcepacks/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/offline.html b/public/offline.html index ccaf436..e69121d 100644 --- a/public/offline.html +++ b/public/offline.html @@ -6,12 +6,12 @@ MineXLauncher - + - +
diff --git a/public/servers/index.html b/public/servers/index.html index 530a54a..1cbd842 100644 --- a/public/servers/index.html +++ b/public/servers/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/settings/index.html b/public/settings/index.html index a48e50a..10001ef 100644 --- a/public/settings/index.html +++ b/public/settings/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/updates/index.html b/public/updates/index.html index 44a668b..ba863fd 100644 --- a/public/updates/index.html +++ b/public/updates/index.html @@ -6,11 +6,11 @@ MineXLauncher - + - +
diff --git a/public/welcome/index.html b/public/welcome/index.html index 8bea348..cc3bcb9 100644 --- a/public/welcome/index.html +++ b/public/welcome/index.html @@ -6,12 +6,12 @@ MineXLauncher - + - +
MineXLauncher diff --git a/src/resources/scripts/main.ts b/src/resources/scripts/main.ts index 92c75f0..d5649d6 100644 --- a/src/resources/scripts/main.ts +++ b/src/resources/scripts/main.ts @@ -369,14 +369,7 @@ if (window.location.pathname === '/') { if (iframe.contentWindow) iframe.contentWindow.installPwaEvent = event; }); } else { - document.addEventListener('DOMContentLoaded', () => { - const themeElement = document.getElementById('theme') as HTMLLinkElement; - if (themeElement) { - document.documentElement.style.display = 'none'; - themeElement.onload = () => (document.documentElement.style.display = ''); - themeElement.href = `/resources/styles/themes/${storage.local.get('theme') ?? 'default'}.css`; - } - }); + theme.load(); document.addEventListener('DOMContentLoaded', async () => { const profileName = document.getElementById('profile-name');