onFOSS.hribhrib.at/template_6pRR.html

189 lines
5.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>hribhrib</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="topnav">
<a href='index.html'>Home</a> |
<a href='timetable.html'>Timetable</a> |
<a href='tournament.html'>Tournament</a> |
<a href='howto.html'>HowTo</a> |
<a href='list.html'>List</a> |
<a href='https://hribhrib.at/'>To My Homepage</a>
</div>
<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>
</div>
<div>
<h2>Scoreboard</h2>
<p>
<table>
<tr>
<th>Number</th>
<th>Nickname</th>
<th>Wins</th>
<th>Losses</th>
</tr>
<tr>
<td>1</td>
<td>A</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>2</td>
<td>B</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>3</td>
<td>C</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>4</td>
<td>D</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>5</td>
<td>E</td>
<td>0</td>
<td>0</td>
</tr>
<tr>
<td>6</td>
<td>F</td>
<td>0</td>
<td>0</td>
</tr>
</table>
</p>
</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>
<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>
<p>
1 vs 6 : X wins - Server: s1<br>
2 vs 5 : X wins - Server: s2<br>
3 vs 4 : 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>
<p>
1 vs 5 : X wins - Server: s1<br>
6 vs 4 : X wins - Server: s2<br>
2 vs 3 : 3 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>
<p>
1 vs 4 : 4 wins - Server: s1<br>
5 vs 3 : 5 wins - Server: s2<br>
6 vs 2 : 6 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>
<p>
1 vs 3 : 1 wins - Server: s1<br>
4 vs 2 : 4 wins - Server: s2<br>
5 vs 6 : 5 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>
<p>
1 vs 2 : 1 wins - Server: s1<br>
3 vs 6 : 6 wins - Server: s2<br>
4 vs 5 : 5 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>
<p>Best of 3, first vs second.</p>
<h3>Round 1</h3>
<p>4 vs 5 : X wins - Server: s1</p>
<h3>Round 2</h3>
<p>4 vs 5 : X wins - Server: s1</p>
<h3>Round 3</h3>
<p>4 vs 5 : 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>