-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathleaderboard.html
More file actions
736 lines (652 loc) · 37.7 KB
/
Copy pathleaderboard.html
File metadata and controls
736 lines (652 loc) · 37.7 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
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<link rel="manifest" href="manifest.json">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-title" content="الجاسوس">
<meta name="theme-color" content="#0a0e1a">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>لوحة المتصدرين | El Jasus</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="icon" type="image/png" href="ElJasus.png">
<link href="https://fonts.googleapis.com/css2?family=Cairo:wght@400;700;900&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="mobile.css">
<script src="sound-system.js" defer></script>
<script src="qr-notifications.js" defer></script>
<script src="dialogs.js"></script>
<style>
:root {
--bg-color: #0a0e1a;
--card-color: rgba(15, 20, 35, 0.95);
--primary-color: #00f2ff;
--secondary-color: #7c30ff;
--gold: #ffd700;
--silver: #c0c0c0;
--bronze: #cd7f32;
}
body {
font-family: 'Cairo', sans-serif;
background: linear-gradient(135deg, #0a0e1a 0%, #1a1535 50%, #0f0c1d 100%);
background-attachment: fixed;
color: #ffffff;
min-height: 100vh;
position: relative;
overflow-x: hidden;
}
/* Animated Background Grid */
body::before {
content: '';
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
linear-gradient(rgba(0, 242, 255, 0.03) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 242, 255, 0.03) 1px, transparent 1px);
background-size: 50px 50px;
animation: gridMove 20s linear infinite;
pointer-events: none;
z-index: 0;
}
@keyframes gridMove {
0% { transform: translateY(0); }
100% { transform: translateY(50px); }
}
/* Floating Particles */
body::after {
content: '';
position: fixed;
width: 100%;
height: 100%;
background-image: radial-gradient(2px 2px at 20% 30%, rgba(124, 48, 255, 0.3), transparent),
radial-gradient(2px 2px at 60% 70%, rgba(0, 242, 255, 0.3), transparent),
radial-gradient(1px 1px at 50% 50%, rgba(255, 255, 255, 0.2), transparent);
background-size: 200% 200%;
animation: particleFloat 15s ease-in-out infinite;
pointer-events: none;
z-index: 0;
}
@keyframes particleFloat {
0%, 100% { opacity: 0.3; transform: translateY(0); }
50% { opacity: 0.6; transform: translateY(-20px); }
}
/* Glass Morphism */
.glass {
background: linear-gradient(135deg, rgba(15, 20, 35, 0.9), rgba(25, 30, 50, 0.8));
backdrop-filter: blur(20px);
border: 2px solid;
border-image: linear-gradient(135deg, rgba(0, 242, 255, 0.3), rgba(124, 48, 255, 0.3)) 1;
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.1),
0 0 30px rgba(0, 242, 255, 0.1);
position: relative;
overflow: hidden;
}
.glass::before {
content: '';
position: absolute;
top: -50%;
left: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
45deg,
transparent,
rgba(0, 242, 255, 0.05),
transparent
);
animation: shimmer 3s infinite;
pointer-events: none;
}
@keyframes shimmer {
0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}
.neon-text {
font-family: 'Orbitron', sans-serif;
text-shadow:
0 0 10px rgba(0, 242, 255, 0.8),
0 0 20px rgba(0, 242, 255, 0.6),
0 0 30px rgba(0, 242, 255, 0.4);
}
/* Leaderboard Tab Styles */
.tab-btn {
position: relative;
transition: all 0.3s ease;
border: 2px solid transparent;
}
.tab-btn.active {
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
border-color: var(--primary-color);
box-shadow: 0 0 20px rgba(0, 242, 255, 0.5);
}
.tab-btn::before {
content: '';
position: absolute;
inset: 0;
background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
opacity: 0;
transition: opacity 0.3s ease;
border-radius: inherit;
z-index: -1;
}
.tab-btn:not(.active):hover::before {
opacity: 0.2;
}
/* Medal Styles */
.medal-gold {
background: linear-gradient(135deg, #ffd700, #ffed4e);
box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
animation: goldPulse 2s infinite;
}
.medal-silver {
background: linear-gradient(135deg, #c0c0c0, #e8e8e8);
box-shadow: 0 0 20px rgba(192, 192, 192, 0.4);
}
.medal-bronze {
background: linear-gradient(135deg, #cd7f32, #e09856);
box-shadow: 0 0 20px rgba(205, 127, 50, 0.4);
}
@keyframes goldPulse {
0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(255, 215, 0, 0.8); }
}
/* Rank Styles */
.rank-1 {
background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
border-color: rgba(255, 215, 0, 0.5) !important;
}
.rank-2 {
background: linear-gradient(135deg, rgba(192, 192, 192, 0.2), rgba(192, 192, 192, 0.1));
border-color: rgba(192, 192, 192, 0.5) !important;
}
.rank-3 {
background: linear-gradient(135deg, rgba(205, 127, 50, 0.2), rgba(205, 127, 50, 0.1));
border-color: rgba(205, 127, 50, 0.5) !important;
}
/* Trophy Animation */
.trophy-icon {
animation: trophyFloat 3s ease-in-out infinite;
}
@keyframes trophyFloat {
0%, 100% { transform: translateY(0) rotate(-5deg); }
50% { transform: translateY(-10px) rotate(5deg); }
}
/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 8px; }
.custom-scrollbar::-webkit-scrollbar-track {
background: rgba(0, 242, 255, 0.05);
border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 242, 255, 0.5);
}
/* Stat Card */
.stat-card {
position: relative;
overflow: hidden;
}
.stat-card::after {
content: '';
position: absolute;
top: -50%;
right: -50%;
width: 200%;
height: 200%;
background: linear-gradient(
60deg,
transparent,
rgba(0, 242, 255, 0.1),
transparent
);
animation: statShine 3s infinite;
}
@keyframes statShine {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Empty State */
.empty-state {
animation: float 3s ease-in-out infinite;
}
@keyframes float {
0%, 100% { transform: translateY(0px); }
50% { transform: translateY(-10px); }
}
/* Loading Skeleton */
.skeleton {
background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
background-size: 200% 100%;
animation: loading 1.5s infinite;
}
@keyframes loading {
0% { background-position: 200% 0; }
100% { background-position: -200% 0; }
}
/* Badge Styles */
.badge-spy {
background: linear-gradient(135deg, #dc2626, #991b1b);
box-shadow: 0 0 15px rgba(220, 38, 38, 0.5);
}
.badge-innocent {
background: linear-gradient(135deg, #059669, #047857);
box-shadow: 0 0 15px rgba(5, 150, 105, 0.5);
}
</style>
</head>
<body class="p-4 pb-10">
<!-- Header -->
<header class="max-w-6xl mx-auto mb-6 relative z-10">
<div class="flex items-center justify-between">
<!-- Back Button -->
<a href="home.html" class="flex items-center gap-2 text-gray-400 hover:text-cyan-400 transition-all hover:translate-x-1">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
</svg>
<span class="text-sm font-bold">رجوع</span>
</a>
<!-- Title -->
<div class="text-center flex-1">
<div class="flex items-center justify-center gap-3 mb-2">
<svg class="w-10 h-10 text-yellow-500 trophy-icon" fill="currentColor" viewBox="0 0 20 20">
<path d="M2 6a2 2 0 012-2h6a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zM14.553 7.106A1 1 0 0014 8v4a1 1 0 00.553.894l2 1A1 1 0 0018 13V7a1 1 0 00-1.447-.894l-2 1z"/>
</svg>
</div>
<h1 class="text-3xl font-black uppercase tracking-tight neon-text">
لوحة المتصدرين
</h1>
<p class="text-[10px] text-gray-500 font-bold uppercase tracking-wider mt-1" style="font-family: 'Orbitron', sans-serif;">HALL OF FAME</p>
</div>
<!-- Refresh Button -->
<button id="refreshBtn" class="w-10 h-10 rounded-lg bg-gradient-to-br from-cyan-500/20 to-purple-500/20 border-2 border-cyan-500/30 flex items-center justify-center hover:scale-110 transition-all group">
<svg class="w-5 h-5 text-cyan-400 group-hover:rotate-180 transition-transform duration-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"/>
</svg>
</button>
</div>
</header>
<div class="max-w-6xl mx-auto relative z-10">
<!-- Stats Overview -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
<!-- Total Players -->
<div class="glass rounded-2xl p-5 stat-card">
<div class="flex items-center justify-between">
<div>
<p class="text-[10px] font-bold opacity-50 uppercase tracking-wider mb-1" style="font-family: 'Orbitron', sans-serif;">إجمالي اللاعبين</p>
<h3 id="totalPlayers" class="text-3xl font-black text-cyan-400" style="font-family: 'Orbitron', sans-serif;">0</h3>
</div>
<div class="w-16 h-16 rounded-full bg-cyan-500/20 border-2 border-cyan-500/30 flex items-center justify-center">
<svg class="w-8 h-8 text-cyan-400" fill="currentColor" viewBox="0 0 20 20">
<path d="M9 6a3 3 0 11-6 0 3 3 0 016 0zM17 6a3 3 0 11-6 0 3 3 0 016 0zM12.93 17c.046-.327.07-.66.07-1a6.97 6.97 0 00-1.5-4.33A5 5 0 0119 16v1h-6.07zM6 11a5 5 0 015 5v1H1v-1a5 5 0 015-5z"/>
</svg>
</div>
</div>
</div>
<!-- Total Games -->
<div class="glass rounded-2xl p-5 stat-card">
<div class="flex items-center justify-between">
<div>
<p class="text-[10px] font-bold opacity-50 uppercase tracking-wider mb-1" style="font-family: 'Orbitron', sans-serif;">إجمالي المباريات</p>
<h3 id="totalGames" class="text-3xl font-black text-purple-400" style="font-family: 'Orbitron', sans-serif;">0</h3>
</div>
<div class="w-16 h-16 rounded-full bg-purple-500/20 border-2 border-purple-500/30 flex items-center justify-center">
<svg class="w-8 h-8 text-purple-400" fill="currentColor" viewBox="0 0 20 20">
<path d="M11 17a1 1 0 001.447.894l4-2A1 1 0 0017 15V9.236a1 1 0 00-1.447-.894l-4 2a1 1 0 00-.553.894V17zM15.211 6.276a1 1 0 000-1.788l-4.764-2.382a1 1 0 00-.894 0L4.789 4.488a1 1 0 000 1.788l4.764 2.382a1 1 0 00.894 0l4.764-2.382zM4.447 8.342A1 1 0 003 9.236V15a1 1 0 00.553.894l4 2A1 1 0 009 17v-5.764a1 1 0 00-.553-.894l-4-2z"/>
</svg>
</div>
</div>
</div>
<!-- Best Spy -->
<div class="glass rounded-2xl p-5 stat-card">
<div class="flex items-center justify-between">
<div>
<p class="text-[10px] font-bold opacity-50 uppercase tracking-wider mb-1" style="font-family: 'Orbitron', sans-serif;">أفضل جاسوس</p>
<h3 id="bestSpy" class="text-lg font-black text-red-400 truncate max-w-[150px]">---</h3>
</div>
<div class="w-16 h-16 rounded-full bg-red-500/20 border-2 border-red-500/30 flex items-center justify-center">
<svg class="w-8 h-8 text-red-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/>
</svg>
</div>
</div>
</div>
</div>
<!-- Tabs Navigation -->
<div class="glass rounded-2xl p-2 mb-6">
<div class="grid grid-cols-2 md:grid-cols-4 gap-2">
<button onclick="switchTab('spy')" id="tab-spy" class="tab-btn active px-4 py-3 rounded-xl font-black text-sm uppercase tracking-wider transition-all flex items-center justify-center gap-2">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/>
</svg>
انتصارات الجواسيس
</button>
<button onclick="switchTab('innocent')" id="tab-innocent" class="tab-btn px-4 py-3 rounded-xl font-black text-sm uppercase tracking-wider transition-all flex items-center justify-center gap-2">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
انتصارات الأبرياء
</button>
<button onclick="switchTab('total')" id="tab-total" class="tab-btn px-4 py-3 rounded-xl font-black text-sm uppercase tracking-wider transition-all flex items-center justify-center gap-2">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M2 6a2 2 0 012-2h6a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zM14.553 7.106A1 1 0 0014 8v4a1 1 0 00.553.894l2 1A1 1 0 0018 13V7a1 1 0 00-1.447-.894l-2 1z"/>
</svg>
الإجمالي
</button>
<button onclick="switchTab('rank')" id="tab-rank" class="tab-btn px-4 py-3 rounded-xl font-black text-sm uppercase tracking-wider transition-all flex items-center justify-center gap-2">
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
الرتب
</button>
</div>
</div>
<!-- Leaderboard Content -->
<div>
<!-- Spy Wins Leaderboard -->
<div id="leaderboard-spy" class="leaderboard-content">
<div class="glass rounded-2xl p-6 mb-4">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-black uppercase tracking-tight flex items-center gap-2">
<span class="w-10 h-10 rounded-lg bg-red-500/20 border-2 border-red-500/30 flex items-center justify-center">
<svg class="w-5 h-5 text-red-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/>
</svg>
</span>
<span class="neon-text">انتصارات الجواسيس</span>
</h2>
<span class="badge-spy px-4 py-2 rounded-full text-xs font-black uppercase" style="font-family: 'Orbitron', sans-serif;">
SPY WINS
</span>
</div>
<div id="spyLeaderboardList" class="space-y-3 max-h-[600px] overflow-y-auto custom-scrollbar">
<!-- Loading skeleton -->
<div class="skeleton rounded-xl h-20"></div>
<div class="skeleton rounded-xl h-20"></div>
<div class="skeleton rounded-xl h-20"></div>
</div>
</div>
</div>
<!-- Innocent Wins Leaderboard -->
<div id="leaderboard-innocent" class="leaderboard-content hidden">
<div class="glass rounded-2xl p-6 mb-4">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-black uppercase tracking-tight flex items-center gap-2">
<span class="w-10 h-10 rounded-lg bg-green-500/20 border-2 border-green-500/30 flex items-center justify-center">
<svg class="w-5 h-5 text-green-400" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
</span>
<span class="neon-text">انتصارات الأبرياء</span>
</h2>
<span class="badge-innocent px-4 py-2 rounded-full text-xs font-black uppercase" style="font-family: 'Orbitron', sans-serif;">
INNOCENT WINS
</span>
</div>
<div id="innocentLeaderboardList" class="space-y-3 max-h-[600px] overflow-y-auto custom-scrollbar">
<!-- Loading skeleton -->
<div class="skeleton rounded-xl h-20"></div>
<div class="skeleton rounded-xl h-20"></div>
<div class="skeleton rounded-xl h-20"></div>
</div>
</div>
</div>
<!-- Total Games Leaderboard -->
<div id="leaderboard-total" class="leaderboard-content hidden">
<div class="glass rounded-2xl p-6 mb-4">
<div class="flex items-center justify-between mb-6">
<h2 class="text-xl font-black uppercase tracking-tight flex items-center gap-2">
<span class="w-10 h-10 rounded-lg bg-yellow-500/20 border-2 border-yellow-500/30 flex items-center justify-center">
<svg class="w-5 h-5 text-yellow-400" fill="currentColor" viewBox="0 0 20 20">
<path d="M2 6a2 2 0 012-2h6a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V6zM14.553 7.106A1 1 0 0014 8v4a1 1 0 00.553.894l2 1A1 1 0 0018 13V7a1 1 0 00-1.447-.894l-2 1z"/>
</svg>
</span>
<span class="neon-text">إجمالي المباريات</span>
</h2>
<span class="px-4 py-2 rounded-full text-xs font-black uppercase bg-gradient-to-r from-yellow-500/20 to-orange-500/20 border-2 border-yellow-500/30" style="font-family: 'Orbitron', sans-serif;">
TOTAL GAMES
</span>
</div>
<div id="totalLeaderboardList" class="space-y-3 max-h-[600px] overflow-y-auto custom-scrollbar">
<!-- Loading skeleton -->
<div class="skeleton rounded-xl h-20"></div>
<div class="skeleton rounded-xl h-20"></div>
<div class="skeleton rounded-xl h-20"></div>
</div>
</div>
</div>
<!-- Rank Leaderboard -->
<div id="leaderboard-rank" class="leaderboard-content hidden">
<div class="glass rounded-2xl p-6">
<h2 class="text-xl font-black mb-2 flex items-center gap-2">
<span class="w-10 h-10 rounded-lg bg-yellow-500/20 border-2 border-yellow-500/30 flex items-center justify-center">
<svg class="w-5 h-5 text-yellow-400" fill="currentColor" viewBox="0 0 20 20">
<path d="M9.049 2.927c.3-.921 1.603-.921 1.902 0l1.07 3.292a1 1 0 00.95.69h3.462c.969 0 1.371 1.24.588 1.81l-2.8 2.034a1 1 0 00-.364 1.118l1.07 3.292c.3.921-.755 1.688-1.54 1.118l-2.8-2.034a1 1 0 00-1.175 0l-2.8 2.034c-.784.57-1.838-.197-1.539-1.118l1.07-3.292a1 1 0 00-.364-1.118L2.98 8.72c-.783-.57-.38-1.81.588-1.81h3.461a1 1 0 00.951-.69l1.07-3.292z"/>
</svg>
</span>
ترتيب الرتب
</h2>
<p id="season-name" class="text-cyan-400 text-sm font-bold mb-1"></p>
<p id="season-dates" class="text-gray-500 text-xs mb-4"></p>
<div class="grid grid-cols-5 gap-2 mb-5" id="rank-tier-counts"></div>
<div id="rank-leaderboard-list" class="space-y-2">
<p class="text-gray-400 text-center py-4">اضغط على تبويب الرتب لتحميلها</p>
</div>
</div>
</div>
</div>
</div>
<script type="module">
import { initializeApp } from "https://www.gstatic.com/firebasejs/12.7.0/firebase-app.js";
import { getDatabase, ref, onValue, get } from "https://www.gstatic.com/firebasejs/12.7.0/firebase-database.js";
const firebaseConfig = {
apiKey: "AIzaSyDnd-pmKEatI3DaFz6xHWB5ucurtHXt9tk",
authDomain: "el-jasus.firebaseapp.com",
databaseURL: "https://el-jasus-default-rtdb.asia-southeast1.firebasedatabase.app",
projectId: "el-jasus",
storageBucket: "el-jasus.firebasestorage.app",
messagingSenderId: "415659587906",
appId: "1:415659587906:web:782f7940176ea4097eb0db",
measurementId: "G-N4K79FP56N"
};
const app = initializeApp(firebaseConfig);
const db = getDatabase(app);
window._firebaseFns = { ref, get, onValue };
let allPlayers = [];
// Tab Switching
window.switchTab = (tab) => {
// Update tab buttons
document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
document.getElementById(`tab-${tab}`).classList.add('active');
// Update content
document.querySelectorAll('.leaderboard-content').forEach(content => content.classList.add('hidden'));
document.getElementById(`leaderboard-${tab}`).classList.remove('hidden');
// Load rank leaderboard when tab is clicked
if (tab === 'rank') loadRankLeaderboard();
};
// Fetch Leaderboard Data
async function fetchLeaderboard() {
const playersRef = ref(db, 'players');
onValue(playersRef, (snapshot) => {
const data = snapshot.val();
allPlayers = [];
if (data) {
Object.keys(data).forEach(uid => {
const player = data[uid];
allPlayers.push({
uid: uid,
username: player.username || 'مجهول',
email: player.email || '',
spyWins: player.stats?.spyWins || 0,
innocentWins: player.stats?.innocentWins || 0,
totalGames: player.stats?.totalGames || 0,
winRate: calculateWinRate(player.stats)
});
});
}
updateStats();
renderLeaderboards();
});
}
function calculateWinRate(stats) {
if (!stats || stats.totalGames === 0) return 0;
const totalWins = (stats.spyWins || 0) + (stats.innocentWins || 0);
return ((totalWins / stats.totalGames) * 100).toFixed(1);
}
// Update Stats Overview
function updateStats() {
document.getElementById('totalPlayers').innerText = allPlayers.length;
const totalGamesPlayed = allPlayers.reduce((sum, p) => sum + p.totalGames, 0);
document.getElementById('totalGames').innerText = totalGamesPlayed;
const topSpy = allPlayers.sort((a, b) => b.spyWins - a.spyWins)[0];
document.getElementById('bestSpy').innerText = topSpy ? topSpy.username : '---';
}
// Render Leaderboards
function renderLeaderboards() {
// Spy Wins Leaderboard
const spyRanked = [...allPlayers].sort((a, b) => b.spyWins - a.spyWins).slice(0, 50);
renderLeaderboardList('spyLeaderboardList', spyRanked, 'spyWins', 'spy');
// Innocent Wins Leaderboard
const innocentRanked = [...allPlayers].sort((a, b) => b.innocentWins - a.innocentWins).slice(0, 50);
renderLeaderboardList('innocentLeaderboardList', innocentRanked, 'innocentWins', 'innocent');
// Total Games Leaderboard
const totalRanked = [...allPlayers].sort((a, b) => b.totalGames - a.totalGames).slice(0, 50);
renderLeaderboardList('totalLeaderboardList', totalRanked, 'totalGames', 'total');
}
function renderLeaderboardList(containerId, players, statKey, type) {
const container = document.getElementById(containerId);
if (players.length === 0) {
container.innerHTML = `
<div class="text-center py-16 empty-state">
<svg class="w-16 h-16 text-gray-700 mx-auto mb-4" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M3 3a1 1 0 000 2v8a2 2 0 002 2h2.586l-1.293 1.293a1 1 0 101.414 1.414L10 15.414l2.293 2.293a1 1 0 001.414-1.414L12.414 15H15a2 2 0 002-2V5a1 1 0 100-2H3zm11.707 4.707a1 1 0 00-1.414-1.414L10 9.586 8.707 8.293a1 1 0 00-1.414 0l-2 2a1 1 0 101.414 1.414L8 10.414l1.293 1.293a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/>
</svg>
<h3 class="text-xl font-black text-gray-400 mb-2">لا توجد بيانات</h3>
<p class="text-sm text-gray-600">لم يلعب أحد بعد!</p>
</div>
`;
return;
}
const iconMap = {
spy: '<svg class="w-5 h-5 text-red-400" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"/></svg>',
innocent: '<svg class="w-5 h-5 text-green-400" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M2.166 4.999A11.954 11.954 0 0010 1.944 11.954 11.954 0 0017.834 5c.11.65.166 1.32.166 2.001 0 5.225-3.34 9.67-8 11.317C5.34 16.67 2 12.225 2 7c0-.682.057-1.35.166-2.001zm11.541 3.708a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd"/></svg>',
total: '<svg class="w-5 h-5 text-purple-400" fill="currentColor" viewBox="0 0 20 20"><path d="M11 17a1 1 0 001.447.894l4-2A1 1 0 0017 15V9.236a1 1 0 00-1.447-.894l-4 2a1 1 0 00-.553.894V17zM15.211 6.276a1 1 0 000-1.788l-4.764-2.382a1 1 0 00-.894 0L4.789 4.488a1 1 0 000 1.788l4.764 2.382a1 1 0 00.894 0l4.764-2.382zM4.447 8.342A1 1 0 003 9.236V15a1 1 0 00.553.894l4 2A1 1 0 009 17v-5.764a1 1 0 00-.553-.894l-4-2z"/></svg>'
};
const colorMap = {
spy: 'text-red-400',
innocent: 'text-green-400',
total: 'text-purple-400'
};
container.innerHTML = players.map((player, index) => {
const rank = index + 1;
const rankClass = rank === 1 ? 'rank-1' : rank === 2 ? 'rank-2' : rank === 3 ? 'rank-3' : '';
const medalClass = rank === 1 ? 'medal-gold' : rank === 2 ? 'medal-silver' : rank === 3 ? 'medal-bronze' : '';
return `
<div class="glass rounded-xl p-4 border-2 ${rankClass} hover:border-cyan-500/50 transition-all group">
<div class="flex items-center justify-between gap-4">
<!-- Rank -->
<div class="flex-shrink-0">
${rank <= 3 ? `
<div class="w-12 h-12 ${medalClass} rounded-full flex items-center justify-center text-black font-black text-xl border-2 border-white/20" style="font-family: 'Orbitron', sans-serif;">
${rank}
</div>
` : `
<div class="w-12 h-12 bg-white/5 border-2 border-white/10 rounded-full flex items-center justify-center text-gray-400 font-black text-lg" style="font-family: 'Orbitron', sans-serif;">
${rank}
</div>
`}
</div>
<!-- Player Info -->
<div class="flex-1 min-w-0">
<h3 class="text-lg font-black text-white truncate mb-1 group-hover:text-cyan-400 transition-colors">
${player.username}
</h3>
<div class="flex items-center gap-3 text-xs">
<span class="text-gray-400 font-bold">
نسبة الفوز: <span class="text-cyan-400">${player.winRate}%</span>
</span>
<span class="w-1 h-1 bg-gray-600 rounded-full"></span>
<span class="text-gray-400 font-bold">
مباريات: <span class="text-purple-400">${player.totalGames}</span>
</span>
</div>
</div>
<!-- Stat -->
<div class="flex-shrink-0 text-right">
<div class="flex items-center gap-2 mb-1">
${iconMap[type]}
<span class="text-2xl font-black ${colorMap[type]}" style="font-family: 'Orbitron', sans-serif;">
${player[statKey]}
</span>
</div>
<p class="text-[9px] text-gray-500 font-bold uppercase tracking-wider">
${type === 'spy' ? 'SPY WINS' : type === 'innocent' ? 'INNOCENT WINS' : 'TOTAL GAMES'}
</p>
</div>
</div>
</div>
`;
}).join('');
}
// RANK LEADERBOARD
const RANK_ORDER = {Diamond:5,Platinum:4,Gold:3,Silver:2,Bronze:1};
const RANK_COLORS = {Diamond:'#00f2ff',Platinum:'#e5e4e2',Gold:'#ffd700',Silver:'#c0c0c0',Bronze:'#cd7f32'};
function loadRankLeaderboard() {
const listEl = document.getElementById('rank-leaderboard-list');
const tierEl = document.getElementById('rank-tier-counts');
const counts = {Bronze:0,Silver:0,Gold:0,Platinum:0,Diamond:0};
const now = new Date();
document.getElementById('season-name').textContent =
'موسم ' + now.toLocaleDateString('ar-SA',{month:'long',year:'numeric'});
document.getElementById('season-dates').textContent =
'ينتهي: ' + new Date(now.getFullYear(),now.getMonth()+1,0).toLocaleDateString('ar-SA');
get(ref(db,'players')).then(snap => {
if (!snap.exists()) { listEl.innerHTML='<p class="text-gray-400 text-center">لا يوجد لاعبون</p>'; return; }
const all = Object.values(snap.val()).filter(p=>p.username).map(p=>({
username:p.username, rank:p.rank||'Bronze',
rankPoints:p.rankPoints||0, totalGames:p.stats&&p.stats.totalGames||0
})).sort((a,b)=>(RANK_ORDER[b.rank]||0)-(RANK_ORDER[a.rank]||0)||b.rankPoints-a.rankPoints);
all.forEach(p=>{if(counts[p.rank]!==undefined)counts[p.rank]++;});
tierEl.innerHTML = Object.entries(counts).map(([tier,cnt])=>{
const c=RANK_COLORS[tier]||'#888';
return '<div class="text-center p-2 rounded-xl" style="background:'+c+'22;border:2px solid '+c+'44;">'
+'<p class="text-sm font-black" style="color:'+c+';">'+tier+'</p>'
+'<p class="text-lg font-black" style="color:'+c+';">'+cnt+'</p></div>';
}).join('');
listEl.innerHTML = all.slice(0,50).map((p,i)=>{
const c=RANK_COLORS[p.rank]||'#888';
const progress=Math.min(100,(p.rankPoints%1000)/10);
const medal=i===0?'🥇':i===1?'🥈':i===2?'🥉':'#'+(i+1);
return '<div class="flex items-center gap-3 p-3 rounded-xl hover:bg-white/5 transition-all" style="border:1px solid rgba(255,255,255,.05);">'
+'<span class="text-lg w-8 text-center font-bold">'+medal+'</span>'
+'<div class="flex-1 min-w-0">'
+'<p class="font-black truncate">'+p.username+'</p>'
+'<div style="height:4px;background:rgba(255,255,255,.1);border-radius:2px;margin-top:4px;overflow:hidden;">'
+'<div style="width:'+progress+'%;height:100%;background:'+c+';border-radius:2px;"></div></div></div>'
+'<div class="text-right flex-shrink-0">'
+'<p class="font-black text-sm" style="color:'+c+';">'+p.rank+'</p>'
+'<p class="text-xs text-gray-500">'+p.rankPoints+' pts</p></div></div>';
}).join('');
});
}
// Refresh Button
document.getElementById('refreshBtn').addEventListener('click', () => {
fetchLeaderboard();
});
// Initialize
fetchLeaderboard();
</script>
<script>
window.alert = (msg) => UIAlert ? UIAlert(msg) : alert(msg);
window.confirm = (msg) => UIConfirm ? UIConfirm(msg) : confirm(msg);
window.prompt = (msg, defaultVal) => UIPrompt ? UIPrompt(msg, { defaultValue: defaultVal }) : prompt(msg, defaultVal);
</script>
<script>if('serviceWorker' in navigator){window.addEventListener('load',()=>navigator.serviceWorker.register('/sw.js').catch(()=>{}));}</script>
</body>
</html>