Files
moon-gaming/index.html
T

325 lines
13 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">
<script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
<style>
:root {
/* Light mode variables */
--background-color-light: #ffffff;
--text-color-light: #333333;
--button-bg-light: #f0f0f0;
--button-hover-bg-light: #333333;
--button-hover-text-light: #ffffff;
/* Dark mode variables (consistent with WebGames-master) */
--background-color-dark: #0d0d0d;
--text-color-dark: #00ffcc;
--button-bg-dark: #1a1a1a;
--button-hover-bg-dark: #00ffcc;
--button-hover-text-dark: #0d0d0d;
}
body {
margin: 0;
padding: 0;
background-color: var(--background-color);
color: var(--text-color);
font-family: 'Orbitron', sans-serif;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
transition: background-color 0.3s, color 0.3s;
}
h1 {
font-size: 3rem;
text-transform: uppercase;
animation: glow 1.5s infinite alternate;
}
@keyframes glow {
from {
text-shadow: 0 0 10px var(--text-color), 0 0 20px var(--text-color), 0 0 30px var(--text-color), 0 0 40px var(--text-color);
}
to {
text-shadow: 0 0 20px var(--text-color), 0 0 30px var(--text-color), 0 0 40px var(--text-color), 0 0 50px var(--text-color);
}
}
.button-container {
display: flex;
gap: 20px;
margin-top: 20px;
}
.button {
padding: 15px 30px;
font-size: 1.2rem;
font-family: 'Press Start 2P', cursive;
color: var(--text-color);
background-color: var(--button-bg);
border: 2px solid var(--text-color);
border-radius: 5px;
cursor: pointer;
text-transform: uppercase;
transition: background-color 0.3s, color 0.3s, transform 0.2s;
}
.button:hover {
background-color: var(--button-hover-bg);
color: var(--button-hover-text);
transform: scale(1.1);
}
.button:active {
transform: scale(0.95);
}
.calendar-button {
position: absolute;
top: 10px;
right: 10px;
padding: 10px 15px;
background-color: var(--button-bg);
color: var(--text-color);
border: 2px solid var(--text-color);
border-radius: 5px;
font-size: 14px;
cursor: pointer;
transition: background-color 0.3s ease, color 0.3s ease;
}
.calendar-button:hover {
background-color: var(--button-hover-bg);
color: var(--button-hover-text);
}
</style>
</head>
<body>
<h1 style="opacity: 0;">Moon Gaming</h1>
<div class="button-container" style="opacity: 0;">
<button class="button" onclick="location.href='chatroom.html'">Chatroom</button>
<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" onclick="location.href='./gametoadd.html'">Coming Soon</button>
</div>
<button class="calendar-button" style="opacity: 0;" onclick="location.href='cal.html'">Calendar</button>
<!-- Add a clock element to display date and time -->
<div id="clock" style="opacity: 0; font-size: 1.5rem; margin-top: 20px;"></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;
}
// Ensure animations are enabled by default
if (getCookie('gameAnimation') === null) {
setCookie('gameAnimation', 'true', 30); // Default to animations enabled
}
// Function to make everything visible if animations are turned off
function makeEverythingVisible() {
// Make the title visible
const title = document.querySelector('h1');
if (title) {
title.style.opacity = '1'; // Ensure the title is fully visible
title.style.transform = 'none';
}
// Make all buttons visible
const buttons = document.querySelectorAll('.button, .calendar-button, .button-container');
buttons.forEach(button => {
button.style.opacity = '1'; // Ensure the button is fully visible
button.style.transform = 'none'; // Reset any transform styles
button.style.display = 'inline-block'; // Ensure the button is displayed
});
// Make the clock visible
const clockElement = document.getElementById('clock');
if (clockElement) {
clockElement.style.opacity = '1'; // Ensure the clock is fully visible
clockElement.style.transform = 'none'; // Reset any transform styles
clockElement.style.display = 'block'; // Ensure the clock is displayed
}
}
// Function to update the clock
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();
document.getElementById('clock').innerHTML = `${dateString} <br> ${timeString}`;
}
// Function to animate the clock
function animateClock() {
anime({
targets: '#clock',
opacity: [0, 1], // Fade in
translateY: [-20, 0], // Slide down slightly
duration: 1000, // Animation duration
easing: 'easeOutExpo', // Smooth easing
});
}
// Function to animate the title and buttons
function animatePage() {
// Animate the title
anime({
targets: 'h1',
opacity: [0, 1], // Fade in
translateY: [-50, 0], // Slide down
duration: 1000, // Animation duration
easing: 'easeOutExpo', // Smooth easing
});
// Animate the buttons
anime({
targets: '.button-container, .calendar-button',
opacity: [0, 1], // Fade in
translateY: [50, 0], // Slide up
delay: anime.stagger(200), // Stagger animation for each button
duration: 800, // Animation duration
easing: 'easeOutExpo', // Smooth easing
complete: () => {
// Animate the clock after the buttons finish animating
if (dateTimeEnabled) {
const clockElement = document.getElementById('clock');
clockElement.style.display = 'block'; // Ensure the clock is visible
animateClock(); // Trigger the clock animation
setInterval(updateClock, 1000); // Start updating the clock every second
updateClock(); // Initialize the clock immediately
}
},
});
}
// Wait for the page to fully load
window.onload = () => {
// Check if Game Animation is enabled
const gameAnimationEnabled = getCookie('gameAnimation') === 'true';
if (gameAnimationEnabled) {
animatePage();
} else {
// If animations are disabled, make everything visible
makeEverythingVisible();
}
// Check if Less Buttons is enabled
const lessButtonsEnabled = getCookie('lessButtons') === 'true';
if (lessButtonsEnabled) {
// Hide the specified buttons
document.querySelector("button[onclick*='chatroom.html']").style.display = 'none'; // Chatroom button
document.querySelector("button[onclick*='cal.html']").style.display = 'none'; // Calendar button
document.querySelector("button[onclick*='gametoadd.html']").style.display = 'none'; // Coming Soon button
}
};
// Check if Date and Time is enabled
const dateTimeEnabled = getCookie('dateTime') === 'true';
// 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);
// 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 "Games Coming Soon" is enabled
const gamesComingSoonEnabled = getCookie('gamesComingSoon') === 'true';
if (gamesComingSoonEnabled) {
document.getElementById('gamesComingSoonButton').style.display = 'inline-block'; // Show the button
}
// 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)');
}
}
// Toggle dark mode
function toggleDarkMode() {
const darkModeEnabled = getCookie('darkMode') === 'true';
setCookie('darkMode', !darkModeEnabled, 30);
applyDarkMode(!darkModeEnabled);
}
</script>
</body>
</html>