forked from musiqpadmqp/musiqpadmqp.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
279 lines (269 loc) · 14.8 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
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=0.5">
<meta name="theme-color" content="1C1C1F">
<title>musiqpad | Lounge</title>
<meta name="description" content="Real time music streaming and chat with friends. Musiqpad is a place where people can discover new music.">
<meta name="keywords" content="discover, new, music, song, sound, youtube, stream, chat, friends, share, listen, woot, meh, plug, dj, dubtrack, fm, turntable">
<link rel="shortcut icon" type="image/png" href="https://w0lff.github.io/pads/lib/img/icon.png"/>
<link href="pads/lib/css/mdi.min.css" media="all" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" type="text/css" href="/assets/html/Custom.css">
<script src="jquery-1.11.3.min.js"></script>
<script type="text/javascript">(function(e,t){var n=e.amplitude||{};var r=t.createElement("script");r.type="text/javascript";r.async=true;r.src="libs/amplitude-2.9.0-min.gz.js";r.onload=function(){e.amplitude.runQueuedFunctions()};var s=t.getElementsByTagName("script")[0];s.parentNode.insertBefore(r,s);var i=function(){this._q=[];return this};function a(e){i.prototype[e]=function(){this._q.push([e].concat(Array.prototype.slice.call(arguments,0)));return this}}var o=["add","append","clearAll","set","setOnce","unset"];for(var c=0;c<o.length;c++){a(o[c])}n.Identify=i;n._q=[];function u(e){n[e]=function(){n._q.push([e].concat(Array.prototype.slice.call(arguments,0)));}}var l=["init","logEvent","logRevenue","setUserId","setUserProperties","setOptOut","setVersionName","setDomain","setDeviceId","setGlobalUserProperties","identify","clearUserProperties"];for(var p=0;p<l.length;p++){u(l[p])}e.amplitude=n})(window,document);amplitude.init("2d3eb4a42289c22e4a7a3f7ea45718a9");amplitude.logEvent("LOUNGE_LOADED")</script>
<link rel="stylesheet" type="text/css" href="lounge/css/lobby.css">
<base target="_parent"/>
</head>
<body>
<div id="background"></div>
<section id="scroll">
<section id="header">
<div class="header-container">
<div class="header-content">
<div class="wrapper">
<ul>
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
<li><i></i></li>
</ul>
</div>
</div>
</div>
</section>
<section>
<div class="header-content extra-info">Can't see your pad in the list? Enable send lobby stats<br>Join to our <a href="https://w0lff.github.io/discord">Discord</a></div>
</section>
<section id="search">
<input type="text" id="searchbox" placeholder="Search for pads...">
</section>
<section id="list">
<div class="pad template" style="">
<a href="">
<div class="pad-img">
<nav>
<span class="song-title"></span>
<div>
<span class="mdi mdi-account-multiple user-logo"></span>
<span class="users"></span>
</div>
</nav>
</div>
<div class="pad-info">
<p class="pad-name">Looking for pads...</p>
<p class="pad-owner"></p>
<p class="pad-dj"></p>
</div>
</a>
</div>
</section>
</section>
<section id="footer">
<div class="left">
<div class="ad"></div>
</div>
<div class="right">
<div class="btn-key" title="Add your pad to the list.">Register pad!</div>
<a target="_blank" href="https://musiqpad.tumblr.com/api" title="API Documentation" class="btn"><div class="mdi mdi-file-document"></div></a>
<a target="_blank" href="https://www.facebook.com/musiqpad" class="btn"><div class="mdi mdi-facebook"></div></a>
<a target="_blank" href="https://twitter.com/musiqpad" class="btn"><div class="mdi mdi-twitter"></div></a>
<a target="_blank" href="https://www.reddit.com/r/musiqpad/" class="btn"><div class="mdi mdi-reddit"></div></a>
<a target="_blank" href="https://musiqpad.tumblr.com/" class="btn"><div class="mdi mdi-tumblr"></div></a>
<a target="_blank" href="https://www.youtube.com/watch?list=PL-1JbEJbwVuXWpp8RWdQGOwJb7Y8BrGdS&v=BjLBB-TMa84" class="btn"><div class="mdi mdi-youtube-play"></div></a>
</div>
</section>
<div class="cover"></div>
<script>
var pads = {};
var announcement = "";
function updateRooms() {
$.getJSON('lounge/announce.js', function(data) {
if (data.announcement) {
announcement = data.announcement;
$('.ad').html('<div class="mdi mdi-bullhorn" style="padding-right:10px"></div>' + data.announcement);
$('.ad').attr('title', data.announcement);
$('.ad').click(makeAnnounceModal);
}
if (data.allowApiKeyGeneration) {
$('.btn-key').show();
}
else {
$('.btn-key').hide();
}
if (data.version) {
$('.welcome').html('<i>Welcome to musiqpad ' + data.version + '. Please read our <a target="_blank" href="blog_subdomain/faq/">FAQ</a></i>');
}
});
$.getJSON("https://w0lff.github.io/assets/html/list.json", function(data) {
var template = $('.pad.template');
template.show();
$('.pad:not(.template)').remove();
//data.sort(function(a, b){return (b.user_count?b.user_count:0)-(a.user_count?a.user_count:0)});
data.sort(function(a, b) {
var b_uc = (b.user_count?b.user_count:0);
var a_uc = (a.user_count?a.user_count:0);
if (b_uc != a_uc) {
return b_uc - a_uc;
} else if (b.is_self_hosted != a.is_self_hosted) {
return (b.is_self_hosted * -1) - (a.is_self_hosted * -1)
} else {
return (b.current_song + "").length - (a.current_song + "").length;
}
});
for (var i = 0, len = data.length; i < len; i++) {
var room = data[i];
if (room.slug) {
pads[room.slug] = room;
}
if ((!room.pad_url || room.pad_url == '') && (!room.socket_host || room.socket_host == '')) {
continue;
}
var roomDiv = template.clone();
roomDiv.removeClass('template');
var roomClass = 'pad-' + room.slug;
roomDiv.addClass(roomClass);
roomDiv.attr('data-pad', room.slug);
$('#list').append(roomDiv);
var isSelfHosted = room.is_self_hosted == undefined || room.is_self_hosted == null || room.is_self_hosted == 1;
roomDiv.find('a').attr('href', isSelfHosted ? room.pad_url : '/p/' + room.slug);
roomDiv.find('.pad-name').text(room.pad_name ? room.pad_name : room.slug + ' (Pending Initial Update)');
roomDiv.find('.pad-owner').text( (!room.pad_owner) ? (!room.api_pad_owner) ? 'Waiting for Owner' : 'Owner: ' + room.api_pad_owner : 'Owner: '+ room.pad_owner );
roomDiv.find('.pad-dj').text('Nobody is playing');
roomDiv.find('.users').text(room.user_count ? room.user_count : '0');
roomDiv.find('.pad-dj').text(!room.current_dj_name ? '' :room.current_dj_name);
roomDiv.find('.song-title').html(!isSelfHosted ? '<img class="mp-official" src="/pads/lib/img/icon.png"></img>MP Official' : '');
roomDiv.find('.pad-img').css({
'background-image': 'url(room.current_song)',
'background-position': 'center'
});
}
filterPads();
template.hide();
});
}
updateRooms();
setInterval(updateRooms, 60 * 1000);
function getRoomFromClassList(jqueryElement) {
if (jqueryElement != null && jqueryElement.length != 0) {
return $(jqueryElement[0]).attr('data-pad');
}
return null;
}
function hasQueryParam(field) {
var url = window.location.href;
if(url.indexOf('?' + field) != -1)
return true;
else if(url.indexOf('&' + field) != -1)
return true;
return false
}
if (hasQueryParam('embed')) {
$('body').addClass('embed');
}
function getCookie(name) {
var value = "; " + document.cookie;
var parts = value.split("; " + name + "=");
if (parts.length == 2) return parts.pop().split(";").shift();
}
function makeModal() {
$('body').append('\
<div class="modal-bg">\
<div class="modal-container">\
<div class="modal">\
<div class="modal-box req">\
<div class="modal-text">\
<h3>Add your pad to the lounge</h3>\
<input type="text" class="modal-input api_server_host" placeholder="Room Name" />\
<input type="text" class="modal-input api_room_host" placeholder="Name of the Host" />\
<input type="text" class="modal-input api_room_img" placeholder="Preview image (optional)" />\
<input type="text" class="modal-input api_slug" placeholder="Pad Slug (optional)" />\
<input type="text" class="modal-input api_pad_url" placeholder="Pad URL" /><br><br>\
<button onclick="sendMessage()">Send</button>\
<ul>\
<li>Preview image under 2mb. Can be animated.</li>\
<li>Pad URL is the webaddress where your pad is hosted.</li>\
<li>Pad slug is how the room will be identified in the html on the lounge page, so its optional.</li>\
</ul>\
</div>\
</div>\
<iframe class="reqframe" src="https://w0lff.github.io/assets/html/Request.html"></iframe>\
<div class="modal-controls">\
<div class="modal-ctrl">\
<div class="modal-no non" onclick="$(\'.modal-bg\').remove()">\
<div class="mdi mdi-close"></div>\
</div>\
<div class="modal-yes yess" onclick="$(\'.modal-bg\').remove()">\
<div class="mdi mdi-check"></div>\
</div>\
</div>\
</div>\
</div>\
</div>\
</div>\
');
}
$('.btn-key').on('click', function(){
makeModal();
});
$('#searchbox').on("change keyup paste", function(){
filterPads();
});
function filterPads(){
var val = $('#searchbox').val().toLowerCase();
for(var slug in pads){
if(!/^[a-z\.,_-]+$/.test(slug)) continue;
var pad = pads[slug];
if(slug.indexOf(val) == -1 && (pad.pad_name || "").toLowerCase().indexOf(val) == -1 && (pad.pad_owner || pad.api_pad_owner || "").toLowerCase().indexOf(val) == -1)
$('.pad-' + slug).hide();
else
$('.pad-' + slug).show();
}
}
function makeAlertModal(data) {
$('body').append('\
<div class="modal-bg">\
<div class="modal-container">\
<div class="modal large">\
<div class="modal-box">\
<div class="modal-text">' +
data + '\
</div>\
</div>\
<div class="modal-controls">\
<div class="modal-ctrl">\
<div class="modal-yes" onclick="$(\'.modal-bg\').remove()" style="width:100%;">\
<div class="mdi mdi-check"></div>\
</div>\
</div>\
</div>\
</div>\
</div>\
</div>\
');
}
function makeTroubleshootingModal() {
makeAlertModal('\
<h3>Can\'t see your pad in the list?</h3>\
<p>The most common reason for pads to not be shown is that they are either offline or not sending lobby updates.<br/>Below are some common troubleshooting issues.</p>\
<ul>\
<li>Pads will only be shown when they have sent an update in the last <b>30 minutes</b>.</li>\
<li>New Pads have a grace period of <b>2 hours</b> in which they need to send an update.</li>\
<li>If you pad misses the update period it will be shown again once it next updates</li>\
</ul>\
');
}
function makeAnnounceModal() {
makeAlertModal('\
<h3>Announcement</h3>' + announcement
);
}
</script>
</body>
</html>