-
Notifications
You must be signed in to change notification settings - Fork 0
/
members.html
77 lines (68 loc) · 1.95 KB
/
members.html
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
<!DOCTYPE html>
<html>
<head>
<title>Presidents Servers -- Alpha</title>
<link rel="stylesheet" href="members.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
</head>
<script src="/socket.io/socket.io.js"></script>
<body>
<div id="wrapper">
<div id="header">
<img src="logo.png">
<div id="control-box">
<button id="refresh">refresh</button>
<button id="start">start</button>
</div>
</div>
<div id="content">
<div class="member-entry">
<div class="player-number">Order</div>
<div class="player-name">Username</div>
<div class="player-rank">Rank</div>
</div>
<div class="member-entry">
<div class="player-number">1</div>
<div class="player-name">joebob3</div>
<div class="player-rank">low scum</div>
</div>
<div class="member-entry">
<div class="player-number">2</div>
<div class="player-name">jimbo</div>
<div class="player-rank">low scum</div>
</div>
</div>
</div>
<script>
var socket = io();
$('#joinButton').click(function()
{
socket.emit('name', $('#nameField').val());
$('#nameField').val('');
return false;
});
$('#refresh').click(function()
{
socket.emit('refresh');
});
var newMemberEntry = function(num, name, rank)
{
var root = $('<div>').attr('class', 'member-entry');
root
.append( $('<div>').attr('class', 'player-number').text(num) )
.append( $('<div>').attr('class', 'player-name').text(name) )
.append( $('<div>').attr('class', 'player-rank').text(rank) );
return root;
}
var writeMemberList = function( array )
{
$('#content .member-entry:gt(0)').remove();
for (var i = 0; i < array.length; i++)
{
$('#content').append(newMemberEntry(i, array[i].name, array[i].rank));
}
};
socket.on('refreshed-member-list', writeMemberList);
</script>
</body>
</html>