1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 08:24:50 +00:00
This commit is contained in:
zumbiepig 2024-08-21 16:12:38 -07:00
parent 99789e0018
commit e4b6eb25ac
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE
2 changed files with 27 additions and 1 deletions

View File

@ -74,6 +74,10 @@
<label for="offline-checkbox">Enable offline use:</label>
<input type="checkbox" id="offline-checkbox" />
</div> -->
<div class="settings-section">
<label for="ads-checkbox">Show ads (helps support us):</label>
<input type="checkbox" id="ads-checkbox" />
</div>
</div>
</div>
</div>

View File

@ -4,10 +4,12 @@ if (window.location.pathname === '/settings/') {
const usernameInput = document.getElementById('username-input') as HTMLInputElement;
const themeSelect = document.getElementById('theme-select') as HTMLSelectElement;
// const offlineCheckbox = document.getElementById('offline-checkbox') as HTMLInputElement;
const adsCheckbox = document.getElementById('ads-checkbox') as HTMLInputElement;
usernameInput.placeholder = storage.local.get('username') ?? '';
themeSelect.value = storage.local.get('theme') ?? '';
themeSelect.value = storage.local.get('theme') ?? 'default';
// offlineCheckbox.checked = storage.local.get('offlineCache') ?? false;
adsCheckbox.checked = storage.local.get('showAds') ?? true;
usernameInput.addEventListener('input', () => {
let username = usernameInput.value.replace(/[^A-Za-z0-9]/g, '_').substring(0, 16);
@ -37,6 +39,25 @@ if (window.location.pathname === '/settings/') {
alert('Offline cache has been deleted.');
}
}); */
adsCheckbox.addEventListener('change', () => {
if (adsCheckbox.checked === false) {
if (
prompt(
'Ads are the only source of income for this project, and they help keep the servers running.\n\nIf you really want to disable ads, join the Discord server and get the password to disable ads.'
) === 'zombie'
) {
storage.local.set('showAds', true);
alert('Ads have been disabled. Reload the page to apply the changes.');
} else {
alert('Wrong password. Join the Discord server to get the password.');
adsCheckbox.checked = true;
}
} else {
storage.local.set('showAds', true);
alert('Ads have been enabled. Thank you for supporting the project!');
}
});
});
}
@ -73,6 +94,7 @@ if (window.location.pathname === '/welcome/') {
storage.local.set('username', username);
storage.local.set('theme', themeSelect.value);
// storage.local.set('offlineCache', offlineCheckbox.checked);
storage.local.set('showAds', true);
storage.local.set('lastVersion', launcherVersion);
/* if (offlineCheckbox.checked) {