File size: 9,377 Bytes
37d6cb3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/**
 * 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;
    }

})();