-
Notifications
You must be signed in to change notification settings - Fork 8
/
watch.htm
82 lines (73 loc) · 3.27 KB
/
watch.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<!DOCTYPE html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css">
<!-- Watch page specific -->
<link rel="stylesheet" href="css/bootstrap-sortable.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<!-- Watch page specific -->
<script src="js/bootstrap-sortable.js"></script>
<script>
function fillPlayerTable(games) {
$( "#livegames tbody" ).empty();
_.each(games, function(e) {
tr = $( "<tr/>" );
tr.append($("<td/>").text(e['name']));
tr.append($("<td/>").text(e['version']));
tr.append($("<td/>").text(e['XL']));
tr.append($("<td/>").text(e['species']));
tr.append($("<td/>").text(e['background']));
tr.append($("<td/>").text(e['branch'] + ":" + e['branchlevel']));
tr.append($("<td/>").text(e['idle'] + " seconds"));
tr.append($("<td/>").text(e['spectators']));
tr.append($("<td/>").append($("<a/>").text("Watch now.").attr('href', e['watchurl'])));
$( "#livegames tbody" ).append(tr);
});
$.bootstrapSortable();
}
function networkError(error) {
$( "#livegames tbody" ).empty();
tr = $( "<tr/>" );
tr.append($("<td/>").text("Network error, try again :("));
$( "#livegames tbody" ).append(tr);
}
var data = $.get('dgl-status.json');
data.done(fillPlayerTable).fail(networkError);
</script>
</head>
<body>
<div class="container">
<div class="page-header">
<center>
<a href="index.htm"><img class="img-responsive" src="logo.png" title="Dungeon Crawl Stone Soup" width="790px" height="152px"></a>
</center>
</div>
<h2>Live Games</h2>
<table class="table sortable" id="livegames">
<thead>
<tr>
<th>Nick</th>
<th>Version</th>
<th>XL</th>
<th>Species</th>
<th>Background</th>
<th>Place</th>
<th>Idle</th>
<th>Spectators</th>
<th>Watch link</th>
</tr>
</thead>
<tbody>
<tr>
<th>Loading...</th>
</tr>
</tbody>
</table>
<hr>
<p class="small text-right">You are too berserk!</p>
</div>
</body>
</html>