forked from dsingleton/now-playing-radiator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
100 lines (78 loc) · 3.55 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
99
100
<!doctype html>
<!--[if lt IE 7 ]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Now Playing</title>
<!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" href="css/now-playing.css" type="text/css" />
<link rel="shortcut icon" href="images/favicon.ico" />
<link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="js/fb.js"></script>
<script src="js/now-playing.js"></script>
<script>
(function (document) {
var access_token = '',
appID = '236294986469745';
if (window.location.hash.length > 0) {
var token = window.location.hash.substring(1).split('=')[1].split('&')[0];
var expires = new Date().getTime() + parseInt(window.location.hash.substring(1).split('&')[1].split('=')[1]);
localStorage.setItem('fbauth_token', token);
localStorage.setItem('fbauth_expires', expires);
window.location.href = '/';
//alert('found token: '+localStorage['fbauth_token'] + ' expires at ' + localStorage['fbauth_expires']);
} else if (!localStorage['fbauth_token'] || localStorage['fbauth_expires'] < new Date().getTime()) {
var path = 'https://www.facebook.com/dialog/oauth?';
var queryParams = ['client_id=' + appID,
'redirect_uri=' + window.location,
'response_type=token',
'scope=user_actions.music,friends_actions.music'];
var query = queryParams.join('&');
var url = path + query;
window.location.href=url;
}
var users = [
'3203345', //Brad
'3329091', //sushant
'701381311', //mike
'1304234219', //yelena
'7303200', //pieter
'724828036', //david yoon
'6301676' //JT
];
var api = new FacebookAPI(localStorage['fbauth_token']);
//var user = '3203345';
//create a watcher for each user
watchers = {};
$.each(users, function(i, user){
watchers[user] = new NowPlaying(api, user, users.length * 10);
setTimeout(function(){
watchers[user].autoUpdate();
}, i * 10000);
});
})(document);
</script>
</head>
<body>
<div id="page" class="inactive">
<header>
</header>
<article>
<h1>
<span id="user"></span> <span id="is">is listening to</span>
<span id="artist">Artist</span>
<span class="separator">—</span>
<span id="track">Track</span>
</h1>
</article>
<footer>
Originally by <a href="http://twitter.com/dsingleton">@dsingleton</a> but ported to facebook by <a href="http://twitter.com/brodrigu">@brodrigu</a> on <a href="https://github.com/brodrigu/now-playing-radiator">Github</a>
</footer>
</div>
</body>
</html>