git.shiar.nl
/
sc2-widget
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
simplify code for ladder sorting
[sc2-widget]
/
widget.html
diff --git
a/widget.html
b/widget.html
index c604c5912391bc47bd3723a906c89676a45a30f9..387d3db7e16a55bf5b5be5cac63c58b1babf58d5 100644
(file)
--- a/
widget.html
+++ b/
widget.html
@@
-15,11
+15,12
@@
fetch('/schtarr/inno.json')
.then(res => res.json())
.then(clan => {
fetch('/schtarr/inno.json')
.then(res => res.json())
.then(clan => {
+ let tiernum = (rank) => rank <= 8 ? 1 : rank <= 25 ? 2 : rank <= 50 ? 3 : 4;
document.getElementById('clan').outerHTML = `
<h1>${clan.tag}</h1>
<ul class=ladders>
${clan.ladders.map(ladder => `
document.getElementById('clan').outerHTML = `
<h1>${clan.tag}</h1>
<ul class=ladders>
${clan.ladders.map(ladder => `
- <li class="rank ${ladder.league}"
+ <li class="rank ${ladder.league}
tier${tiernum(ladder.rank)}
"
title="Division ${ladder.division} (${ladder.wins}:${ladder.losses})">
${ladder.league} <small>#${ladder.rank}</small>
</li>
title="Division ${ladder.division} (${ladder.wins}:${ladder.losses})">
${ladder.league} <small>#${ladder.rank}</small>
</li>