-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwinners.html
More file actions
655 lines (602 loc) · 23.3 KB
/
winners.html
File metadata and controls
655 lines (602 loc) · 23.3 KB
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
<!doctype html>
<!--
=====================================================================
FILE: winners.html (NEW MODULAR VERSION)
PROJECT: IIM Mumbai Fantasy League - Public Website
PAGE: Complete Winner Scorecard (desktop table + tablet/mobile cards)
AUTHOR: Aditya Garg (@addygunners)
ARCHITECTURE: Uses proven modular CSS/JS architecture from index.html
=====================================================================
-->
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Complete Winner Scorecard - IIM Mumbai Fantasy League</title>
<!-- Favicon -->
<link rel="icon" type="image/png" href="assets/images/favicon.png?v=test" />
<!-- Preload fonts for better performance -->
<!-- Preload self-hosted fonts for fast paint -->
<link
rel="preload"
as="font"
type="font/woff2"
href="assets/fonts/poppins/poppins-latin-400.woff2?v=test"
crossorigin
/>
<link
rel="preload"
as="font"
type="font/woff2"
href="assets/fonts/poppins/poppins-latin-600.woff2?v=test"
crossorigin
/>
<link
rel="preload"
as="font"
type="font/woff2"
href="assets/fonts/poppins/poppins-latin-700.woff2?v=test"
crossorigin
/>
<!-- Font Awesome removed: replaced with emoji/SVG to avoid render-blocking CSS -->
<!-- (Fallback CSS link declared later; keep last for override power) -->
<!-- MODULAR CSS ARCHITECTURE (standardized async loading like index.html) -->
<!-- 1. Foundation: Consolidated (variables, fonts, base, spacing) -->
<link rel="stylesheet" href="css/styles.css?v=test" />
<!-- 2. Layout: Core layout and spacing (merged into styles.css) -->
<!-- 3. Components (base first, then component extensions) - merged into styles.css -->
<!-- table.css consolidated into styles.css for better maintainability -->
<!-- header.css merged into styles.css -->
<!-- 4. Page-specific (async loading for non-critical styles) -->
<!-- winners.css merged into styles.css -->
<!-- winners-specific.css merged into styles.css -->
<!-- leaderboard.css merged into styles.css -->
<!-- 5. Responsive (merged into styles.css) -->
<!-- 6. Fallback CSS consolidated into styles.css for better maintainability -->
<!-- Critical CSS: Above-the-fold styles for stable first paint -->
<style>
/* Essential variables needed for critical path */
:root {
--primary-color: #37003c;
--heading-color: #37003c;
--background-color: #f8f9fa;
--page-backdrop: #f8f9fa;
--card-background: #fff;
--text-color: #212529;
--border-radius: 8px;
--spacing-lg: 24px;
--spacing-xl: 32px;
--radius-lg: 8px;
--container-max-width: 1200px;
--spacing-md: 16px;
--safe-top: env(safe-area-inset-top, 0px);
}
/* Critical layout foundation */
* {
box-sizing: border-box;
}
body {
font-family:
'Poppins',
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
sans-serif;
line-height: 1.7;
margin: 0;
padding: 0;
background-color: var(--page-backdrop);
color: var(--text-color);
overscroll-behavior: none;
}
/* Container critical layout */
.container {
width: 100%;
max-width: var(--container-max-width);
margin: var(--spacing-lg) auto;
padding: 0 var(--spacing-md);
background-color: transparent;
}
/* Header critical styles - above-the-fold */
.site-header {
position: sticky;
top: 0;
z-index: 1000;
background-color: var(--page-backdrop);
padding-top: calc(8px + var(--safe-top));
padding-bottom: 0;
margin-bottom: var(--spacing-lg);
/* Progressive auto-hide via CSS variables set by JS */
transform: translateY(calc(-1 * var(--header-offset, 0px)));
will-change: transform;
}
.header-inner {
width: 100%;
margin: 0 auto;
padding: 0;
/* Optional fade as header hides */
opacity: var(--header-opacity, 1);
}
header {
background: linear-gradient(135deg, var(--primary-color), var(--heading-color));
color: #fff;
text-align: center;
padding: clamp(12px, 4svh, 50px) clamp(8px, 2vw, 20px);
border-radius: var(--border-radius);
display: flex;
align-items: center;
justify-content: space-between;
gap: clamp(8px, 2svh, 20px);
flex-wrap: wrap;
position: relative;
width: 100%;
min-height: clamp(56px, 12svh, 120px);
background-clip: padding-box;
}
@media (max-width: 600px) {
.site-header {
padding-top: calc(4px + var(--safe-top));
margin-bottom: 12px;
}
header {
padding: 10px 10px;
min-height: 56px;
gap: 8px;
}
.countdown-clock {
max-width: 200px;
padding: 8px 10px;
}
.container {
margin-top: 4px;
}
}
.header-main {
flex: 1 1 auto;
min-width: 0;
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
header h1 {
margin: 0;
font-size: clamp(1rem, 4vw, 2rem);
font-weight: 700;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
header p {
margin: 4px 0 0;
font-size: clamp(0.8rem, 3vw, 1rem);
opacity: 0.9;
line-height: 1.2;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/* Countdown critical layout */
.countdown-clock {
max-width: 300px;
border-radius: var(--border-radius);
padding: 12px 16px;
border: 2px solid transparent;
}
.countdown-clock.is-hidden {
display: block !important;
visibility: hidden;
}
/* Shared critical container styling to prevent layout shifts */
.section__card {
padding: var(--spacing-xl);
margin-bottom: var(--spacing-lg);
border-radius: var(--radius-lg);
background-color: var(--card-background);
}
/* Loading state to prevent flash of unstyled content */
.winner-loading {
padding: var(--spacing-xl);
text-align: center;
background-color: var(--card-background);
border-radius: var(--radius-lg);
margin-bottom: var(--spacing-lg);
}
/* Hide content until loaded to prevent layout shifts */
.is-hidden {
display: none !important;
}
</style>
</head>
<body>
<script>
// External Resource Integrity Check & Fallback (mirrors index.html, FA removed)
(function () {
'use strict';
function checkExternalResources() {
try {
const fallbackCSS = document.getElementById('fallback-css');
let needsFallback = false;
// Check Google Fonts (Poppins)
try {
const testP = document.createElement('div');
testP.style.fontFamily = 'Poppins, serif';
testP.style.position = 'absolute';
testP.style.left = '-9999px';
testP.textContent = 'test';
document.body.appendChild(testP);
const ps = window.getComputedStyle(testP);
if (ps.fontFamily.indexOf('Poppins') === -1) {
needsFallback = true;
document.body.classList.add('poppins-fallback');
console.warn('Google Fonts failed to load (winners)');
}
document.body.removeChild(testP);
} catch (e) {
console.warn('Google Fonts check failed (winners):', e);
needsFallback = true;
document.body.classList.add('poppins-fallback');
}
if (needsFallback && fallbackCSS) {
fallbackCSS.disabled = false;
document.body.classList.add('external-resources-failed');
console.info('Fallback CSS enabled (winners)');
}
} catch (e) {
console.error('External resource check failed completely (winners):', e);
const fallbackCSS = document.getElementById('fallback-css');
if (fallbackCSS) {
fallbackCSS.disabled = false;
document.body.classList.add('external-resources-failed');
}
}
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', function () {
setTimeout(checkExternalResources, 100);
});
} else {
setTimeout(checkExternalResources, 100);
}
window.addEventListener('load', function () {
setTimeout(checkExternalResources, 200);
});
})();
</script>
<div class="container">
<!-- FIX: mobile sticky header opacity — sticky backplate wrapper (same pattern as index.html) -->
<div class="site-header">
<div class="header-inner">
<header>
<div class="header-main">
<h1><span class="section-emoji">🏆</span>Complete Winner Scorecard</h1>
<p>IIM Mumbai Fantasy League - Season 2025-26</p>
</div>
<!-- Countdown (hidden until data is available) -->
<div id="countdown-clock" class="countdown-clock is-hidden" aria-live="polite">
<div class="countdown-label" id="countdown-label">GW1 Deadline</div>
<div class="countdown-time" aria-label="Time remaining">
<span class="countdown-unit">
<span id="countdown-days">00</span>
<span class="countdown-unit-label">D</span>
</span>
<span class="countdown-separator">:</span>
<span class="countdown-unit">
<span id="countdown-hours">00</span>
<span class="countdown-unit-label">H</span>
</span>
<span class="countdown-separator">:</span>
<span class="countdown-unit">
<span id="countdown-minutes">00</span>
<span class="countdown-unit-label">M</span>
</span>
</div>
</div>
</header>
</div>
</div>
<main id="main-content">
<!-- LEAGUE STATISTICS SECTION (using original winners.html structure) -->
<section
id="league-statistics"
class="section section__card section__card--stats"
aria-labelledby="stats-heading"
>
<h2 class="section__heading" id="stats-heading">
<span class="section__heading-main"
><span class="section__emoji">📊</span>Season Summary</span
>
</h2>
<div class="stats" id="stats-summary">
<div class="stats__row">
<article class="stats__box" aria-live="polite">
<div class="stats__icon" aria-hidden="true">📅</div>
<div class="stats__number" id="completed-gameweeks">--</div>
<h3 class="stats__title">Completed Gameweeks</h3>
</article>
<article class="stats__box" aria-live="polite">
<div class="stats__icon" aria-hidden="true">🗓️</div>
<div class="stats__number" id="completed-gamemonths">--</div>
<h3 class="stats__title">Completed Gamemonths</h3>
</article>
<article class="stats__box" aria-live="polite">
<div class="stats__icon" aria-hidden="true">🏅</div>
<div class="stats__number" id="total-winners">--</div>
<h3 class="stats__title">Total Winners</h3>
</article>
<article class="stats__box" aria-live="polite">
<div class="stats__icon" aria-hidden="true">💰</div>
<div class="stats__number" id="total-prize-money">--</div>
<h3 class="stats__title">Total Prize Money</h3>
</article>
</div>
</div>
</section>
<!-- WINNERS SECTION -->
<section
id="winners-section"
class="section section__card section__card--winner"
aria-labelledby="winners-heading"
>
<div class="winners-header">
<h2 class="section__heading" id="winners-heading">
<span class="section__heading-main"
><span class="section__emoji">🏅</span>Season Earnings (All Winners)</span
>
<span class="section__heading-subtitle" id="winners-page-after-gw">Loading…</span>
</h2>
<div class="winners-descrow">
<p class="section__desc">All players ranked by total prize money won this season.</p>
<a
href="index.html?v=test"
class="btn nav-back nav-back--sm"
aria-label="Go back to home page"
>
⬅️ Back to Home
</a>
</div>
</div>
<!-- Container for table (desktop) or cards (mobile/tablet) -->
<div id="winner-table-container">
<div class="winner-loading">Loading complete winner data...</div>
</div>
<!-- Pagination -->
<nav
class="nav__leaderboard nav__leaderboard--compact is-hidden"
id="winner-navigation"
role="navigation"
aria-label="Winners navigation"
>
<button id="winner-prev-page" class="nav__button nav__button--compact" disabled>
◀️ Previous
</button>
<span id="winner-page-info" class="nav__page-info" aria-live="polite">Page 1 of 1</span>
<button id="winner-next-page" class="nav__button nav__button--compact" disabled>
Next ▶️
</button>
</nav>
</section>
</main>
<footer>
<p>developed by Aditya Garg (@addygunners)</p>
<p id="site-last-updated" class="site-timestamp">Data updated: Loading...</p>
</footer>
<!-- QA PANEL (shown in test mode) -->
<aside
id="qa-panel"
class="qa-panel test-only is-hidden"
aria-live="polite"
role="complementary"
>
<header class="qa-header">
<h4>QA Panel</h4>
<button
id="qa-toggle"
class="qa-toggle"
type="button"
aria-label="Minimize QA panel"
aria-expanded="true"
>
−
</button>
</header>
<dl class="qa-info">
<dt class="visually-hidden">Phase</dt>
<dd class="qa-kv" id="qa-phase">Phase: —</dd>
<dt class="visually-hidden">Next Gameweek</dt>
<dd class="qa-kv" id="qa-gw">Next GW: —</dd>
<dt class="visually-hidden">Deadline</dt>
<dd class="qa-kv" id="qa-deadline">Deadline: —</dd>
<dt class="visually-hidden">Season Data Source</dt>
<dd class="qa-kv" id="qa-source">Season data source: —</dd>
<dt class="visually-hidden">Data Mode</dt>
<dd class="qa-kv" id="qa-data-mode">Data sources — winners: — • leaderboard: —</dd>
<dt class="visually-hidden">Winners Updated</dt>
<dd class="qa-kv" id="qa-winners-updated">Winners updated: —</dd>
<dt class="visually-hidden">Leaderboard Updated</dt>
<dd class="qa-kv" id="qa-leaderboard-updated">Leaderboard updated: —</dd>
<dt class="visually-hidden">Current Time</dt>
<dd class="qa-kv" id="qa-time">Now (offset): —</dd>
</dl>
<footer class="qa-actions">
<button id="qa-clear-cache" class="qa-btn" type="button">Clear cache</button>
<button id="qa-refetch" class="qa-btn" type="button">Re-fetch</button>
<button id="qa-copy" class="qa-btn" type="button">Copy</button>
</footer>
</aside>
</div>
<!-- Floating test controls (test mode only) -->
<aside
id="floating-phase-toggle-w"
class="floating-toggle test-only is-hidden"
role="complementary"
aria-label="Test mode controls"
>
⬅️
<a
id="back-index-test"
href="index.html?test=true&v=test"
class="btn nav-back nav-back--sm"
title="Back to Home (test)"
>
Back to Home
</a>
</aside>
<!-- MODULAR JAVASCRIPT (using shared modules) -->
<script>
// Identify this as winners page to prevent UI manager from running index.html-specific code
window.FPL_PAGE_TYPE = 'winners';
</script>
<script src="js/error-handler.js?v=test" defer></script>
<script src="js/utils.js?v=test" defer></script>
<script src="js/data-loader.js?v=test" defer></script>
<script src="js/ui-manager.js?v=test" defer></script>
<script src="js/header-scroll.js?v=test" defer></script>
<script src="js/countdown.js?v=test" defer></script>
<script src="js/prize-structure.js?v=test" defer></script>
<!-- Winners page module loader -->
<script type="module" src="js/winners-module.js?v=test" defer></script>
<!-- Ensure test-only controls appear on winners when ?test=true -->
<script>
(function () {
try {
var qp = new URLSearchParams(location.search);
if (qp.get('test') === 'true') {
document.querySelectorAll('.test-only').forEach(function (el) {
el.classList.remove('is-hidden');
});
// Ensure UI manager is ready (defer scripts run before DOMContentLoaded)
document.addEventListener('DOMContentLoaded', function () {
try {
if (window.FPLUIManager && typeof FPLUIManager.checkTestMode === 'function') {
FPLUIManager.checkTestMode();
}
} catch (e) {}
});
}
} catch (e) {}
})();
</script>
<!-- Twemoji for stats icons -->
<script defer src="assets/twemoji/twemoji.min.js?v=test"></script>
<script>
window.applyTwemoji = function (root) {
try {
if (window.twemoji && typeof window.twemoji.parse === 'function') {
window.twemoji.parse(root || document.body, {
base: 'assets/twemoji/',
folder: 'svg',
ext: '.svg',
});
}
} catch (e) {}
};
document.addEventListener('DOMContentLoaded', function () {
if (!window.twemoji) {
var s = document.createElement('script');
s.src = 'https://twemoji.maxcdn.com/v/latest/twemoji.min.js';
s.crossOrigin = 'anonymous';
s.onload = function () {
window.applyTwemoji(document.body);
};
document.head.appendChild(s);
} else {
window.applyTwemoji(document.body);
}
});
</script>
<!-- Countdown initialization for winners page -->
<script>
// Ensure countdown initialization after all modules are loaded
document.addEventListener('DOMContentLoaded', function () {
// Wait a bit to ensure all global modules are initialized
setTimeout(function () {
if (
window.FPLDataLoader &&
typeof window.FPLDataLoader.loadFPLSeasonData === 'function'
) {
console.log('🏆 Winners page: Initializing countdown system');
// Load season data and start countdown (same pattern as index.html)
window.FPLDataLoader.loadFPLSeasonData()
.then(function (data) {
const deadline = data.deadline;
const gameweek = data.gameweek;
console.log('🏆 Winners page: Season data loaded successfully');
// Update the countdown label (winners page doesn't need full UI manager)
const countdownLabel = document.getElementById('countdown-label');
if (countdownLabel && gameweek && gameweek.id) {
countdownLabel.textContent = `GW${gameweek.id} Deadline`;
}
if (
window.FPLCountdown &&
typeof window.FPLCountdown.startCountdown === 'function'
) {
const countdownResult = window.FPLCountdown.startCountdown(deadline, gameweek);
console.log('🏆 Winners page: Countdown started:', countdownResult);
// Show the countdown clock
const countdownClock = document.getElementById('countdown-clock');
if (countdownClock) {
countdownClock.classList.remove('is-hidden');
}
}
if (
window.FPLCountdown &&
typeof window.FPLCountdown.scheduleRolloverCheck === 'function'
) {
window.FPLCountdown.scheduleRolloverCheck(deadline);
}
})
.catch(function (error) {
console.warn(
'🏆 Winners page: Season data load failed, trying proxy fallback',
error
);
// Try proxy fallback without UI manager calls
if (
window.FPLDataLoader &&
typeof window.FPLDataLoader.loadFPLSeasonDataViaProxy === 'function'
) {
window.FPLDataLoader.loadFPLSeasonDataViaProxy()
.then(function (data) {
const deadline = data.deadline;
const gameweek = data.gameweek;
if (
window.FPLCountdown &&
typeof window.FPLCountdown.startCountdown === 'function'
) {
window.FPLCountdown.startCountdown(deadline, gameweek);
// Show the countdown clock
const countdownClock = document.getElementById('countdown-clock');
if (countdownClock) {
countdownClock.classList.remove('is-hidden');
}
}
})
.catch(function (proxyError) {
console.error(
'🏆 Winners page: Both direct and proxy data loads failed',
proxyError
);
// Show the countdown clock anyway (it will show static content)
const countdownClock = document.getElementById('countdown-clock');
if (countdownClock) {
countdownClock.classList.remove('is-hidden');
}
});
}
});
} else {
console.warn(
'🏆 Winners page: FPLDataLoader not available for countdown initialization'
);
}
}, 100); // Small delay to ensure all modules are ready
});
</script>
<!-- Version + SW update handling -->
<script src="/version.js?v=test" defer></script>
<script src="js/sw-update.js?v=test" defer></script>
</body>
</html>