127 lines
5.5 KiB
HTML
127 lines
5.5 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>Moon Gaming</title>
|
|
<link rel="stylesheet" href="/index.css">
|
|
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@700&family=Press+Start+2P&display=swap" rel="stylesheet">
|
|
<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">
|
|
</head>
|
|
<body>
|
|
<h1>Moon Gaming</h1>
|
|
<div class="button-container">
|
|
<button class="button" onclick="location.href='setting.html'">Settings ⚙️</button>
|
|
<button class="button" onclick="location.href='./WebGames-master/WebGames-master/index.html'">Games</button>
|
|
<button class="button" id="gamesComingSoonButton" style="display: none;" onclick="location.href='./gametoadd.html'">Games Coming Soon</button>
|
|
</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;
|
|
}
|
|
|
|
// Apply dark or light mode based on cookie
|
|
function applyDarkMode(enabled) {
|
|
if (enabled) {
|
|
document.body.style.setProperty('--background-color', 'var(--background-color-dark)');
|
|
document.body.style.setProperty('--text-color', 'var(--text-color-dark)');
|
|
document.body.style.setProperty('--button-bg', 'var(--button-bg-dark)');
|
|
document.body.style.setProperty('--button-hover-bg', 'var(--button-hover-bg-dark)');
|
|
document.body.style.setProperty('--button-hover-text', 'var(--button-hover-text-dark)');
|
|
} else {
|
|
document.body.style.setProperty('--background-color', 'var(--background-color-light)');
|
|
document.body.style.setProperty('--text-color', 'var(--text-color-light)');
|
|
document.body.style.setProperty('--button-bg', 'var(--button-bg-light)');
|
|
document.body.style.setProperty('--button-hover-bg', 'var(--button-hover-bg-light)');
|
|
document.body.style.setProperty('--button-hover-text', 'var(--button-hover-text-light)');
|
|
}
|
|
}
|
|
|
|
// Ensure dark mode is the default
|
|
if (getCookie('darkMode') === null) {
|
|
setCookie('darkMode', 'true', 30); // Default to dark mode
|
|
}
|
|
|
|
// Apply saved mode on load
|
|
const darkModeEnabled = getCookie('darkMode') === 'true';
|
|
applyDarkMode(darkModeEnabled);
|
|
|
|
// Clock Functionality
|
|
function updateClock() {
|
|
const now = new Date();
|
|
const hours = String(now.getHours()).padStart(2, '0');
|
|
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
const timeString = `${hours}:${minutes}:${seconds}`;
|
|
const dateString = now.toDateString(); // Get the current date as a string
|
|
document.getElementById('clock').innerHTML = `${dateString} <br> ${timeString}`;
|
|
}
|
|
|
|
// Update the clock every second
|
|
setInterval(updateClock, 1000);
|
|
updateClock(); // Initialize clock immediately
|
|
|
|
// Ensure FPS Counter is enabled by default
|
|
if (getCookie('fpsCounter') === null) {
|
|
setCookie('fpsCounter', 'true', 30); // Default to enabled
|
|
}
|
|
|
|
// Check if FPS Counter is enabled
|
|
const fpsCounterEnabled = getCookie('fpsCounter') === 'true';
|
|
|
|
if (fpsCounterEnabled) {
|
|
const fpsCounter = document.getElementById('fpsCounter');
|
|
let lastFrameTime = performance.now();
|
|
let frames = 0;
|
|
|
|
function calculateFPS() {
|
|
const now = performance.now();
|
|
frames++;
|
|
|
|
if (now - lastFrameTime >= 1000) {
|
|
const fps = Math.round(frames / ((now - lastFrameTime) / 1000));
|
|
fpsCounter.textContent = `FPS: ${fps}`;
|
|
frames = 0;
|
|
lastFrameTime = now;
|
|
}
|
|
|
|
requestAnimationFrame(calculateFPS);
|
|
}
|
|
|
|
calculateFPS(); // Start FPS calculation
|
|
}
|
|
|
|
// Check if Date and Time is enabled
|
|
const dateTimeEnabled = getCookie('dateTime') === 'true';
|
|
|
|
if (dateTimeEnabled) {
|
|
document.getElementById('clock').style.display = 'block'; // Show the clock
|
|
}
|
|
|
|
// Check if "Games Coming Soon" is enabled
|
|
const gamesComingSoonEnabled = getCookie('gamesComingSoon') === 'true';
|
|
|
|
if (gamesComingSoonEnabled) {
|
|
document.getElementById('gamesComingSoonButton').style.display = 'inline-block'; // Show the button
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|