-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclient.html
More file actions
219 lines (204 loc) · 7.4 KB
/
client.html
File metadata and controls
219 lines (204 loc) · 7.4 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html>
<head>
<script src="javascript/jquery.min.js"></script>
<meta charset="utf-8" />
<title>Surprise!</title>
<link href="css/bootstrap-combined.min.css" rel="stylesheet">
<script src="javascript/bootstrap.min.js"></script>
<script src="javascript/jquery.transit.js"></script>
<script src="javascript/client.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36344182-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<style>
body {
width: 100%;
height: 600px;
}
.square {
position: absolute;
z-index: 2;
left: 0px;
top: 0px;
display: none;
}
.girl {
position: absolute;
left: 0px;
top: 0px;
width: 100px;
height: 100px;
display: none;
}
.gift {
position: absolute;
left: 0px;
top: 0px;
font-size: 8px;
color: black;
display: none;
}
#news_data {
position: absolute;
width: 320px;
right: 0px;
top: 0px;
}
#speak {
font-size: 26px;
}
</style>
</head>
<body>
<div class="row-fluid">
<div class="span2">
<table class="table" style="z-index: 99;">
<tr>
<td>
<h4>2012 Nodejs Knockout</h4>
<div id="vote">Support us</div>
<iframe src="http://nodeknockout.com/iframe/mr-tvbs" frameborder=0 scrolling=no allowtransparency=true width=115 height=25></iframe>
</td>
</tr>
<tr>
<td>
<select id="lang_select">
<option value="en">English</option>
<option value="zh">繁體中文</option>
<option value="ja">日本語</option>
</select>
</td>
</tr>
<tr>
<td>
<h4><span id="sidebar_title">Give Any a present</span><i class="icon-gift"></i></h4>
<input type="text" id="text" placeholder="text or image url">
<input type="button" id="send" value="Send">
</td>
</tr>
<tr>
<td>
<div class="fb-login-button" data-show-faces="true" data-width="100" data-max-rows="1"></div>
</td>
</tr>
<tr>
<td>
<label>
<span id="online_user">Online user</span>: <span id="nowClient">0</span>
<span id="person"></span>
</label>
<table id="client_data" class="table table-bordered"></table>
</td>
</tr>
</table>
</div>
<table id="news_data" class="table table-bordered"></table>
</div>
<div id="bubble" class="square">
<table>
<tr>
<td id="speak"></td>
</tr>
</table>
</div>
<div id="any" class="girl">
<img />
</div>
<div id="gift" class="gift"></div>
<div id="fb-root"></div>
</body>
<script src="/socket.io/socket.io.js"></script>
<script type="text/javascript">
var username = "";
var chk_username = setInterval(function () {
if (username != "") {
letsPlay();
clearInterval(chk_username);
}
}, 500);
var hostname = "mr-tvbs.nko3.jitsu.com";
//facebook login event
window.fbAsyncInit = function () {
FB.init({
appId: '301129303330641',
channelUrl: '//' + hostname + "/channel.html",
xfbml: true
});
//when login fb, refresh this page
FB.Event.subscribe('auth.statusChange', function (response) {
if (response.status === 'connected') {
if (username.search("Guest - ") != -1)
location.href = "/client.html";
}
else {
location.href = "/";
}
});
var isLoginFB = function () {
FB.getLoginStatus(function (response) {
if (response.status === 'connected') {
FB.api('/me', function (response) {
username = response.name;
});
} else {
username = "Guest - " + new Date().getTime();
}
});
};
isLoginFB();
setInterval(isLoginFB, 5000);
};
(function (d, debug) {
var js, id = 'facebook-jssdk',
ref = d.getElementsByTagName('script')[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement('script');
js.id = id;
js.async = true;
js.src = "//connect.facebook.net/en_US/all" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, false));
//disable input box
disableSpeak("y");
function disableSpeak(yorn) {
if (yorn == "y") {
$("#text").prop("disabled", true);
$("#send").prop("disabled", true);
} else if (yorn = "n") {
$("#text").prop("disabled", false);
$("#send").prop("disabled", false);
}
}
//bubble setting
function appearBubble(left, top, text) {
$("#bubble").css("left", left + "px");
$("#bubble").css("top", top + "px");
$("#speak").html(text);
$("#bubble").fadeIn();
}
//Any setting
function appearAny(left, top, img) {
$("#gift").fadeOut();
$("#gift").css("z-index", "1");
$("#bubble").hide(0);
$("#any").show(0);
$("#any").css("left", left + "px");
$("#any").css("top", top + "px");
if (img.search("http://") != -1) {
$("#any").html("<img src='" + img + "'>");
} else {
$("#any img").prop("src", $("#" + img).prop("src"));
}
}
</script>
</html>