-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
81 lines (66 loc) · 1.95 KB
/
index.html
File metadata and controls
81 lines (66 loc) · 1.95 KB
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
<!doctype html>
<html lang="en">
<head>
<title>140 Race</title>
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0">
<meta charset="utf-8">
<script src="/socket.io/socket.io.js"></script>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
<div class="base">
<div class="login">
<div class="header">
<img src="/img/logo.png" class="logo">
<span class="login-bt">Login</span>
</div>
</div>
<div class="welcome none">
<div class="header">
<img src="/img/logo.png" class="logo">
<h2 class="title">Welcome!</h2>
<p class="username">@re2005</p>
<h3 class="title-s">Waiting other player to connect</h3>
</div>
</div>
<div class="preparing none">
<div class="header">
<img src="/img/logo.png" class="logo">
<p class="x"> X </p>
<div class="users">
<p class="username">@re2005</p>
<p class="username">@edse</p>
</div>
<h3 class="title-s">Get ready!</h3>
<span id="score" class="preparing-counter"> </span>
<div id="hashtags">
</div>
</div>
</div>
</div>
<script src="/js/jquery.min.js"></script>
<script src="/js/140race.js"></script>
<script>
// click play and start to wait
$('.login-bt').on('click', function () {
$('.login').addClass('none');
$('.welcome').removeClass('none');
$('.preparing').addClass('none');
var socket = io.connect(location.protocol + '//' + location.hostname, 8888);
// waiting is over
socket.on('go', function () {
$('.login').addClass('none');
$('.welcome').addClass('none');
$('.preparing').removeClass('none');
socket.emit('gimmehashtags');
socket.on('hashtag', function (data) {
el = document.createElement('a');
el.href = '/'+data.text;
el.innerHTML = '#'+data.text;
$('#hashtags').prepend(el);
});
});
});
</script>
</body>
</html>