-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
284 lines (260 loc) · 11.1 KB
/
index.php
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="google-site-verification" content="LwDz4hv2eE2c5m5xWWDzoQxu2exz_opdbv4SpbHdli8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Room radio, room vibes and more stuff</title>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<?php include_once('config.php') ?>
<div class="video">
<video autoplay="true" loop="loop" id="bgvid">
<source src="<?php echo $server; ?>/radio.mp4" type="video/mp4">
</video>
</div>
<div id="mask">
<div><img id="onAir" src="<?php echo $server; ?>/OnAir.jpg"alt="on Air" /></div>
</div>
<div id="rightSide">
<div id="player" >
<audio id="music">
<?php echo "<source src='".$server."/listen.mp3' type='audio/mpeg' />"; ?>
</audio>
<?php echo "<img src='".$server."/image.jpg' id='image' />"; ?>
<div id="metadata">
<marquee id="marquee" scrollamount="3">
</marquee>
</div>
<button id="pButton" class="play" onmouseup="playAudio()"></button>
<button type="submit" id="winamp" class="winamp" onclick="winamp('<?php echo $server; ?> /roomRadio.m3u')"></button>
<button id="muteButton" class="mute" onmousedown="muteAudio()"></button>
<button id="youtube" class="youtube" onmousedown="youtube()"></button>
<div id="volumeContainer" onmousemove="test()" >
<div id="volume"> </div>
</div>
</div>
<div class="container">
<div class="chat">
<b>
<div id="chatZone" name="chatZone"></div>
</b>
<div id="container">
<label for="msg" id="name">
<a id="profile" hidden>Guest:</a>
</label>
<div id="login">
<fb:login-button size="medium" scope="public_profile,email" onlogin="checkLoginState();"> </fb:login-button>
</div>
<div id="disclaimer">
To chat with your facebook name, we don't care to post anything!
</div>
</div>
<form onsubmit="chat.sendMsg(); return false;">
<input type="text" id="msg" name="msg" autofocus="true" placeholder="Type Your Message Here" />
<input type="submit" />
</form>
</div>
</div>
</div>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40210398-2', 'auto');
ga('send', 'pageview');
</script>
<script type="text/javascript" src="chat.js"></script>
<script>
var music = document.getElementById('music');
var volume = document.getElementById('volume');
var volumeContainer=document.getElementById('volumeContainer');
var rect = volumeContainer.getBoundingClientRect();
var indic =false;
volumeContainer.style.width="88px";
volume.style.width="88px";
var maxVol = volume.style.width;
volumeContainer.addEventListener("mousedown", function(){
indic=true;
})
document.body.addEventListener("mouseup", function(){
indic=false;
})
function playAudio() {
if (music.paused) {
music.play();
pButton.className = "";
pButton.className = "pause";
} else {
music.pause();
pButton.className = "";
pButton.className = "play";
}
}
playAudio();
function muteAudio(){
if (music.muted==false)
{
music.muted=true;
muteButton.className = "";
muteButton.className = "mute";
}
else
{
music.muted=false;
muteButton.className = "";
muteButton.className = "unmute";
}
}
function clicked(){
indic=true;
}
function unclicked(){
indic=false;
if ( parseInt(volume.style.width,10)> parseInt(volumeContainer.style.width,10)){
volume.style.width=volumeContainer.style.width;
}
}
function test() {
if (indic==true)
{
if ( parseInt(volume.style.width,10)<= parseInt(volumeContainer.style.width,10)){
volume.style.width= event.pageX-rect.left+"px";
var percent = parseInt(volume.style.width,10)/parseInt(maxVol,10);
music.volume = percent;
}
else{volume.style.width=volumeContainer.style.width;}
}
}
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
if (!!window.EventSource) {
var source = new EventSource('stream.php');
} else {
// Result to xhr polling :(
}
source.addEventListener('message', function(e) {
document.getElementById('marquee').innerHTML=e.data;
}, false);
});
////////////////////////
function youtube()
{
var url="http://www.youtube.com/results?search_query="
window.open(url+document.getElementById('marquee').innerHTML,'_blank');
}
///////////////////////
function winamp(file)
{
window.open(file,'_blank');
}
///Image size
var image=document.getElementById('image');
var initialWidth=parseInt(image.style.width,10);
var initialHeight=parseInt(image.style.height,10);
image.style.height = "220px";
if (initialWidth/initialHeight*parseInt(image.style.height,10) < 300)
image.style.width = initialWidth/initialHeight*parseInt(image.style.height,10)+"px";
else
image.style.width="230px";
// image.src="http://roomradio.com/image.jpg?nocache="+n;
///////////refresh Image
function refresh_image() {
var d = new Date();
var n = d.getTime();
image.src="<?php echo $server; ?>/image.jpg?nocache="+n;
setTimeout( refresh_image, 20000 ); // <-- when you ge a response, call it // again after a 4 second delay
}
refresh_image();
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40210398-2', 'auto');
ga('send', 'pageview');
</script>
<script>
// This is called with the results from from FB.getLoginStatus().
function statusChangeCallback(response) {
console.log('statusChangeCallback');
// The response object is returned with a status field that lets the
// app know the current login status of the person.
// Full docs on the response object can be found in the documentation
// for FB.getLoginStatus().
if (response.status === 'connected') {
var access_token=response.authResponse.accessToken;
testAPI(access_token);
// testAPI();
} else if (response.status === 'not_authorized') {
// The person is logged into Facebook, but not your app.
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
} else {
// The person is not logged into Facebook, so we're not sure if
// they are logged into this app or not.
document.getElementById('status').innerHTML = 'Please log ' +
'into Facebook.';
}
}
// This function is called when someone finishes with the Login
// Button. See the onlogin handler attached to it in the sample
// code below.
function checkLoginState() {
FB.getLoginStatus(function(response) {
statusChangeCallback(response);
});
}
window.fbAsyncInit = function() {
FB.init({
appId : '771848356225352',
cookie : true, // enable cookies to allow the server to access
// the session
xfbml : true, // parse social plugins on this page
version : 'v2.1' // use version 2.1
});
// Now that we've initialized the JavaScript SDK, we call
// FB.getLoginStatus(). This function gets the state of the
// person visiting this page and can return one of three states to
// the callback you provide. They can be:
//
// 1. Logged into your app ('connected')
// 2. Logged into Facebook, but not your app ('not_authorized')
// 3. Not logged into Facebook and can't tell if they are logged into
// your app or not.
//
// These three cases are handled in the callback function.
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
// console.log(response.authResponse.accessToken);
}
});
};
// Load the SDK asynchronously
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
// Here we run a very simple test of the Graph API after login is
// successful. See statusChangeCallback() for when this call is made.
function testAPI(access_token) {
console.log('Welcome! Fetching your information.... ');
FB.api('/me', function(response) {
name=response.name;
profile=response.link;
chat_container="<?php echo $server; ?>/chatContainer.php?name="+encodeURIComponent(name)+"&profile="+profile+"&access_token="+access_token;
$('#container').load(chat_container);
return false;
});
}
</script>
</div>
</body>
</html>