mirror of
https://github.com/zumbiepig/MineXLauncher.git
synced 2025-06-08 09:24:48 +00:00
.
This commit is contained in:
parent
814fdad0b2
commit
4daef0ece7
@ -27,16 +27,7 @@
|
||||
<input id="username-input" placeholder="Enter username" />
|
||||
<label for="theme-select">Theme:</label>
|
||||
<select id="theme-select">
|
||||
<option selected value="default">Default</option>
|
||||
<option value="light">Light</option>
|
||||
<option value="hyperdark">Hyperdark</option>
|
||||
<option value="overworld">Overworld</option>
|
||||
<option value="nether">Nether</option>
|
||||
<option value="the-end">The End</option>
|
||||
<option value="cherry-blossom">Cherry Blossom</option>
|
||||
<option value="retro">Retro</option>
|
||||
<option value="starfall">Starfall</option>
|
||||
<option value="campfire">Campfire</option>
|
||||
<option disabled selected hidden value=""></option>
|
||||
</select>
|
||||
<!-- <label for="offline-checkbox">Enable offline use:</label>
|
||||
<input type="checkbox" id="offline-checkbox" /> -->
|
||||
|
@ -7,14 +7,9 @@ const theme = {
|
||||
load: function (themeToLoad?: string) {
|
||||
const themeElement = document.getElementById('theme') as HTMLLinkElement;
|
||||
if (themeElement) {
|
||||
if (themeToLoad) {
|
||||
themeElement.href = `/resources/styles/themes/${themeToLoad}.css`;
|
||||
} else {
|
||||
const savedTheme = storage.local.get('theme');
|
||||
if (savedTheme) {
|
||||
themeElement.href = `/resources/styles/themes/${savedTheme}.css`;
|
||||
}
|
||||
}
|
||||
document.documentElement.style.display = 'none';
|
||||
themeElement.onload = () => (document.documentElement.style.display = '');
|
||||
themeElement.href = themeToLoad ? `/resources/styles/themes/${themeToLoad}.css` : `/resources/styles/themes/${storage.local.get('theme') ?? 'default'}.css`;
|
||||
}
|
||||
},
|
||||
set: function (newTheme: string) {
|
||||
@ -349,8 +344,6 @@ const base64Gzip = {
|
||||
},
|
||||
};
|
||||
|
||||
theme.load();
|
||||
|
||||
if (detect.mobile()) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
@ -366,11 +359,6 @@ if (window.location.pathname === '/') {
|
||||
|
||||
document.addEventListener('DOMContentLoaded', () => document.body.appendChild(iframe));
|
||||
|
||||
window.addEventListener('beforeinstallprompt', (event) => {
|
||||
// @ts-expect-error
|
||||
if (iframe.contentWindow) iframe.contentWindow.installPwaEvent = event;
|
||||
});
|
||||
|
||||
/* document.addEventListener('load', () => {
|
||||
if (storage.local.get('offlineCache')) {
|
||||
sw.register('/sw-full.js');
|
||||
@ -379,7 +367,21 @@ if (window.location.pathname === '/') {
|
||||
}
|
||||
}); */
|
||||
document.addEventListener('load', () => sw.register('/sw.js'));
|
||||
|
||||
window.addEventListener('beforeinstallprompt', (event) => {
|
||||
// @ts-expect-error
|
||||
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`;
|
||||
}
|
||||
});
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
const profileName = document.getElementById('profile-name');
|
||||
const titleBarText = document.getElementById('title-bar-text');
|
||||
@ -449,7 +451,7 @@ if (window.location.pathname === '/settings/') {
|
||||
if (profileName) profileName.textContent = username;
|
||||
});
|
||||
|
||||
themeSelect.addEventListener('change', () => theme.set(themeSelect.value));
|
||||
themeSelect.addEventListener('change', () => theme.set(themeSelect.value ?? 'default'));
|
||||
|
||||
/* offlineCheckbox.addEventListener('change', () => {
|
||||
storage.local.set('offlineCache', offlineCheckbox.checked);
|
||||
@ -490,7 +492,7 @@ if (window.location.pathname === '/settings/') {
|
||||
usernameInput.value = username;
|
||||
});
|
||||
|
||||
themeSelect.addEventListener('change', () => theme.load(themeSelect.value));
|
||||
themeSelect.addEventListener('change', () => theme.load(themeSelect.value ?? 'default'));
|
||||
|
||||
setupForm.addEventListener('submit', async (event) => {
|
||||
event.preventDefault();
|
||||
@ -505,7 +507,7 @@ if (window.location.pathname === '/settings/') {
|
||||
while (username.length < 3) username += '_';
|
||||
|
||||
storage.local.set('username', username);
|
||||
storage.local.set('theme', themeSelect.value);
|
||||
storage.local.set('theme', themeSelect.value ?? 'default');
|
||||
// storage.local.set('offlineCache', offlineCheckbox.checked);
|
||||
storage.local.set('showAds', true);
|
||||
storage.local.set('mods', []);
|
||||
|
@ -7,6 +7,7 @@ const cacheAssets: string[] = [
|
||||
'/resources/images/icons/favicon.webp',
|
||||
'/resources/scripts/google-tag.js',
|
||||
'/resources/scripts/main.js',
|
||||
'/resources/styles/index.css',
|
||||
'/resources/styles/mobile.css',
|
||||
'/resources/styles/themes/default.css',
|
||||
'/resources/styles/themes/light.css',
|
||||
|
Loading…
x
Reference in New Issue
Block a user