-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaltater.html
244 lines (206 loc) · 8.25 KB
/
altater.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Exodus Altater Cup Leaderboard">
<meta property="og:description" content="How do you stack up to other potatoes?">
<meta property="og:url" content="https://neokat.github.io/altater">
<meta http-equiv='cache-control' content='no-cache'>
<meta http-equiv='expires' content='0'>
<meta http-equiv='pragma' content='no-cache'>
<title>Exodus Altater Cup Leaderboard</title>
<link rel="icon" href="https://imagizer.imageshack.com/img922/9420/eRxVah.png" type="image/x-icon">
<style>
html, body {
overflow: hidden;
margin: 0;
padding: 0;
height: 100%;
}
body {
background-image: url("https://imagizer.imageshack.com/img923/3796/vK5CCI.png");
background-repeat: repeat;
}
#header {
width: 100%;
text-align: center;
align-items: center;
box-sizing: border-box;
position: fixed;
top: 0;
z-index: 1000;
transition: height 0.3s, padding 0.3s;
}
#header img {
width: 60%; /* Adjust the size as needed */
height: auto;
}
#content {
width: 100%;
box-sizing: border-box;
overflow-y: auto;
position: relative; /* Added positioning context */
max-height: calc(100vh - 70px); /* Adjust based on the header height */
}
#spuds {
font-family: Verdana, Helvetica, sans-serif;
border-collapse: collapse;
width: 85%;
margin: auto;
}
#spuds td, #spuds th {
border: 2px solid #4f4f4f;
padding: 4px;
text-align: right !important;
}
#spuds tr:nth-child(even) {
background-color: #f2f2f2;
}
#spuds tr:nth-child(odd) {
background-color: #d9d9d9;
}
#spuds th {
padding-top: 12px;
padding-bottom: 12px;
text-align: left;
background-color: #EBC84D;
color: #000000;
}
@media only screen and (max-width: 730px) {
#spuds td:nth-child(3),
#spuds th:nth-child(3),
#spuds td:nth-child(4),
#spuds th:nth-child(4),
#spuds td:nth-child(5),
#spuds th:nth-child(5),
#spuds td:nth-child(6),
#spuds th:nth-child(6),
#spuds td:nth-child(9),
#spuds th:nth-child(9) {
display: none;
}
.yellow-box {
font-size: 10px;
}
#header img {
width: 80%; /* Adjust the size as needed */
height: auto;
}
}
.yellow-box {
background-color: #EBC84D;
padding: 4px;
font-family: Verdana, Helvetica, sans-serif;
width: 85%;
margin: auto;
box-sizing: border-box;
text-align: center;
}
</style>
</head>
<body>
<div id="header">
<img src="https://imagizer.imageshack.com/img924/9630/m2LMWs.png" alt="Exodus Altater Cup Banner">
</div>
<div id="content">
<div class="yellow-box">
<b>NOTE: This scoreboard is updated semi-automatically!</b> Every time we visit your stats page, the data is
scraped and populates on the scoreboard. The "last updated" column tells when the data was last pulled for each
person. If you aren't seeing up-to-date stats, first try to do a hard refresh <b>(cmd+shift+R</b> on
mac or <b>ctrl+shift+R</b> on windows) to make your browser pull fresh data. If it's still out-of-date, bug
Kat or Samara to refresh it :P
</div>
<br><br>
<table id="spuds">
<thead>
<tr>
<th>TEAM</th>
<th>USERNAME</th>
<th>YYB WINS</th>
<th>SLSL PLAYS</th>
<th>MSN PLAYS</th>
<th>SOSD PLAYS</th>
<th>TOTAL POINTS</th>
<th>RANK</th>
<th>LAST UPDATED (NST)</th>
</tr>
</thead>
<tbody>
<!-- Data will be populated here -->
</tbody>
</table>
<br><br><br><br>
</div>
<script>
document.addEventListener('DOMContentLoaded', function () {
// Initial setting of the margin-top for #content
let headerImg = document.querySelector('#header img');
let contentBox = document.querySelector('#content');
function adjustContentTop() {
let headerHeight = headerImg.getBoundingClientRect().height;
contentBox.style.top = headerHeight + 'px';
contentBox.style.maxHeight = `calc(100vh - ${headerHeight}px)`;
}
// Add onload event listener to the header image
headerImg.onload = function () {
adjustContentTop();
};
// Adjust the margin dynamically based on header image size
window.addEventListener('resize', adjustContentTop);
fetch('altater_scores.json')
.then(response => response.json())
.then(scores => {
scores.sort((a, b) => b.total_score - a.total_score);
const scoresTableBody = document.getElementById('spuds').getElementsByTagName('tbody')[0];
scores.forEach(score => {
const row = scoresTableBody.insertRow();
const cellTeamLogo = row.insertCell();
const img = document.createElement('img');
img.src = score.team_logo;
img.height = 40;
img.alt = score.team_name;
cellTeamLogo.style.setProperty("text-align", "center", "important");
cellTeamLogo.appendChild(img);
const cellUsername = row.insertCell();
const link = document.createElement('a');
link.href = 'https://www.neopets.com/altador/colosseum/userstats.phtml?username=' + score.username;
link.textContent = score.username;
link.target = '_blank';
cellUsername.appendChild(link);
const cellYybWins = row.insertCell();
cellYybWins.textContent = score.yyb_wins;
const cellSlslGames = row.insertCell();
cellSlslGames.textContent = score.slsl_wins;
const cellMsnPlays = row.insertCell();
cellMsnPlays.textContent = score.msn_plays;
const cellSosdPlays = row.insertCell();
cellSosdPlays.textContent = score.sosd_plays;
const cellTotalScore = row.insertCell();
cellTotalScore.textContent = score.total_score;
const cellRank = row.insertCell();
cellRank.textContent = score.rank;
const cellLastUpdated = row.insertCell();
cellLastUpdated.textContent = score.last_updated;
});
})
.catch(error => {
console.error('Error fetching the JSON data:', error);
});
function adjustHeaderOnScroll() {
// Calculate the scroll percentage
let scrollTop = contentBox.scrollTop;
let maxScrollTop = contentBox.scrollHeight - contentBox.clientHeight;
let scrollPercentage = scrollTop / maxScrollTop;
// Adjust the header image width based on scroll percentage
let newWidth = Math.max(30, 60 - scrollPercentage * 30); // Example range from 60% to 30%
headerImg.style.width = newWidth + '%';
}
// Add scroll event listener to contentBox
contentBox.addEventListener('scroll', function () {
adjustHeaderOnScroll();
adjustContentTop();
});
});
</script>
</body>
</html>