-
Notifications
You must be signed in to change notification settings - Fork 4
/
gallery.html
183 lines (153 loc) · 5.26 KB
/
gallery.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
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
<!DOCTYPE HTML>
<html>
<head>
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link rel="stylesheet" href="styles.css" type="text/css" media="screen">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script>
<script src="js/underscore-min.js" type="text/javascript" charset="utf-8"></script>
<script src="http://static.echonest.com.s3.amazonaws.com/js/poplist.js" type="text/javascript" charset="utf-8"></script>
<script src="http://static.echonest.com.s3.amazonaws.com/js/topsongs.js" type="text/javascript" charset="utf-8"></script>
<script src="js/favsongs.js" type="text/javascript" charset="utf-8"></script>
<title> The Bonhamizer</title>
</head>
<body>
<div id="wrap" class="navbar navbar-inverse">
<div class="navbar-inner">
<div class="container">
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a id='show-search' class="brand">The Bonhamizer</a>
<div class="nav-collapse collapse">
<ul class="nav">
<li class="active"><a id='show-gallery' >Pick a song</a></li>
<li><a id='show-loader' href="loader.html">Upload a song</a></li>
<li><a id='show-about' href="about.html">About</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="hero" class="hero-unit">
<div class="container">
<h2> Gallery of songs</h2>
<div id='info'> </div>
<div id='song-div'>
<ul class="nav nav-pills">
<li id='favorite-list' class="sel-list active">
<a href="#">Paul's favorites</a>
</li>
<!--
<li id='popular-list' class="sel-list">
<a href="#">Most played</a>
</li>
<li id='upload-list' class="sel-list">
<a href="#">Most uploaded</a>
</li>
-->
<li id='recent-list' class="sel-list">
<a href="#">Most recent</a>
</li>
</ul>
<ul id="song-list"> </ul>
</div>
</div>
</div>
</body>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript">
// framebusting
if(top != self) {
top.onbeforeunload = function() {};
top.location.replace(self.location.href);
}
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-3675615-27']);
_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>
<script type="text/javascript">
var mostRecentSongs = null;
function listPopularTracks() {
listTracks('#popular-list', songs);
ga_track('list', 'popular-tracks', '');
}
function listFavoriteTracks() {
listTracks('#favorite-list', favSongs);
ga_track('list', 'favorite-tracks', '');
}
function listRecentTracks() {
if (mostRecentSongs) {
listTracks('#recent-list', mostRecentSongs);
} else {
$.getJSON('http://labs.echonest.com/Uploader/recent_tracks?callback=?', { count : 60}, function(data) {
mostRecentSongs = data;
listTracks('#recent-list', mostRecentSongs);
ga_track('list', 'recent-tracks', '');
});
}
}
function listTopUploadedTracks() {
listTracks('#upload-list', topUploadedSongs);
ga_track('list', 'top-uploaded', '');
}
function getTitle(title, artist, url) {
if (title == undefined || title.length == 0 || title === '(unknown title)' || title == 'undefined') {
if (url) {
title = extractTitle(url);
} else {
title = null;
}
} else {
if (artist !== '(unknown artist)') {
title = title + ' by ' + artist;
}
}
return title;
}
function listSong(r) {
var title = getTitle(r.title, r.artist, null);
var item = null;
if (title) {
var a = $('<a>').attr('href', 'go.html?trid=' + r.id).text(title);
var item = $('<li>').append(a);
item.attr('class', 'song-link');
}
return item;
}
function listTracks(active, tracks) {
$('#song-list').show();
$('#song-list').empty();
$('.sel-list').removeClass('active');
$(active).addClass('active');
for (var i = 0; i < 20 && i < tracks.length; i++) {
var s = tracks[i];
var item = listSong(s);
if (item) {
$('#song-list').append(listSong(s));
}
}
}
function init() {
jQuery.ajaxSettings.traditional = true;
$("#favorite-list").click(listFavoriteTracks);
$("#popular-list").click(listPopularTracks);
$("#recent-list").click(listRecentTracks);
$("#upload-list").click(listTopUploadedTracks);
listFavoriteTracks();
}
window.onload = init;
function ga_track(page, action, id) {
_gaq.push(['_trackEvent', page, action, id]);
}
</script>