-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.html
More file actions
199 lines (168 loc) · 4.87 KB
/
users.html
File metadata and controls
199 lines (168 loc) · 4.87 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>Cybersecurity Marathon Leaderboard</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap" rel="stylesheet" />
<style>
* { box-sizing: border-box; }
body {
margin: 0;
padding: 2rem;
font-family: 'Inter', sans-serif;
background-color: #0d1117;
color: #f0f6fc;
}
h1 {
text-align: center;
color: #58a6ff;
margin-bottom: 2rem;
}
h1 a {
text-align: center;
color: #58a6ff;
cursor: pointer;
}
.search-bar {
display: flex;
justify-content: center;
margin-bottom: 2rem;
}
.search-bar input {
width: 100%;
max-width: 400px;
padding: 0.75rem 1rem;
border: 1px solid #30363d;
border-radius: 0.5rem;
background-color: #161b22;
color: #f0f6fc;
font-size: 1rem;
}
.scoreboard {
max-width: 800px;
margin: 0 auto;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.rank-row {
display: flex;
justify-content: space-between;
align-items: center;
background-color: #21262d;
border: 1px solid #30363d;
border-radius: 0.5rem;
padding: 0.75rem 1rem;
font-size: 1rem;
}
.rank-cell {
flex: 1;
text-align: left;
}
.rank-cell.rank {
max-width: 2.5rem;
text-align: right;
color: #8b949e;
font-weight: 600;
}
.rank-cell.name {
padding-left: 1rem;
font-weight: 600;
}
.rank-cell.school {
padding-left: 1rem;
font-weight: 600;
color: #8b949e
}
.rank-cell.points {
text-align: right;
}
.rank-row.medal-1 {
border-color: gold;
box-shadow: 0 0 10px gold;
}
.rank-row.medal-2 {
border-color: silver;
box-shadow: 0 0 10px silver;
}
.rank-row.medal-3 {
border-color: #cd7f32; /* bronze */
box-shadow: 0 0 10px #cd7f32;
}
.badge {
background: #238636;
color: white;
padding: 0.25rem 0.6rem;
font-size: 0.75rem;
border-radius: 0.25rem;
}
.no-results {
text-align: center;
opacity: 0.7;
font-style: italic;
margin-top: 1rem;
}
</style>
</head>
<body>
<div style="width: 100%; display: flex; justify-content: center;">
<div style="display: flex; align-items: center;">
<img src="logo.png" alt="Logo" style="height: 60px; margin-right: 15px; margin-bottom: 16px;">
<h1><a href="/">Cybersecurity Marathon Leaderboard</a></h1>
<img src="logo.png" alt="Logo" style="height: 60px; margin-left: 15px; margin-bottom: 16px;">
</div>
</div>
<div class="search-bar">
<input type="text" id="searchInput" placeholder="Search by name..." />
</div>
<div class="scoreboard" id="user-scoreboard"></div>
<div class="no-results" id="no-results" style="display: none;">No users found.</div>
<script>
let usersData = [];
async function loadUserRanks() {
const response = await fetch("training_winners_data.json");
const data = await response.json();
const users = data.users;
// Attach original rank to each user
usersData = users.map((entry, index) => ({
...entry,
rank: index + 1
}));
renderUserRows(usersData);
}
function renderUserRows(data) {
const container = document.getElementById("user-scoreboard");
const noResults = document.getElementById("no-results");
container.innerHTML = "";
if (data.length === 0) {
noResults.style.display = "block";
return;
}
noResults.style.display = "none";
data.forEach((entry) => {
const medalClass = entry.rank === 1 ? "medal-1" :
entry.rank === 2 ? "medal-2" :
entry.rank === 3 ? "medal-3" : "";
container.innerHTML += `
<div class="rank-row ${medalClass}">
<div class="rank-cell rank">${entry.rank}</div>
<div class="rank-cell name">${entry.full_name}</div>
<div class="rank-cell school">${entry.university}</div>
<div class="rank-cell points"><span class="badge">${entry.total_points} pts</span></div>
</div>
`;
});
}
document.getElementById("searchInput").addEventListener("input", (e) => {
const searchTerm = e.target.value.toLowerCase();
const filtered = usersData.filter(u => u.full_name.toLowerCase().includes(searchTerm));
renderUserRows(filtered);
});
loadUserRanks();
</script>
</body>
</html>