forked from meghprkh/socket-buzzer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
98 lines (83 loc) · 3.02 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Web-dev club</title>
<script src="js/jquery.min.js"></script>
<link rel="stylesheet" href="css/font-awesome.min.css">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
<!-- Latest compiled and minified JavaScript -->
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery-latest.min.js"></script>
<script type="text/javascript" src="js/TweenMax.min.js"> </script>
<script type="text/javascript" src="js/cooltext-animations.js"></script>
<script type="text/javascript" src="js/cooltext.js"></script>
<link rel="stylesheet" href="css/myStyle.css">
</head>
<body>
<img id="left" src="images/bf_flower_left.png"/>
<img id="right" src="images/bf_flower_right.png"/>
<div style="margin-top:0px;width:100%; height:280px;overflow:hidden; border-radius:20px;">
<img id="header1" src="images/header3.jpg" />
</div>
<div id="heading"> <p style="font-weight:bold;">Web-dev Club</p></div>
<div id="nav_main"> <p> Hacking is not a crime, But It's a Game Of Mind.. </p></div>
<div id="login">
Please enter the team id and buzzer password:<br />
<form id="loginForm">
<input id="loginTeam" placeholder="Team">
<input id="loginPassword" placeholder="Password" type="password">
<input type="submit">
</form>
</div>
<div id="authenticated">
<div class="row">
<div class="col-md-8">
<iframe src="/question" scrolling="no" style="width: 100%; height: 100em; border: 0; overflow: hidden"></iframe>
</div>
<div class="col-md-4">
<button class="btn btn-danger" id="buzzerButton" onClick="buzzer()">Buzzer</button>
</div>
</div>
<div id="footer">
@developed_by firstname.lastname@gmail.com
</div>
<script src="/socket.io/socket.io.js"></script>
<script>
var socket, token = localStorage.getItem('token');
if (token) onAuthenticate()
$('#authenticated').hide();
$('#loginForm').submit(function() {
$.post('/buzzerAuth', {
team: $('#loginTeam').val(),
password: $('#loginPassword').val()
}, function(tk) {
token = tk
localStorage.setItem('token', tk)
onAuthenticate()
})
return false;
})
function onAuthenticate() {
socket = io('/buzzer', {
query: "token=" + token
});
socket.on('connect', function() {
$('#login').hide();
$('#authenticated').show();
socket.on('questionBuzzable', function(buzzable) {
$('#buzzerButton').attr('disabled', !buzzable);
})
})
}
function buzzer() {
socket.emit('buzzer')
alert('You have press buzzer')
}
</script>
</body>
</html>