-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.html
80 lines (61 loc) · 2.51 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
<!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="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="js/lastfm.js"></script>
<script src="js/now-playing.js"></script>
<script>
(function (document) {
var get_username = function() {
// format: #username, or #!/user/username, prompt fallback
return document.location.hash.split('/')[2] ||
document.location.hash.substring(1) ||
prompt('Enter a Last.fm username?');
};
$(document).ready(function() {
// Canonicalise/Persist hash
document.location.hash = username = get_username();
var api = new LastfmAPI('5f134f063744307ee6f126ac2c480fab');
np = new NowPlaying(api, username);
np.autoUpdate();
});
// Needs replacing with a cross browser jquery plugin
window.onhashchange = function(event) {
username = get_username();
if (username != np.user) {
np.user = username;
np.update();
}
};
})(document);
</script>
</head>
<body>
<div id="page" class="inactive">
<header>
Now Playing
</header>
<article>
<h1>
<span id="artist">Artist</span>
<span class="separator">—</span>
<span id="track">Track</span>
</h1>
</article>
<footer>
By <a href="http://twitter.com/dsingleton">@dsingleton</a> on <a href="https://github.com/dsingleton/now-playing-radiator">Github</a>
</footer>
</div>
</body>
</html>