minecraft-site/index.html

64 lines
2.0 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>ChandlerSwift.com Minecraft</title>
<style>
body{margin:1em auto;max-width:40em;padding:0 .62em;font:1.2em sans-serif; line-height: 1.62em;}h1,h2,h3{line-height:1.2em;}@media print{body{max-width:none}}
/* https://html.spec.whatwg.org/multipage/rendering.html#phrasing-content-3 */
.light {
color: #888;
}
.light a {
color: #88f;
}
.light a:hover {
color: #00e;
}
.light a:visited {
color: #a9b;
}
.light a:visited:hover {
color: #518;
}
:not(:hover) .optional-port {
color: #666;
}
</style>
<link rel="shortcut icon" href="https://chandlerswift.com/favicon.ico" />
</head>
<body>
<header>
<h1>{{.Title}}</h1>
<p>{{.Content}}</p>
</header>
{{range .Servers}}
<section>
<h2 style="margin-bottom: 0;"><code>{{.Host}}{{if eq .Port 25565}}<span class="optional-port">:{{.Port}}</span>{{else}}:{{.Port}}{{end}}</code></h2>
{{if .Status}}
<span style="color: #666; font-style: italic;">{{.Status.Description.String}}</span>
<ul>
<li>Minecraft Version: {{.Status.VersionName}}</li>
<li>Players Online: {{.Status.OnlinePlayers}}/{{.Status.MaxPlayers}}
{{if gt .Status.OnlinePlayers 0}}
<ul>
{{range $i, $player := .Status.SamplePlayers}}
<li>{{$player.Nickname}}</li>
{{end}}
</ul>
{{end}}
</li>
</ul>
{{else}}
<span style="color: #666;">Unable to connect to server to check status</span>
{{end}}
</section>
{{end}}
<p class="light">
This page maintained by chandlerswift's <a href="https://git.chandlerswift.com/chandlerswift/minecraft-site">minecraft server list</a>.
<a href="/data.json">API at /data.json</a>.
</p>
</body>
</html>