-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbegin.html
115 lines (97 loc) · 3.86 KB
/
begin.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>Front-end Startup Template</title>
<!-- Material Design fonts -->
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
<!-- Bootstrap -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<!-- Bootstrap Material Design -->
<link rel="stylesheet" href="lib/bootstrap-material-design/dist/css/bootstrap-material-design.css">
<link rel="stylesheet" href="lib/bootstrap-material-design/dist/css/ripples.min.css">
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script src="//css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
<![endif]-->
<script src="https://cdn.socket.io/socket.io-1.2.0.js"></script>
<script src="http://code.jquery.com/jquery-1.11.1.js"></script>
<script>
var socket = io();
$(function(){
$('#start-button').on('click', function(){
socket.emit('start game', true);
});
socket.on('start game', function(data){
if(data.status == 'OK'){
window.location.reload();
}
else{
console.log('SHIT!');
}
});
socket.on('ready players', function(players){
var i = 0;
var players_html = "";
if( players ) {
for( var player_id in players ) {
var player = players[player_id];
players_html += "<tr>";
players_html += "<td>" + (i+1) + "</td>";
players_html += "<td>" + player.name + "</td>";
players_html += "<td>ИМА ГОТОВНОСТ!!1!</td>";
players_html += "</tr>";
i++;
}
}
$('#players').html(players_html)
});
socket.emit('give me players', true);
});
</script>
</head>
<body>
<div class="container">
<div class="page-header">
<h1>
Dev Quiz
<small>multiplayer game</small>
</h1>
</div>
<div class="row">
<div class="col-md-4">
<div class="jumbotron text-center">
<h1>Здравей!</h1>
<p>Хайде да поиграем.</p>
<!-- Уха, <span class="badge">5</span> играчи онлайн</p> -->
<a id="start-button" class="btn btn-primary btn-lg btn-success btn-raised" href="javascript:;">Старт, майка</a>
</div>
</div>
<div class="col-md-8">
<table class="table table-striped table-hover ">
<thead>
<tr>
<th>#</th>
<th>Играч</th>
<th>Готовност</th>
</tr>
</thead>
<tbody id="players" class="text-left">
</tbody>
</table>
</div>
</div>
</div>
<script src="lib/jquery/dist/jquery.js"></script>
<script src="lib/bootstrap-material-design/dist/js/material.js"></script>
<script src="lib/bootstrap-material-design/dist/js/ripples.js"></script>
<script>
$(function(){
$.material.init();
});
</script>
</body>
</html>