-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
96 lines (80 loc) · 3.76 KB
/
demo.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title>Geniverse demos: Dragon chatting</title>
<script src="lib/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/chat/comet.js" type="text/javascript"></script>
<script src="lib/json2.js" type="text/javascript"></script>
<script src="lib/jquery-tooltip/jquery.tooltip.js" type="text/javascript"></script>
<script src="lib/facebox/facebox.js" type="text/javascript"></script>
<script src="/geniverse/geniverse/geniverse.nocache.js" type="text/javascript"></script>
<script src="/chat/geniversechat.js" type="text/javascript"></script>
<script src="lib/geniverse-gwt.js" type="text/javascript"></script>
<script src="lib/geniverse-view-service.js" type="text/javascript"></script>
<script src="lib/geniverse-chat-service.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/jquery.tooltip.css" type="text/css" media="screen">
<link rel="stylesheet" href="css/facebox.css" type="text/css" media="screen">
<script type="text/javascript">
var startChannel;
var alleleString;
GenView.init(function(){
startChannel = GenChatService.initChat();
});
$(function(){
$('#enterUsername').submit(function() {
jQuery.facebox("Loading...");
$('#loading').show();
var initted = false; // sometimes we log into multiple channels at once -- this prevents that
setTimeout(function(){
GenChatService.findChannelWithLeastClients(["/Smaug", "/Norbert"], function(channel){
if (!initted){
GenChatService.unsubscribe(startChannel);
currentChannel = GenChatService.subscribe(channel);
GenChatService.subscribeToAdminChannel(channel);
channelTitle = currentChannel;
if (channelTitle.slice(0,1) == "/")
channelTitle = channelTitle.substring(1);
$('#streamContainerWrapper').find('label').append(": <span id='title'>"+channelTitle+"</span>");
GenView.setOrgPostingChannel(currentChannel + "org");
alleleString = (channel == "/Smaug") ? "a:h,b:h" : "a:H,b:H";
addDragonPair();
$('#createDragons').unbind('click');
$('#createDragons').click(function(){
addDragonPair();
})
// if we get to here, both Chat and GWT are happy
jQuery(document).trigger('close.facebox')
initted = true;
}
});
},200);
});
})
function addDragonPair(){ // the functionality of having a base allele string may be basic enough to go into geniverse-gwt.js
GenView.addDragon(alleleString, 0);
GenView.addDragon(alleleString, 1);
}
</script>
</head>
<body>
<div class="container">
<h2><em>Geniverse</em> | dragon chat demo</h2>
<form id="enterUsername" style="width: 400;">
<label for="username">Pick a username</label>
<input type="text" name="username" id="username">
<input type="submit" value="Go">
</form>
<div id="app">
<div id="dragonBreedingWrapper"></div>
<div id="publicPoolWrapper"></div>
<div id="myDragonPoolWrapper"></div>
<div id="clientListWrapper"></div>
<div id="messagingWrapper" style="text-align: center;"></div>
</div>
<script type="text/javascript">
</script>
</div>
</body>
</html>