add openhv scoreboard

This commit is contained in:
c 2021-09-10 15:33:17 +02:00
parent 0b113d2480
commit 03bd227a6a
1 changed files with 38 additions and 98 deletions

View File

@ -17,10 +17,14 @@
<div>
<h1>Scoreboard of OpenHV-Tournament</h1>
<p>This site uses JavaScript to determine your localtime.</p>
<h2>Gamesettings</h2>
<p>1vs1. Map: "Beyond Destruction" (2 players, large, by Dzierzan)</p>
<h3>Players</h3>
<p>1vs1.</p>
<h3>Tournament structure</h3>
<p>Round Robin</p>
<h3>Map</h3>
<p>Only 2 player maps are allowed! Maps are choosen by the opponens before each match. If they can not agree on a map, "Beyond Destruction" (2 players, large, by Dzierzan) should be choosen.</p>
<p>Maplist: Antifreeze, Beyond Destruction, Business As Usual, Crescendo, Diminisching Results, Fire Souls, Green Greens (no particular order)</p>
</div>
<div>
<h2>Scoreboard</h2>
@ -34,37 +38,37 @@
</tr>
<tr>
<td>1</td>
<td>A</td>
<td>Rampoina</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>2</td>
<td>B</td>
<td>poVoq</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>3</td>
<td>C</td>
<td>comrad</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>4</td>
<td>D</td>
<td>Felix</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>5</td>
<td>E</td>
<td>emorrp1</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>6</td>
<td>F</td>
<td>Odourless</td>
<td>0</td>
<td>0</td>
</tr>
@ -73,116 +77,52 @@
</div>
<div>
<h2>Play-offs <span class="localetime" data-unixtime="1631370600">14:30 UTC</span> - <span class="localetime" data-unixtime="1631379600">17:00 UTC</span></h2>
<h2>Play-offs 14:30 UTC - 17:00 UTC</h2>
<p>Round-robin of all participants.</p>
<h3>Round 1 / <span class="localetime" data-unixtime="1631370600">14:30 UTC</span> - <span class="localetime" data-unixtime="1631372400">15:00 UTC</span></h3>
<h3>Round 1 / 14:30 UTC - 15:00 UTC</h3>
<p>
1 vs 6 : X wins - Server: s1<br>
2 vs 5 : X wins - Server: s2<br>
3 vs 4 : X wins - Server: s3
Rampoina vs Odourless : X wins - Server: s1<br>
poVoq vs emorrp1 : X wins - Server: s2<br>
comrad vs Felix : X wins - Server: s3
</p>
<h3>Round 2 / <span class="localetime" data-unixtime="1631372400">15:00 UTC</span> - <span class="localetime" data-unixtime="1631374200">15:30 UTC</span></h3>
<h3>Round 2 / 15:00 UTC - 15:30 UTC</h3>
<p>
1 vs 5 : X wins - Server: s1<br>
6 vs 4 : X wins - Server: s2<br>
2 vs 3 : 3 wins - Server: s3
Rampoina vs emorrp1 : X wins - Server: s1<br>
Odourless vs Felix : X wins - Server: s2<br>
poVoq vs comrad : X wins - Server: s3
</p>
<h3>Round 3 / <span class="localetime" data-unixtime="1631374200">15:30 UTC</span> - <span class="localetime" data-unixtime="1631376000">16:00 UTC</span></h3>
<h3>Round 3 / 15:30 UTC - 16:00 UTC</h3>
<p>
1 vs 4 : 4 wins - Server: s1<br>
5 vs 3 : 5 wins - Server: s2<br>
6 vs 2 : 6 wins - Server: s3
Rampoina vs Felix : X wins - Server: s1<br>
emorrp1 vs comrad : X wins - Server: s2<br>
Odourless vs poVoq : X wins - Server: s3
</p>
<h3>Round 4 / <span class="localetime" data-unixtime="1631376000">16:00 UTC</span> - <span class="localetime" data-unixtime="1631377800">16:30 UTC</span></h3>
<h3>Round 4 / 16:00 UTC - 16:30 UTC</h3>
<p>
1 vs 3 : 1 wins - Server: s1<br>
4 vs 2 : 4 wins - Server: s2<br>
5 vs 6 : 5 wins - Server: s3
Rampoina vs comrad : X wins - Server: s1<br>
Felix vs poVoq : X wins - Server: s2<br>
emorrp1 vs Odourless : X wins - Server: s3
</p>
<h3>Round 5 / <span class="localetime" data-unixtime="1631376000">16:30 UTC</span> - <span class="localetime" data-unixtime="1631379600">17:00 UTC</span></h3>
<h3>Round 5 / 16:30 UTC - 17:00 UTC</h3>
<p>
1 vs 2 : 1 wins - Server: s1<br>
3 vs 6 : 6 wins - Server: s2<br>
4 vs 5 : 5 wins - Server: s3
Rampoina vs poVoq : X wins - Server: s1<br>
comrad vs Odourless : X wins - Server: s2<br>
Felix vs emorrp1 : X wins - Server: s3
</p>
</div>
<div>
<h2>Finals / <span class="localetime" data-unixtime="1631381400">17:30 UTC</span> - <span class="localetime" data-unixtime="1631386800">19:00 UTC</span></h2>
<h2>Finals / 17:30 UTC - 19:00 UTC</h2>
<p>Best of 3, first vs second.</p>
<h3>Round 1</h3>
<p>4 vs 5 : X wins - Server: s1</p>
<p>A vs B : X wins - Server: s1</p>
<h3>Round 2</h3>
<p>4 vs 5 : X wins - Server: s1</p>
<p>A vs B : X wins - Server: s1</p>
<h3>Round 3</h3>
<p>4 vs 5 : X wins - Server: s1</p>
<p>A vs B : X wins - Server: s1</p>
</div>
</div>
<script>
/*
Setze als "data-unixtime" die Unixtime des Datums.
Die Unixtime kann leicht auf dem Terminal erstellt werden:
date -d '2021-05-22 12:00:00 UTC+2' +%s
Javascript wird den Textinhalt des Elements mit der Klasse
"localtime" durch ein lokalisiertes Datum ersetzen.
Als Fallback, falls Javascript deaktiviert ist oder ein
anderer Fehler im Javascript passiert, setze auch noch ein
Ausgeschriebenes Datum welches in jedem Fall angezeigt wird.
<span class="localetime" data-unixtime="1621677600">22.5.2021, 12:00 MESZ (Placeholder)</span>
Dieses Script Element an das Ende des body Elements platzieren.
Die Kommentare kannst du im Produktiveinsatz natürlich entfernen.
*/
//function to add Zeros in time if missing
function addZero(i) {
if (i < 10) {
i = "0" + i;
}
return i;
}
// Optionen für die Datumsausgabe
let options = {year: 'numeric', month: 'numeric', day: 'numeric',
hour: 'numeric', minute: 'numeric',
timeZoneName: 'short'}
// Sprache des Browsers auslesen
const userLang = navigator.language || navigator.userLanguage
// Alle vorkommenden elemente mit der class "localetime"
// finden
var elements = document.querySelectorAll('.localetime')
// Durch die gefundenen elemente iterieren
elements.forEach((elem) => {
// Unixtime auslesen
var utime = elem.getAttribute("data-unixtime")
// Unixtime in Date objekt umrechnen
var event = new Date(utime * 1000)
// Datum anhand der locale, timezone und sprache erstellen
var date = new Date(event.toLocaleDateString(userLang, options))
// Wenn Date object valide ist den HTML Inhalt der
// Klasse überschreiben
if( ! isNaN ( event ) && utime !== '') {
//calculate utc offset
var currentTimezone = date.getTimezoneOffset();
currentTimezone = (currentTimezone/60) * -1;
var utc = 'UTC';
if (currentTimezone !== 0) {
utc += currentTimezone > 0 ? '+' : ' ';
utc += currentTimezone;
}
//concat string
var str = addZero(date.getHours())+':'+addZero(date.getMinutes())+' '+utc
elem.innerHTML = str
}
});
</script>
</body>
</html>