-
Notifications
You must be signed in to change notification settings - Fork 31
/
index.html
executable file
·575 lines (486 loc) · 20.6 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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
<!DOCTYPE html>
<html class='no-js' ng-app='Napster'>
<head>
<meta charset='utf-8' />
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1' />
<title>Peer.fm – Free music and stuff</title>
<meta name='description' content="Peer.fm is a free music-streaming service that provides real-time music synchronisation between users and operates without circumventing the law in any way." />
<meta name='viewport' content='width=device-width' />
<link rel='icon' type='image/ico' href='img/favicon.ico' />
<link rel='stylesheet' href='//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css' />
<link rel='stylesheet' href='//netdna.bootstrapcdn.com/bootswatch/2.1.1/cosmo/bootstrap.min.css' />
<link rel='stylesheet' href='//netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css' />
<link rel='stylesheet' href='//cdnjs.cloudflare.com/ajax/libs/humane-js/3.0.6/themes/original.css' />
<link rel='stylesheet' href='css/napster.css' />
<!--[if lt IE 9]>
<script src='//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.3/CFInstall.min.js'></script>
<![endif]-->
</head>
<body ng-controller='Controller'>
<div id='navbar' class='navbar navbar-inverse navbar-fixed-top'>
<div class='navbar-inner'>
<div class='container'>
<a class='brand' href='#home'><img src='img/logo.navbar.png' /></a>
<div class='nav-collapse collapse'>
<ul class='nav'>
<li class='active'><a href='#home'>Home</a></li>
<li><a href='#chat'>Chat</a></li>
<li><a href='#library'>Library</a></li>
<li><a href='#search'>Search</a></li>
<li><a href='#hotlist'>Hot List</a></li>
<li><a href='#transfer'>Transfer</a></li>
<li><a href='#discovery'>Discovery</a></li>
<li><a href='#about'>About</a></li>
</ul>
<div id='user-greeting' class='pull-right' ng-class='ui.tempUserClass'>
I love you, {{authentication.username}}
</div>
<div id='login-greeting' class='pull-right' ng-class='ui.tempUserClass'>
<a href='#login'>Log in or Register</a>
</div>
</div>
</div>
</div>
</div>
<div id='player'>
<button onclick='stream.play(!stream.isPlaying, true)' class='play-button' ng-class='ui.playButtonClass'></button>
<div class='slider'></div>
<span class='track'>"{{datastore.data.user.current.nowPlaying.track.title}}" by {{datastore.data.user.current.nowPlaying.track.artist}}</span>
<span class='time'>{{stream.newTimeProcessed}} / {{datastore.data.user.current.nowPlaying.track.length}}</span>
<button onclick='stream.repeat()' class='repeat-button icon-refresh' ng-class='ui.repeatButtonClass'></button>
<button onclick='stream.shuffle()' class='shuffle-button icon-random' ng-class='ui.shuffleButtonClass'></button>
<input onenterpress='stream.syncByUsername(this.value)' id='following' class='pull-right' type='text' />
<label for='following' class='pull-right'>Sync with:</label>
</div>
<div hash-location='#home' ng-class='{ready: stream.isReady}'>
<div class='hero-unit'>
<h1><img src='img/logo.hero.png' /></h1>
<h2>Peer-to-peer streaming for the modern Web</h2>
<br />
<div class='row-fluid'>
<div class='span12'>
<h4>A few features that make Peer.fm dope:</h4>
</div>
</div>
<div class='row-fluid'>
<div class='span7'>
<h3>Real-time syncing</h3>
<p>Every one of your open Peer.fm windows – anywhere in the world – will keep their players synced</p>
<p>Alternatively, you can choose to sync with any other user and listen in on their music</p>
</div>
<div class='span5'>
<h3>Web-based (exclusively, for now)</h3>
<p>Your music collection travels with you</p>
</div>
</div>
<div class='row-fluid'>
<div class='span7'>
<h3><a href='//github.com/buu700/napster.fm/'>Open source</a></h3>
<p>If Peer.fm were ever abandoned or shut down, the community could immediately rehost it</p>
</div>
<div class='span5'>
<h3>You won't get arrested</h3>
<p>
<a class='btn btn-primary' onclick='ui.notReadyAbout()' href='#about'>Learn more »</a>
<span>(or just start using it now)</span>
</p>
</div>
</div>
</div>
</div>
<div hash-location='#chat'>
<div class='alert alert-info' ng-repeat='groupinvite in datastore.data.user.current.groupinvites'>
<span>{{groupinvite.from}} has invited you to {{groupinvite.groupname}}!</span>
<button class='btn pull-right' ng-click='chat.rejectInvite(groupinvite.id)'>Reject Invite</button>
<button class='btn btn-inverse pull-right' ng-click='chat.acceptInvite(groupinvite.id)'>Accept Invite</button>
</div>
<div class='tabbar navbar'>
<div class='navbar-inner'>
<button onclick='chat.removeFromGroup(datastore.data.activeGroup.id)' class='icon-remove btn pull-left'></button>
<ul class='nav'>
<li ng-repeat='group in datastore.data.group' ng-class='{active: group.id == datastore.data.activeGroup.id}'>
<a ng-click='chat.switchToGroup(group.id)'>{{group.name}}</a>
</li>
</ul>
<input onenterpress='chat.createGroup(this.value); this.value = "";' id='groupcreate' class='pull-right' type='text' />
<label for='groupcreate' class='pull-right'>
<span class='icon-plus'></span>
<span>Create group:</span>
</label>
</div>
</div>
<div class='row-fluid'>
<div class='chatwindow span8'>
<div ng-repeat='message in datastore.data.activeGroup.messages'>
<strong>{{message.author}}:</strong>
<span>{{message.text}}</span>
<span class='pull-right'>{{message.created}}</span>
</div>
</div>
<div class='span4'>
<strong class='chatmembersheader'>Members</strong>
<label for='chatinvite' class='pull-left'>
<span class='icon-plus'></span>
<span>Invite friend:</span>
</label>
<input onenterpress='chat.inviteToGroupProcessor(this)' id='chatinvite' class='pull-left' type='text' />
<table class='chatmembers'>
<thead>
<tr>
<th>Name</th>
<th>Listening To</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='member in datastore.data.activeGroup.members'>
<td>{{member.username}}</td>
<td>{{member.listeningTo}}</td>
</tr>
</tbody>
</table>
</div>
</div>
<textarea class='chatmessage' onenterpress='chat.sendMessage(this.value, datastore.data.activeGroup.id); this.value = "";'></textarea>
</div>
<div hash-location='#library'>
<table id='library-table'>
<thead>
<tr>
<th></th>
<th>Title</th>
<th>Artist</th>
<th>Genre</th>
<th>Year</th>
<th>Length</th>
<th>Last Played By</th>
<th>Last Played</th>
<th>Plays</th>
<th class='remove'></th>
</tr>
</thead>
<tbody>
<tr ng-repeat='track in datastore.data.user.current.library' ng-class='track.nowPlayingClass'>
<td ng-href='#library/{{track.id}}'></td>
<td>{{track.title}}</td>
<td>{{track.artist}}</td>
<td>{{track.genre}}</td>
<td>{{track.year}}</td>
<td>{{track.length}}</td>
<td>{{track.lastPlayedBy}}</td>
<td>{{track.lastPlayed}}</td>
<td>{{track.playCount}}</td>
<td class='icon-remove' ng-click='library.removeTrack(track.id)'></td>
</tr>
</tbody>
</table>
<div class='empty-track-table' ng-class='ui.libraryEmptyClass'>
Your library is empty; what are you doing with your life?
</div>
</div>
<div hash-location='#search'>
<div class='row-fluid'>
<span class='span4'>
<input id='search-title' class='pull-right' onenterpress='services.processedSearch()' type='text' />
<label for='search-title'>Title:</label>
</span>
<span class='span4'>
<input id='search-artist' class='pull-right' onenterpress='services.processedSearch()' type='text' />
<label for='search-artist'>Artist:</label>
</span>
</div>
<table id='search-table'>
<thead>
<tr>
<th></th>
<th>Title</th>
<th>Artist</th>
<th>Genre</th>
<th>Year</th>
<th>Length</th>
<th>Last Played By</th>
<th>Last Played</th>
<th>Plays</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='track in services.searchResults' ng-class='track.nowPlayingClass'>
<td ng-click='library.addTrack(track.id)' onclick='document.location.hash = "#library"'></td>
<td>{{track.title}}</td>
<td>{{track.artist}}</td>
<td>{{track.genre}}</td>
<td>{{track.year}}</td>
<td>{{track.length}}</td>
<td>{{track.lastPlayedBy}}</td>
<td>{{track.lastPlayed}}</td>
<td>{{track.playCount}}</td>
</tr>
</tbody>
</table>
<div class='empty-track-table' ng-class='ui.searchNoResultsClass'>
Sorry mate, no results
</div>
</div>
<div hash-location='#hotlist'>
<div class='row-fluid'>
<div class='span8'>
<table id='hotlist-library'>
<thead>
<tr>
<th></th>
<th>Title</th>
<th>Artist</th>
<th>Genre</th>
<th>Year</th>
<th>Length</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='track in datastore.data.activeHotlistMember.library' ng-class='track.nowPlayingClass'>
<td ng-click='library.addTrack(track.id)' ng-href='#hotlist/{{track.id}}'></td>
<td>{{track.title}}</td>
<td>{{track.artist}}</td>
<td>{{track.genre}}</td>
<td>{{track.year}}</td>
<td>{{track.length}}</td>
</tr>
</tbody>
</table>
</div>
<div class='span4'>
<strong class='chatmembersheader'>Friends</strong>
<label for='hotlistinvite' class='pull-left'>
<span class='icon-plus'></span>
<span>Add friend:</span>
</label>
<input onenterpress='library.addToHotlistProcessor(this)' id='hotlistinvite' class='pull-left' type='text' />
<table class='chatmembers'>
<thead>
<tr>
<th>Name</th>
<th>Listening To</th>
</tr>
</thead>
<tbody>
<tr
ng-repeat='member in datastore.data.user.current.hotlist'
ng-click='library.switchActiveHotlistMember(member.id)'
ng-class='{hotlistactive: member.id == datastore.data.activeHotlistMember.id}'
>
<td>{{member.username}}</td>
<td>{{member.listeningTo}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div hash-location='#transfer'>
<div class='alert alert-info' ng-repeat='transfer in datastore.data.user.current.transfers'>
<span>{{transfer.from.username}} has requested that you add "{{transfer.track.title}}" by {{transfer.track.artist}}!</span>
<button class='btn pull-right' ng-click='library.rejectTransfer(transfer.id)'>Reject Transfer</button>
<button class='btn btn-inverse pull-right' ng-click='library.acceptTransfer(transfer.id)'>Accept Transfer</button>
</div>
<div class='row-fluid'>
<div class='span8'>
<table id='transfer-library'>
<thead>
<tr>
<th></th>
<th>Title</th>
<th>Artist</th>
<th>Genre</th>
<th>Year</th>
<th>Length</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='track in datastore.data.user.current.library' ng-class='track.nowPlayingClass'>
<td ng-click='library.transferTrack(track.id)'></td>
<td>{{track.title}}</td>
<td>{{track.artist}}</td>
<td>{{track.genre}}</td>
<td>{{track.year}}</td>
<td>{{track.length}}</td>
</tr>
</tbody>
</table>
</div>
<div class='span4' ng-class='{hide: library.trackToTransfer == null}'>
<strong class='chatmembersheader'>Friends</strong>
<label for='hotlistinvite' class='pull-left'>
<span class='icon-plus'></span>
<span>Add friend:</span>
</label>
<input onenterpress='library.addToHotlistProcessor(this)' id='hotlistinvite' class='pull-left' type='text' />
<table class='chatmembers'>
<thead>
<tr>
<th>Name</th>
<th>Listening To</th>
</tr>
</thead>
<tbody>
<tr
ng-repeat='member in datastore.data.user.current.hotlist'
ng-click='library.transferTrack(undefined, member.id)'
ng-class='{hotlistactive: member.id == datastore.data.activeHotlistMember.id}'
>
<td>{{member.username}}</td>
<td>{{member.listeningTo}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div hash-location='#discovery'>
<table id='discovery-table'>
<thead>
<tr>
<th></th>
<th>Title</th>
<th>Artist</th>
<th>Genre</th>
<th>Year</th>
<th>Length</th>
<th>Last Played By</th>
<th>Last Played</th>
<th>Plays</th>
</tr>
</thead>
<tbody>
<tr ng-repeat='track in datastore.data.lastPlayed.array' ng-class='track.nowPlayingClass'>
<td ng-click='library.addTrack(track.id)' ng-href='#discovery/{{track.id}}'></td>
<td>{{track.title}}</td>
<td>{{track.artist}}</td>
<td>{{track.genre}}</td>
<td>{{track.year}}</td>
<td>{{track.length}}</td>
<td>{{track.lastPlayedBy}}</td>
<td>{{track.lastPlayed}}</td>
<td>{{track.playCount}}</td>
</tr>
</tbody>
</table>
</div>
<div hash-location='#about'>
<h3>Frequently Asked Questions</h3>
<h4>Will I be sued for using this?</h4>
<p>Absolutely.</p>
<h4>Holy shit, seriously?</h4>
<p>No.</p>
<h4>Then how does this work?</h4>
<p>As far as the streaming music, I'm essentially just grabbing existing content on YouTube based on metadata (titles, artists, etc.) from the <a href='//discogs.com/'>Discogs</a> database.</p>
<h4>So the entire service is dependent on minor inefficiencies in YouTube's piracy-detection system?</h4>
<p>Shhh... They probably don't hurt, but no, not necessarily; just don't be too selective about which version of a song you're after.</p>
<h4>Cool. So why does Peer.fm vaguely resemble Windows 8?</h4>
<p>Windows 8 introduced some interesting ideas and a nearly passable UX, but for the most part I just think the new Metro style / flat trend looks cool.</p>
<p>Also, I liked the idea of reimagining <strong>[redacted]</strong> – originally a Windows 95 desktop interface – as a Windows 8-ish modern Web application.</p>
<h4>Speaking of the desktop, where are my native and mobile apps? When can I run this on my toaster?</h4>
<p>Stay tuned; I have some ideas about that. If you really care, just <a onclick='ui.scrollToBottom()'>shoot me an email</a> and I'll let you know as soon as I have an update.</p>
<h4>Who are you?</h4>
<p>My alias online is buu700, but I most often go by Ryan Lester IRL. I'm a student at Carnegie Mellon, currently taking a few years off to work at SpaceX and do other stuff. In my free time, I contribute to <a href='//w3sec.org/about'>w3sec</a>.</p>
<h4>I'd like to make a small inquiry of you / spam you / ask you out on a date / give you money / take you to court / send you a comment. How can I contact you?</h4>
<p>Sure, no problem; just <a onclick='ui.scrollToBottom()'>scroll to the bottom</a> for my contact information.</p>
<h4>I have nothing better to do with my life; how can I contribute to Peer.fm?</h4>
<p>As mentioned on the home page, everything is developed in the open on GitHub; any extra hands would be brilliant. Email me or something before sending any pull requests, but please don't hesitate to log any bug reports or feature requests in the <a href='//github.com/buu700/napster.fm/issues'>issues system</a>.</p>
<h4>If I should decide to contribute, what technical specifics regarding Peer.fm should I be aware of?</h4>
<p>1. To manage all of our data, I'm using the fantastic real-time "serverless" data store <a href='//firebase.com/'>Firebase</a> (YC S11). As a consequence, aside from a set of Firebase validation rules, this is pure client-side engineering; grade-A JS hackers only.</p>
<p>2. Other than the Firebase SDK and the YouTube API, the major libraries and frameworks I'm using are: <a href='//code.google.com/p/closure-library'>Google Closure</a>, <a href='//angularjs.org'>AngularJS</a>, <a href='//sugarjs.com'>Sugar</a>, and <a href='//getbootstrap.com'>Bootstrap</a> (they're all brilliant).</p>
<p>3. If you're used to traversing the DOM with jQuery, my Closure-based <a href='//github.com/buu700/napster.fm/blob/master/js/closurequery.js'>ClosureQuery</a> may look a bit familiar.</p>
<h4>What specifically could you use help with?</h4>
<p>To preface, I'm open to any proposed contribution to the project. That being said:</p>
<p>1. Automated testing: Peer.fm currently has zero test coverage and I've no plans to write any myself in the near future; this could be a project for someone else to handle.</p>
<p>2. Artwork: I'm currently borrowing the <a href='//en.wikipedia.org/wiki/Akonadi'>Akonadi</a> logo for the Peer.fm favicon (no special significance; KDE's just awesome).</p>
<p>3. User documentation: there is none at the moment.</p>
<h4 ng-class='{hide: !window.isTranslated}'>
By the way, this entire site has been automatically translated from English. If anything I've written sounds insane or makes no sense, that is probably why. To use Peer.fm in the original English, <a href='/en.html'>click here</a>.
</h4>
</div>
<div hash-location='#login'>
<a href='#home' class='icon-remove'></a>
<div class='row-fluid'>
<h4>LOG IN OR REGISTER</h4>
</div>
<div class='row-fluid'>
<br />
</div>
<div class='row-fluid'>
<label for='login-username'>username</label>
<input id='login-username' type='text' />
</div>
<div class='row-fluid'>
<label for='login-password'>password</label>
<input id='login-password' type='password' />
</div>
<div class='row-fluid'>
<br />
<br />
<br />
</div>
<div class='row-fluid'>
<span class='span5'>
<button class='btn btn-inverse pull-right' onclick='authentication.login()'>Log in to existing account</button>
</span>
<span class='span2'>
- or -
</span>
<span class='span5'>
<button class='btn pull-left' onclick='authentication.createUser()'>Create a new account</button>
</span>
</div>
</div>
<div id='footer' class='container'>
<hr />
<footer>
<p>
© Peer.fm 2014
•
<a href='mailto:[email protected]' notranslate>[email protected]</a>
•
+1(337) 935 0016
•
<a href='//plus.google.com/102924227355926902317/' notranslate>Google+</a>
<a id='logout' onclick='authentication.logout()' ng-class='ui.tempUserClass' class='pull-right'>Log Out</a>
</p>
<p>
<div id='stream'></div>
<div id='videoCover'></div>
</p>
</footer>
</div>
<div id='page-loading-overlay' ng-class='ui.readyClass'></div>
<div id='page-loading-spinner' ng-class='ui.readyClass'></div>
<div id='page-loading-slow'>
Taking longer than usual to load...
</div>
<!-- Firebase: Real-time frontend-driven data store; http://firebase.com/ -->
<script src='//cdn.firebase.com/v0/firebase.js'></script>
<script src='//cdn.firebase.com/v0/firebase-auth-client.js'></script>
<!-- Sugar: Extends prototypes with helper functions (cf. Underscore) and adds JS 1.6 support to ancient browsers; http://sugarjs.com/api -->
<script src='//cdnjs.cloudflare.com/ajax/libs/sugar/1.3.7/sugar.min.js'></script>
<!-- AngularJS: Declarative MVC framework; http://angularjs.org/ -->
<script src='//ajax.googleapis.com/ajax/libs/angularjs/1.0.3/angular.min.js'></script>
<!-- Humane.js: Notification library; http://wavded.github.com/humane-js/ -->
<script src='//cdnjs.cloudflare.com/ajax/libs/humane-js/3.0.6/humane.min.js'></script>
<!-- COMPILE START -->
<!-- Closure Library: JS standard library; https://developers.google.com/closure/library/ -->
<script src='js/closure-library/closure/goog/base.js'></script>
<script src='js/require.js'></script>
<script src='js/closurequery.js'></script>
<script src='js/chat.js'></script>
<script src='js/authentication.js'></script>
<script src='js/datastore.js'></script>
<script src='js/datahelpers.js'></script>
<script src='js/debug.js'></script>
<script src='js/services.js'></script>
<script src='js/stream.js'></script>
<script src='js/library.js'></script>
<script src='js/ui.js'></script>
<script src='js/controllers.js'></script>
<script src='js/init.js'></script>
<!-- COMPILE END -->
<!-- YouTube API: Video-sharing Web site; http://www.youtube.com/ -->
<script src='//www.youtube.com/iframe_api'></script>
</body>
</html>