From 43b52601ad73412aa878c204d628e5308079b927 Mon Sep 17 00:00:00 2001
From: zumbiepig <121742281+zumbiepig@users.noreply.github.com>
Date: Wed, 21 Aug 2024 16:12:38 -0700
Subject: [PATCH] .
---
public/settings/index.html | 4 ++++
src/resources/scripts/settings.ts | 24 +++++++++++++++++++++++-
2 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/public/settings/index.html b/public/settings/index.html
index 060f64b..be16c77 100644
--- a/public/settings/index.html
+++ b/public/settings/index.html
@@ -74,6 +74,10 @@
-->
+
+
+
+
diff --git a/src/resources/scripts/settings.ts b/src/resources/scripts/settings.ts
index 9148c36..5e441ea 100644
--- a/src/resources/scripts/settings.ts
+++ b/src/resources/scripts/settings.ts
@@ -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) {