375 lines
15 KiB
HTML
375 lines
15 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<script defer src="https://chirpy.dev/bootstrapper.js" data-chirpy-domain="fun-miles-4jub.onrender.com"></script>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Settings</title>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
|
|
integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA=="
|
|
crossorigin="anonymous" referrerpolicy="no-referrer">
|
|
<link rel="stylesheet" href="settings.css">
|
|
<style>
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
margin: 0;
|
|
padding: 0;
|
|
background-color: var(--background-color, #ffffff);
|
|
color: var(--text-color, #000000);
|
|
transition: background-color 0.3s, color 0.3s;
|
|
}
|
|
|
|
.settings-container {
|
|
max-width: 600px;
|
|
margin: 50px auto;
|
|
padding: 20px;
|
|
border-radius: 10px;
|
|
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
background-color: var(--card-background-color, #f9f9f9);
|
|
}
|
|
|
|
h1 {
|
|
text-align: center;
|
|
}
|
|
|
|
.setting-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin: 20px 0;
|
|
}
|
|
|
|
.setting-item button {
|
|
padding: 10px 20px;
|
|
border: none;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
background-color: #007bff;
|
|
color: white;
|
|
font-size: 16px;
|
|
}
|
|
|
|
.setting-item button:hover {
|
|
background-color: #0056b3;
|
|
}
|
|
|
|
/* Red button for Clear Cookies */
|
|
.setting-item.clear-cookies button {
|
|
background-color: #ff4d4d;
|
|
}
|
|
|
|
.setting-item.clear-cookies button:hover {
|
|
background-color: #cc0000;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="settings-container">
|
|
<h1>Settings</h1>
|
|
<div class="setting-item">
|
|
<span>Home</span>
|
|
<a href="index.html"><button id="homeButton">Go to Home</button></a>
|
|
</div>
|
|
<div class="setting-item">
|
|
<span>Dark Mode</span>
|
|
<button id="toggleDarkMode">Enable</button>
|
|
</div>
|
|
<div class="setting-item">
|
|
<span>Enable CloakJS (comming soon)</span>
|
|
<button id="toggleCloakJS">Enable</button>
|
|
</div>
|
|
<div class="setting-item">
|
|
<span>Show FPS Counter</span>
|
|
<button id="toggleFPSCounter">Enable</button>
|
|
</div>
|
|
<div class="setting-item">
|
|
<span>Enable Maturity Filter(comming-soon)</span>
|
|
<button id="toggleMaturityFilter">Enable</button>
|
|
</div>
|
|
<div class="setting-item">
|
|
<span>Enable Text-to-Speech</span>
|
|
<button id="toggleTextToSpeech">Enable</button>
|
|
</div>
|
|
<div class="setting-item">
|
|
<span>Show Date and Time</span>
|
|
<button id="toggleDateTime">Enable</button>
|
|
</div>
|
|
<div class="setting-item">
|
|
<span>Save Search Input</span>
|
|
<button id="toggleSaveSearch">Enable</button>
|
|
</div>
|
|
<div class="setting-item clear-cookies">
|
|
<span>Clear Cookies</span>
|
|
<button id="clearCookies">Clear</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal for confirmation -->
|
|
<div id="confirmationModal" style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.5); justify-content: center; align-items: center;">
|
|
<div style="background-color: white; padding: 20px; border-radius: 10px; text-align: center; max-width: 400px; width: 90%; color: black;">
|
|
<p>Are you sure you want to clear all cookies? This will reset all your preferences and saved data.</p>
|
|
<div style="display: flex; justify-content: space-around; margin-top: 20px;">
|
|
<button id="cancelClear" style="padding: 10px 20px; background-color: #ccc; border: none; border-radius: 5px; cursor: pointer;">Cancel</button>
|
|
<button id="confirmClear" style="padding: 10px 20px; background-color: #ff4d4d; color: white; border: none; border-radius: 5px; cursor: pointer;">OK</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Utility function to set a cookie
|
|
function setCookie(name, value, days) {
|
|
const date = new Date();
|
|
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
|
document.cookie = `${name}=${value};expires=${date.toUTCString()};path=/`;
|
|
}
|
|
|
|
// Utility function to get a cookie
|
|
function getCookie(name) {
|
|
const cookies = document.cookie.split(';');
|
|
for (let i = 0; i < cookies.length; i++) {
|
|
const cookie = cookies[i].trim();
|
|
if (cookie.startsWith(name + '=')) {
|
|
return cookie.substring(name.length + 1);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Remove the toggle button from other pages
|
|
const toggleDarkModeButton = document.getElementById('toggleDarkMode');
|
|
|
|
// Ensure this button is the only one controlling dark mode
|
|
function applyDarkMode(enabled) {
|
|
if (enabled) {
|
|
document.body.style.setProperty('--background-color', '#121212');
|
|
document.body.style.setProperty('--text-color', '#ffffff');
|
|
document.body.style.setProperty('--card-background-color', '#1e1e1e');
|
|
toggleDarkModeButton.textContent = 'Disable';
|
|
} else {
|
|
document.body.style.setProperty('--background-color', '#ffffff');
|
|
document.body.style.setProperty('--text-color', '#000000');
|
|
document.body.style.setProperty('--card-background-color', '#f9f9f9');
|
|
toggleDarkModeButton.textContent = 'Enable';
|
|
}
|
|
}
|
|
|
|
toggleDarkModeButton.addEventListener('click', () => {
|
|
const isDarkMode = getCookie('darkMode') === 'true';
|
|
setCookie('darkMode', !isDarkMode, 30); // Save preference for 30 days
|
|
applyDarkMode(!isDarkMode);
|
|
});
|
|
|
|
// Apply saved dark mode preference on load
|
|
const darkModeEnabled = getCookie('darkMode') === 'true';
|
|
applyDarkMode(darkModeEnabled);
|
|
|
|
// Clear Cookies Button
|
|
const clearCookiesButton = document.getElementById('clearCookies');
|
|
const confirmationModal = document.getElementById('confirmationModal');
|
|
const cancelClearButton = document.getElementById('cancelClear');
|
|
const confirmClearButton = document.getElementById('confirmClear');
|
|
|
|
// Show confirmation modal when Clear Cookies is clicked
|
|
clearCookiesButton.addEventListener('click', () => {
|
|
confirmationModal.style.display = 'flex';
|
|
});
|
|
|
|
// Cancel clearing cookies
|
|
cancelClearButton.addEventListener('click', () => {
|
|
confirmationModal.style.display = 'none';
|
|
});
|
|
|
|
// Confirm clearing cookies
|
|
confirmClearButton.addEventListener('click', () => {
|
|
// Clear all cookies
|
|
document.cookie.split(";").forEach(cookie => {
|
|
document.cookie = cookie.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date(0).toUTCString() + ";path=/");
|
|
});
|
|
|
|
// Hide the modal
|
|
confirmationModal.style.display = 'none';
|
|
|
|
// Notify the user
|
|
alert('Cookies have been cleared!');
|
|
});
|
|
|
|
// CloakJS Toggle
|
|
const toggleCloakJSButton = document.getElementById('toggleCloakJS');
|
|
const cloakJSEnabled = getCookie('cloakJS') === 'true';
|
|
|
|
function applyCloakJSSetting(enabled) {
|
|
if (enabled) {
|
|
toggleCloakJSButton.textContent = 'Disable';
|
|
} else {
|
|
toggleCloakJSButton.textContent = 'Enable';
|
|
}
|
|
}
|
|
|
|
toggleCloakJSButton.addEventListener('click', () => {
|
|
const isCloakJSEnabled = getCookie('cloakJS') === 'true';
|
|
setCookie('cloakJS', !isCloakJSEnabled, 30); // Save preference for 30 days
|
|
applyCloakJSSetting(!isCloakJSEnabled);
|
|
});
|
|
|
|
// Apply saved CloakJS preference on load
|
|
applyCloakJSSetting(cloakJSEnabled);
|
|
|
|
// FPS Counter Toggle
|
|
const toggleFPSCounterButton = document.getElementById('toggleFPSCounter');
|
|
const fpsCounterEnabled = getCookie('fpsCounter') === 'true';
|
|
|
|
function applyFPSCounterSetting(enabled) {
|
|
if (enabled) {
|
|
toggleFPSCounterButton.textContent = 'Disable';
|
|
} else {
|
|
toggleFPSCounterButton.textContent = 'Enable';
|
|
}
|
|
}
|
|
|
|
toggleFPSCounterButton.addEventListener('click', () => {
|
|
const isFPSCounterEnabled = getCookie('fpsCounter') === 'true';
|
|
setCookie('fpsCounter', !isFPSCounterEnabled, 30); // Save preference for 30 days
|
|
applyFPSCounterSetting(!isFPSCounterEnabled);
|
|
});
|
|
|
|
// Apply saved FPS Counter preference on load
|
|
applyFPSCounterSetting(fpsCounterEnabled);
|
|
|
|
// Maturity Filter Toggle
|
|
const toggleMaturityFilterButton = document.getElementById('toggleMaturityFilter');
|
|
const maturityFilterEnabled = getCookie('maturityFilter') === 'true';
|
|
|
|
function applyMaturityFilterSetting(enabled) {
|
|
if (enabled) {
|
|
toggleMaturityFilterButton.textContent = 'Disable';
|
|
} else {
|
|
toggleMaturityFilterButton.textContent = 'Enable';
|
|
}
|
|
}
|
|
|
|
toggleMaturityFilterButton.addEventListener('click', () => {
|
|
const isMaturityFilterEnabled = getCookie('maturityFilter') === 'true';
|
|
setCookie('maturityFilter', !isMaturityFilterEnabled, 30); // Save preference for 30 days
|
|
applyMaturityFilterSetting(!isMaturityFilterEnabled);
|
|
});
|
|
|
|
// Apply saved Maturity Filter preference on load
|
|
applyMaturityFilterSetting(maturityFilterEnabled);
|
|
|
|
// Text-to-Speech Toggle
|
|
const toggleTextToSpeechButton = document.getElementById('toggleTextToSpeech');
|
|
const textToSpeechEnabled = getCookie('textToSpeech') === 'true';
|
|
|
|
function applyTextToSpeechSetting(enabled) {
|
|
if (enabled) {
|
|
toggleTextToSpeechButton.textContent = 'Disable';
|
|
} else {
|
|
toggleTextToSpeechButton.textContent = 'Enable';
|
|
}
|
|
}
|
|
|
|
toggleTextToSpeechButton.addEventListener('click', () => {
|
|
const isTextToSpeechEnabled = getCookie('textToSpeech') === 'true';
|
|
setCookie('textToSpeech', !isTextToSpeechEnabled, 30); // Save preference for 30 days
|
|
applyTextToSpeechSetting(!isTextToSpeechEnabled);
|
|
});
|
|
|
|
// Apply saved Text-to-Speech preference on load
|
|
applyTextToSpeechSetting(textToSpeechEnabled);
|
|
|
|
// Date and Time Toggle
|
|
const toggleDateTimeButton = document.getElementById('toggleDateTime');
|
|
const dateTimeEnabled = getCookie('dateTime') === 'true';
|
|
|
|
function applyDateTimeSetting(enabled) {
|
|
if (enabled) {
|
|
toggleDateTimeButton.textContent = 'Disable';
|
|
} else {
|
|
toggleDateTimeButton.textContent = 'Enable';
|
|
}
|
|
}
|
|
|
|
toggleDateTimeButton.addEventListener('click', () => {
|
|
const isDateTimeEnabled = getCookie('dateTime') === 'true';
|
|
setCookie('dateTime', !isDateTimeEnabled, 30); // Save preference for 30 days
|
|
applyDateTimeSetting(!isDateTimeEnabled);
|
|
});
|
|
|
|
// Apply saved Date and Time preference on load
|
|
applyDateTimeSetting(dateTimeEnabled);
|
|
|
|
// Games Coming Soon Toggle
|
|
const toggleGamesComingSoonButton = document.getElementById('toggleGamesComingSoon');
|
|
const gamesComingSoonEnabled = getCookie('gamesComingSoon') === 'true';
|
|
|
|
function applyGamesComingSoonSetting(enabled) {
|
|
if (enabled) {
|
|
toggleGamesComingSoonButton.textContent = 'Disable';
|
|
} else {
|
|
toggleGamesComingSoonButton.textContent = 'Enable';
|
|
}
|
|
}
|
|
|
|
toggleGamesComingSoonButton.addEventListener('click', () => {
|
|
const isGamesComingSoonEnabled = getCookie('gamesComingSoon') === 'true';
|
|
setCookie('gamesComingSoon', !isGamesComingSoonEnabled, 30); // Save preference for 30 days
|
|
applyGamesComingSoonSetting(!isGamesComingSoonEnabled);
|
|
});
|
|
|
|
// Apply saved Games Coming Soon preference on load
|
|
applyGamesComingSoonSetting(gamesComingSoonEnabled);
|
|
|
|
|
|
// Regional Settings
|
|
const regionSelect = document.getElementById('regionSelect');
|
|
const savedRegion = getCookie('region') || 'us'; // Default to 'us'
|
|
|
|
// Set the dropdown to the saved region
|
|
regionSelect.value = savedRegion;
|
|
|
|
// Save the selected region when changed
|
|
regionSelect.addEventListener('change', () => {
|
|
const selectedRegion = regionSelect.value;
|
|
setCookie('region', selectedRegion, 30); // Save preference for 30 days
|
|
alert(`Region set to: ${selectedRegion.toUpperCase()}`);
|
|
});
|
|
|
|
const region = getCookie('region') || 'us'; // Default to 'us'
|
|
|
|
// Example: Load regional content
|
|
if (region === 'fr') {
|
|
document.body.innerHTML += '<p>Bienvenue! (Welcome in French)</p>';
|
|
} else if (region === 'de') {
|
|
document.body.innerHTML += '<p>Willkommen! (Welcome in German)</p>';
|
|
} else if (region === 'jp') {
|
|
document.body.innerHTML += '<p>ようこそ! (Welcome in Japanese)</p>';
|
|
} else {
|
|
document.body.innerHTML += '<p>Welcome!</p>';
|
|
}
|
|
|
|
// Reset to Default Settings
|
|
const resetSettingsButton = document.getElementById('resetSettings');
|
|
|
|
resetSettingsButton.addEventListener('click', () => {
|
|
// Clear all cookies
|
|
document.cookie.split(";").forEach(cookie => {
|
|
document.cookie = cookie.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date(0).toUTCString() + ";path=/");
|
|
});
|
|
|
|
// Reset UI elements to default states
|
|
applyDarkMode(false); // Default: Light mode
|
|
applyCloakJSSetting(false); // Default: CloakJS disabled
|
|
applyFPSCounterSetting(false); // Default: FPS Counter disabled
|
|
applyMaturityFilterSetting(false); // Default: Maturity Filter disabled
|
|
applyTextToSpeechSetting(false); // Default: Text-to-Speech disabled
|
|
applyDateTimeSetting(false); // Default: Date and Time disabled
|
|
applyGamesComingSoonSetting(false); // Default: Games Coming Soon disabled
|
|
|
|
alert('Settings have been reset to default!');
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |