-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgame_setup.html
69 lines (51 loc) · 2.33 KB
/
game_setup.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
<!DOCTYPE html>
<html>
<head>
<title>S3 Groupchat Example</title>
<link href="css/hello.css" media="screen" rel="stylesheet" type="text/css" />
<!--<script type="text/javascript" src="http://crypto-js.googlecode.com/files/2.0.0-crypto-sha1.js"></script>-->
<script src="js/deps/md5.js" type="text/javascript"></script>
<script src="js/deps/base64.js" type="text/javascript"></script>
<script src="js/deps/strophe.js" type="text/javascript"></script>
<script src="js/deps/jquery-1.4.2.js" type="text/javascript"></script>
<script src="js/deps/jquery-ui-1.8.2.custom.min.js" type="text/javascript"></script>
<script src="js/deps/jquery.url.js" type="text/javascript"></script>
<script src="js/sail.js/sail.rollcall.js" type="text/javascript"></script>
<script src="js/sail.js/sail.strophe.js" type="text/javascript"></script>
<script src="js/game.js" type="text/javascript"></script>
<script type='text/javascript'>
var groupchat
Sail.Strophe.onConnectSuccess = function() {
groupchat = Sail.Strophe.joinGroupchat('s3@conference.proto.encorelab.org')
groupchat.addHandler(function(msg) {
msg = $(msg).find('body').text();
console.log("----------------------------------");
console.log(msg);
//$('#chatlog').append($(msg).find('body').text()+"<br />")
})
$('#setWordButton').click(function() {
answer = $('#answer').val();
event = {"type":"setword", "content": answer};
groupchat.sendJSON(event);
alert("Ok, New word has been set");
// rollcall = new Sail.Rollcall.Client('http://rollcall.proto.encorelab.org')
// token = rollcall.getCurrentToken()
// window.location.href = '/sail.HelloWorld/game_answer.html?token='+token;
})
}
$(document).ready(function() {
$('#goto').attr('href', $('#goto').attr('href')+rollcall.getCurrentToken())
})
</script>
<meta name="csrf-param" content="authenticity_token"/>
</head>
<body>
<a id="goto" href="game_answer.html?token=">GO TO ANSWER</a>
<h1>Congratulations, You win!</h1>
<h2>Now you get to pick the next word:</h2>
<form method='GET' onsubmit='return false;'>
<input type='text' id='answer' name='answer'>
<input type='button' id='setWordButton' value='Set Correct Answer'>
</form>
</body>
</html>