simple page to parse and display inno.json include
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 30 Apr 2019 23:11:39 +0000 (01:11 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 1 May 2019 15:16:58 +0000 (17:16 +0200)
widget.html [new file with mode: 0644]

diff --git a/widget.html b/widget.html
new file mode 100644 (file)
index 0000000..88d5285
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+<meta charset="utf-8" />
+<title>StarCraft ][ Clan summary</title>
+</head>
+
+<body>
+<p id="clan">No clan data</p>
+<script>
+       fetch('/schtarr/inno.json')
+       .then(res => res.json())
+       .then(json => {
+               let out = document.getElementById('clan');
+               out.innerHTML = `<h1>${json.tag}</h1><h2 title="Division ${json.division}">${json.league} <small>#${json.rank}</small></h2>`
+                       + json.members.map(member => `<a href="${member.profileUrl}"><img src="${member.avatarUrl}" title="${member.name}" /></a>`).join('');
+       })
+       .catch(error => console.log(error))
+</script>
+</body>
+
+</html>