EDUrocks's picture
Add files using upload-large-folder tool
37d6cb3 verified
Raw History Blame Contribute Delete
9.38 kB
/**
* EDUrocks 3.0 - Christmas Theme Manager
* Dynamically applies Christmas theme during December
* Features: Festive colors, Tailwind-styled DOM snowflakes
*/
(function() {
// Check if it is December (month 11 in JS Date, 0-indexed) or if force enabled via URL
const now = new Date();
const urlParams = new URLSearchParams(window.location.search);
// const forceXmas = urlParams.get('theme') === 'xmas';
// Force enable for testing/demo purposes as requested
// To revert to date-based: change 'true' to '(now.getMonth() === 11 || forceXmas)'
if ((now.getMonth() === 11 || forceXmas)) {
return;
}
console.log('Applying Christmas Theme');
// Christmas Color Palette - Candy Cane & Evergreen Theme (overriding default Tailwind config)
const xmasColors = {
'edu-dark': '#414b38', // Mistletoe - deep forest green background
'edu-dark-secondary': '#881528ff', // Tinsel - rich red secondary
'edu-dark-accent': '#5c011fff', // Mint - light minty accent for cards
'edu-text': '#f2dee9', // Pure white text for dark backgrounds
'edu-text-secondary': '#9cb7d4', // Mint - light mint for secondary text
'edu-pink': '#D14545', // Cane - bright candy cane red accent
'edu-pink-light': '#E0CDCE', // Icing - light pink (hover)
'edu-rose': '#912326', // Tinsel - deep red
'gold-accent': '#ae023a' // Mint - light mint/blue for festive touches
};
// Function to inject CSS variables and overrides
function injectChristmasStyles() {
const style = document.createElement('style');
style.id = 'edurocks-xmas-theme';
style.innerHTML = `
:root {
--edu-dark: ${xmasColors['edu-dark']};
--edu-dark-secondary: ${xmasColors['edu-dark-secondary']};
--edu-dark-accent: ${xmasColors['edu-dark-accent']};
--edu-text: ${xmasColors['edu-text']};
--edu-text-secondary: ${xmasColors['edu-text-secondary']};
--edu-pink: ${xmasColors['edu-pink']};
--edu-pink-light: ${xmasColors['edu-pink-light']};
--edu-rose: ${xmasColors['edu-rose']};
}
/* Tailwind Class Overrides using !important to force apply over utility classes */
.bg-edu-dark { background-color: var(--edu-dark) !important; }
.bg-edu-dark-secondary { background-color: var(--edu-dark-secondary) !important; }
.bg-edu-dark-accent {
background: linear-gradient(135deg, ${xmasColors['edu-dark-secondary']} 0%, ${xmasColors['edu-pink']} 100%) !important;
}
.text-edu-text { color: var(--edu-text) !important; }
.text-edu-text-secondary { color: var(--edu-text-secondary) !important; }
.bg-edu-pink { background-color: var(--edu-pink) !important; }
.text-edu-pink { color: var(--edu-pink) !important; }
.border-edu-pink { border-color: var(--edu-pink) !important; }
.bg-edu-pink-light { background-color: var(--edu-pink-light) !important; }
.text-edu-pink-light { color: var(--edu-pink-light) !important; }
/* Gradient overrides */
.from-edu-pink { --tw-gradient-from: var(--edu-pink) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }
.to-edu-pink-light { --tw-gradient-to: var(--edu-pink-light) !important; }
.via-edu-pink-light { --tw-gradient-stops: var(--tw-gradient-from), var(--edu-pink-light), var(--tw-gradient-to) !important; }
.from-edu-dark-accent { --tw-gradient-from: ${xmasColors['edu-dark-accent']} !important; }
.to-edu-dark-secondary { --tw-gradient-to: ${xmasColors['edu-dark-secondary']} !important; }
.hover\:bg-edu-pink:hover { background-color: var(--edu-pink) !important; }
.hover\:text-edu-pink:hover { color: var(--edu-pink) !important; }
.hover\:bg-edu-pink-light:hover { background-color: var(--edu-pink-light) !important; }
.hover\:text-edu-pink-light:hover { color: var(--edu-pink-light) !important; }
/* Override all hover states and transitions */
.hover\:scale-105:hover,
.group-hover\:scale-110,
a:hover,
button:hover,
.feature-card:hover h3,
.group:hover .group-hover\:text-edu-pink-light {
color: var(--edu-pink-light) !important;
}
/* Force all background hover states */
a.px-4.py-2:hover,
.transition-all:hover {
background-color: var(--edu-pink) !important;
color: var(--edu-text) !important;
}
/* Override gradient text for logo */
.gradient-text {
background: linear-gradient(45deg, ${xmasColors['edu-pink']}, ${xmasColors['edu-pink-light']}, ${xmasColors['gold-accent']}, ${xmasColors['edu-pink-light']}, ${xmasColors['edu-pink']}) !important;
background-size: 200% 200% !important;
-webkit-background-clip: text !important;
background-clip: text !important;
-webkit-text-fill-color: transparent !important;
animation: gradient 6s ease infinite !important;
}
/* Quote box styling */
.bg-gradient-to-br {
background: linear-gradient(135deg, ${xmasColors['edu-dark-secondary']} 0%, ${xmasColors['edu-pink']} 100%) !important;
}
/* Hero/quote section background override - the area behind the quote */
.relative.overflow-hidden {
background: linear-gradient(to bottom, ${xmasColors['edu-dark-accent']}, ${xmasColors['gold-accent']}) !important;
}
.absolute.inset-0 {
background: none !important;
}
/* Override link colors in quote */
#quote-text a {
color: ${xmasColors['edu-pink-light']} !important;
}
#quote-text a:hover {
color: ${xmasColors['gold-accent']} !important;
}
/* Add some Santa Hat to Logo if found */
.font-pacifico::after {
content: " 🎄";
font-size: 0.8em;
}
/* Custom Keyframes for Snowfall (Tailwind doesn't have complex physics animations built-in) */
@keyframes snowfall {
0% { transform: translateY(-10vh) translateX(0) rotate(0deg); opacity: 0; }
10% { opacity: 1; }
100% { transform: translateY(110vh) translateX(30px) rotate(360deg); opacity: 0.9; }
}
.animate-snow {
animation: snowfall linear infinite;
background: white !important;
box-shadow: 0 0 8px rgba(255, 255, 255, 0.7) !important;
}
`;
document.head.appendChild(style);
}
// Function to create DOM-based snowflakes
function createSnowflakes() {
// Wait for DOM to be ready
setTimeout(() => {
// Create container
const container = document.createElement('div');
container.style.position = 'fixed';
container.style.top = '0';
container.style.left = '0';
container.style.width = '100%';
container.style.height = '100%';
container.style.pointerEvents = 'none';
container.style.zIndex = '9999';
container.style.overflow = 'hidden';
container.id = 'xmas-snow-container';
document.body.appendChild(container);
const snowflakeCount = 100; // Number of flakes
for (let i = 0; i < snowflakeCount; i++) {
const flake = document.createElement('div');
// Set position to absolute
flake.style.position = 'absolute';
flake.style.backgroundColor = '#FFFFFF';
flake.style.borderRadius = '50%';
flake.style.boxShadow = '0 0 10px rgba(255, 255, 255, 0.9)';
// Randomize size
const size = Math.random() * 6 + 4; // 4px to 10px
flake.style.width = `${size}px`;
flake.style.height = `${size}px`;
// Randomize horizontal start position
flake.style.left = `${Math.random() * 100}%`;
flake.style.top = `-20px`;
// Add animation
const duration = Math.random() * 8 + 7; // 7s to 15s
const delay = Math.random() * 5; // 0s to 5s
flake.style.animation = `snowfall ${duration}s linear ${delay}s infinite`;
container.appendChild(flake);
}
}, 100);
}
// Apply changes
injectChristmasStyles();
createSnowflakes();
// Patch Tailwind config for JS usage if present
if (window.tailwind && window.tailwind.config) {
const colors = window.tailwind.config.theme.extend.colors || {};
Object.assign(colors, xmasColors);
window.tailwind.config.theme.extend.colors = colors;
}
})();