Merge pull request 'Xmas silliness' (#4) from main into local-flights

Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
2025-12-19 12:07:44 -05:00
7 changed files with 490 additions and 0 deletions

View File

@@ -132,6 +132,226 @@
grid-template-columns: 1fr; /* Stack columns on smaller screens */
}
}
/* Christmas toggle switch */
.christmas-toggle {
position: absolute;
right: 20px;
top: 20px;
display: flex;
align-items: center;
gap: 10px;
color: white;
font-size: 14px;
}
.toggle-checkbox {
width: 50px;
height: 24px;
cursor: pointer;
appearance: none;
background-color: #555;
border-radius: 12px;
border: none;
outline: none;
transition: background-color 0.3s;
position: relative;
}
.toggle-checkbox:checked {
background-color: #27ae60;
}
.toggle-checkbox::before {
content: '';
position: absolute;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: white;
top: 2px;
left: 2px;
transition: left 0.3s;
}
.toggle-checkbox:checked::before {
left: 28px;
}
/* Santa hat styles */
.santa-hat {
position: absolute;
width: 60px;
height: 50px;
top: -20px;
transform: rotate(-20deg);
z-index: 10;
}
.santa-hat::before {
content: '';
position: absolute;
width: 100%;
height: 70%;
background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
clip-path: polygon(0 0, 100% 0, 90% 100%, 10% 100%);
}
.santa-hat::after {
content: '';
position: absolute;
width: 20px;
height: 20px;
background: white;
border-radius: 50%;
bottom: -5px;
right: -8px;
box-shadow: -15px 5px 0 -5px white;
}
/* Jingle bell styles */
.jingle-bell {
display: inline-block;
position: relative;
width: 12px;
height: 14px;
margin: 0 2px;
animation: jingle 0.4s ease-in-out infinite;
}
.jingle-bell::before {
content: '';
position: absolute;
width: 100%;
height: 100%;
background: #f1c40f;
border-radius: 50% 50% 50% 0;
transform: rotate(-45deg);
box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.jingle-bell::after {
content: '';
position: absolute;
width: 3px;
height: 6px;
background: #d4a500;
top: -6px;
left: 50%;
transform: translateX(-50%);
}
@keyframes jingle {
0%, 100% { transform: rotate(0deg); }
25% { transform: rotate(5deg); }
75% { transform: rotate(-5deg); }
}
/* Snow animation */
.snowflake {
position: fixed;
top: -10px;
color: white;
font-size: 1em;
font-weight: bold;
text-shadow: 0 0 5px rgba(255,255,255,0.8);
z-index: 1;
user-select: none;
pointer-events: none;
animation: snowfall linear infinite;
opacity: 0.8;
}
@keyframes snowfall {
to {
transform: translateY(100vh) translateX(100px);
opacity: 0;
}
}
body.christmas-active .snowflake {
animation: snowfall linear infinite;
}
/* Festive header when active */
body.christmas-active header {
background: linear-gradient(90deg, #27ae60 0%, #e74c3c 50%, #27ae60 100%);
background-size: 200% 100%;
animation: festive-pulse 3s ease-in-out infinite;
}
@keyframes festive-pulse {
0%, 100% { background-position: 0% 0%; }
50% { background-position: 100% 0%; }
}
/* Jingle bells in header when active */
body.christmas-active h1::before {
content: '🔔 ';
animation: jingle 0.4s ease-in-out infinite;
display: inline-block;
font-size: 30px;
margin-right: 15px;
}
body.christmas-active h1::after {
content: ' 🔔';
animation: jingle 0.4s ease-in-out infinite;
display: inline-block;
font-size: 30px;
margin-left: 15px;
}
/* Corner decorations */
.corner-decoration {
position: fixed;
font-size: 80px;
z-index: 5;
pointer-events: none;
opacity: 0.9;
width: 100px;
height: 100px;
}
.corner-decoration img {
width: 100%;
height: 100%;
object-fit: contain;
}
/* Bottom decorations */
.bottom-decoration {
position: fixed;
bottom: 20px;
width: 80px;
height: 80px;
z-index: 5;
pointer-events: none;
opacity: 0.85;
}
.bottom-decoration img {
width: 100%;
height: 100%;
object-fit: contain;
}
.corner-decoration.bottom-left {
bottom: 10px;
left: 10px;
animation: sway 3s ease-in-out infinite;
}
.corner-decoration.bottom-right {
bottom: 10px;
right: 10px;
animation: sway 3s ease-in-out infinite reverse;
}
@keyframes sway {
0%, 100% { transform: rotate(0deg); }
50% { transform: rotate(-5deg); }
}
</style>
</head>
<body>
@@ -191,6 +411,118 @@
</footer>
<script>
// Christmas mode toggle functionality
function initChristmasMode() {
// Check URL parameter first for override
const urlParams = new URLSearchParams(window.location.search);
const christmasParam = urlParams.get('christmas');
let shouldEnable = false;
if (christmasParam === 'on') {
shouldEnable = true;
} else if (christmasParam === 'off') {
shouldEnable = false;
} else {
// Auto-enable for December
const now = new Date();
shouldEnable = now.getMonth() === 11; // December is month 11 (0-indexed)
}
if (shouldEnable) {
enableChristmasMode();
}
}
function enableChristmasMode() {
document.body.classList.add('christmas-active');
// Create falling snowflakes
function createSnowflake() {
const snowflake = document.createElement('div');
snowflake.classList.add('snowflake');
snowflake.textContent = '❄';
snowflake.style.left = Math.random() * window.innerWidth + 'px';
snowflake.style.animationDuration = (Math.random() * 5 + 8) + 's';
snowflake.style.animationDelay = Math.random() * 2 + 's';
document.body.appendChild(snowflake);
setTimeout(() => snowflake.remove(), 13000);
}
// Create snowflakes periodically
const snowInterval = setInterval(() => {
if (!document.body.classList.contains('christmas-active')) {
clearInterval(snowInterval);
return;
}
createSnowflake();
}, 300);
// Add corner decorations
const leftCorner = document.createElement('div');
leftCorner.classList.add('corner-decoration', 'bottom-left');
const treeImg = document.createElement('img');
treeImg.src = 'assets/tree.svg';
treeImg.alt = 'Christmas Tree';
leftCorner.appendChild(treeImg);
leftCorner.id = 'corner-left';
document.body.appendChild(leftCorner);
const rightCorner = document.createElement('div');
rightCorner.classList.add('corner-decoration', 'bottom-right');
const santaImg = document.createElement('img');
santaImg.src = 'assets/santa.svg';
santaImg.alt = 'Santa';
rightCorner.appendChild(santaImg);
rightCorner.id = 'corner-right';
document.body.appendChild(rightCorner);
// Add bottom decorations in a row
const bottomDecorations = [
{ src: 'assets/reindeer.svg', alt: 'Reindeer' },
{ src: 'assets/bell.svg', alt: 'Bell' },
{ src: 'assets/gift.svg', alt: 'Gift' },
{ src: 'assets/candycane.svg', alt: 'Candy Cane' },
{ src: 'assets/bell.svg', alt: 'Bell' },
{ src: 'assets/gift.svg', alt: 'Gift' }
];
const screenWidth = window.innerWidth;
const totalDecorations = bottomDecorations.length;
const spacing = screenWidth / (totalDecorations + 1);
bottomDecorations.forEach((deco, index) => {
const div = document.createElement('div');
div.classList.add('bottom-decoration');
div.style.left = (spacing * (index + 1) - 40) + 'px'; // 40 is half the width
div.style.animation = `sway ${3 + index * 0.5}s ease-in-out infinite`;
const img = document.createElement('img');
img.src = deco.src;
img.alt = deco.alt;
div.appendChild(img);
div.id = `bottom-deco-${index}`;
document.body.appendChild(div);
});
}
function disableChristmasMode() {
document.body.classList.remove('christmas-active');
// Remove corner decorations
document.getElementById('corner-left')?.remove();
document.getElementById('corner-right')?.remove();
// Remove bottom decorations
document.querySelectorAll('[id^="bottom-deco-"]').forEach(deco => deco.remove());
// Remove snowflakes
document.querySelectorAll('.snowflake').forEach(flake => flake.remove());
}
let wsConnection = null;
// ICAO code to airport name cache
@@ -517,6 +849,9 @@
// Load data on page load
window.addEventListener('load', function() {
// Initialize Christmas mode
initChristmasMode();
loadArrivals();
loadDepartures();