mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-08 05:50:40 +00:00
Revert "Christmas Themed Homepage (#2608)"
This reverts commit f256f497ce.
This commit is contained in:
+1
-55
@@ -1,4 +1,3 @@
|
||||
import Snowflake3Png from "../../resources/images/Snowflake.webp";
|
||||
import version from "../../resources/version.txt";
|
||||
import { UserMeResponse } from "../core/ApiSchemas";
|
||||
import { EventBus } from "../core/EventBus";
|
||||
@@ -43,7 +42,6 @@ import { UsernameInput } from "./UsernameInput";
|
||||
import { incrementGamesPlayed, isInIframe } from "./Utils";
|
||||
import "./components/baseComponents/Button";
|
||||
import "./components/baseComponents/Modal";
|
||||
import "./snow.css";
|
||||
import "./styles.css";
|
||||
|
||||
declare global {
|
||||
@@ -556,9 +554,6 @@ class Client {
|
||||
document.querySelectorAll(".ad").forEach((ad) => {
|
||||
(ad as HTMLElement).style.display = "none";
|
||||
});
|
||||
// Hide snowflakes when joining lobby
|
||||
document.documentElement.classList.add("in-game");
|
||||
removeSnowflakes(); // Stop snowflakes when joining a game
|
||||
|
||||
crazyGamesSDK.loadingStart();
|
||||
|
||||
@@ -604,9 +599,6 @@ class Client {
|
||||
|
||||
this.gutterAds.hide();
|
||||
this.publicLobby.leaveLobby();
|
||||
// Show snowflakes when leaving lobby (back to homepage)
|
||||
document.documentElement.classList.remove("in-game");
|
||||
enableSnowflakes(); // Restart snowflakes when leaving a game
|
||||
}
|
||||
|
||||
private handleKickPlayer(event: CustomEvent) {
|
||||
@@ -674,58 +666,12 @@ class Client {
|
||||
}
|
||||
}
|
||||
}
|
||||
function enableSnowflakes() {
|
||||
// Respect user's motion preferences
|
||||
const prefersReducedMotion = window.matchMedia(
|
||||
"(prefers-reduced-motion: reduce)",
|
||||
).matches;
|
||||
if (prefersReducedMotion) {
|
||||
return;
|
||||
}
|
||||
|
||||
const snowContainer = document.querySelector(".snow") as HTMLElement;
|
||||
if (!snowContainer) {
|
||||
console.warn("Snow container element not found");
|
||||
return;
|
||||
}
|
||||
|
||||
// Clear existing snowflakes if any
|
||||
removeSnowflakes();
|
||||
|
||||
const isMobile = window.innerWidth <= 768;
|
||||
const numberOfSnowflakes = isMobile ? 30 : 75; // Increased count
|
||||
|
||||
for (let i = 0; i < numberOfSnowflakes; i++) {
|
||||
const snowflake = document.createElement("div");
|
||||
snowflake.classList.add("snowflake");
|
||||
snowflake.style.left = `${Math.random() * 100}vw`; // Random horizontal position
|
||||
snowflake.style.animationDuration = `${Math.random() * 10 + 5}s`; // Random duration between 5-15s
|
||||
snowflake.style.animationDelay = `${Math.random() * -10}s`; // Random delay
|
||||
snowflake.style.opacity = `${Math.random() * 0.5 + 0.5}`; // Random opacity between 0.5-1
|
||||
const size = Math.random() * 20 + 10; // Random size between 10-30px
|
||||
snowflake.style.width = `${size}px`;
|
||||
snowflake.style.height = `${size}px`;
|
||||
snowflake.style.backgroundImage = `url(${Snowflake3Png})`;
|
||||
|
||||
snowContainer.appendChild(snowflake);
|
||||
}
|
||||
}
|
||||
|
||||
function removeSnowflakes() {
|
||||
const snowContainer = document.querySelector(".snow") as HTMLElement;
|
||||
if (snowContainer) {
|
||||
snowContainer.replaceChildren();
|
||||
}
|
||||
}
|
||||
// Initialize the client when the DOM is loaded
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
new Client().initialize();
|
||||
|
||||
// Initially enable snowflakes if not in-game
|
||||
if (!document.documentElement.classList.contains("in-game")) {
|
||||
enableSnowflakes();
|
||||
}
|
||||
});
|
||||
|
||||
async function getTurnstileToken(): Promise<{
|
||||
token: string;
|
||||
createdAt: number;
|
||||
|
||||
Reference in New Issue
Block a user