-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
511 lines (494 loc) · 25.9 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
<!DOCTYPE html>
<html>
<head>
<title>Amoki's Musics</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="fr" />
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.less" rel="stylesheet/less">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet">
<link href="css/jquery-ui.min.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.7.3/css/bootstrap-select.min.css">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/less.js/2.5.1/less.min.js"></script>
<script type="text/javascript" src="js/lib/js.cookie-2.0.3.min.js"></script>
<script type="text/javascript" src="js/lib/bootstrap.min.js"></script>
<script type="text/javascript" src="js/lib/prefixfree.min.js"></script>
<script type="text/javascript" src="js/lib/ws4redis.js"></script>
<script type="text/javascript" src="js/lib/jquery.plugin.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.countTo.js"></script>
<script type="text/javascript" src="js/lib/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/lib/knockout-sortable.min.js"></script>
<script type="text/javascript" src="js/lib/knockout-bootstrap-custom.js"></script>
<script type="text/javascript" src="js/lib/common_functions.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.7.3/js/bootstrap-select.min.js"></script>
<script type="text/javascript" src="js/knockout/customBinding.js"></script>
<script type="text/javascript" src="js/knockout/models.js"></script>
<script type="text/javascript" src="js/remote/viewModels.js"></script>
<script type="text/javascript" src="js/remote/knockout.remote.js"></script>
<script type="text/javascript" src="js/remote/usefullFunction.js"></script>
</head>
<body>
<div id="wrapper">
<!-- BEGIN LOGIN -->
<div class="wrapper-login ko-login" data-bind="css: { 'display-none': isConnected }">
<div class="container col-md-4 col-md-offset-4 LOGIN">
<div class="header">
<h3 class="text-muted">Log In</h3>
</div>
<div class="jumbotron">
<h1>Select a room</h1>
<p class="text-danger" data-bind="css: { 'display-none': !badLogin() }">Wrong or missing room / password</p>
<form class="form-inline" role="form" data-bind="submit: getLogin">
<div class="form-group">
<label for="rooms">Rooms:</label>
<select id="rooms" class="form-control" name="room" data-bind="options: rooms, optionsText: 'name', optionsValue: 'name', value: selectedRoom,"></select>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input id="password" type="password" name="password" data-bind="value: password">
</div>
<button type="submit" class="btn btn-primary">Valider</button>
</form>
</div>
</div>
</div>
<!-- END LOGIN -->
<div class="ko-room">
<nav id="navbar-top" class="navbar navbar-inverse" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active" data-bind="with:room"><a class="navbar-brand" data-bind="text: name"></a></li>
<li data-bind="stopBinding">
<a id="btn-navbar" class="ko-login"><!-- TODO logout toom -->
<button class="btn btn-primary" type="button" data-bind="click: $root.logOut">Change Room</button>
</a>
</li>
<li data-bind="if: !$root.playerOpen()">
<a id="btn-navbar">
<button class="btn btn-primary" type="button" data-bind="click: $root.openPlayer">Open the player</button>
</a>
</li>
<li data-bind="if: $root.playerOpen()">
<a id="btn-navbar">
<button class="btn btn-primary" type="button" data-bind="click: $root.closePlayer">Close the player</button>
</a>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div>
</nav>
</div>
<div class="container-fluid ligne">
<div class="REMOTE">
<!-- REMOTE ZONE -->
<div class="col-md-8 ko-room">
<div class="col-md-offset-1 col-md-10 remote">
<!-- HEADER REMOTE -->
<div class="row header-remote" data-bind="with: room">
<div data-bind="if: currentMusic()">
<img id="thumbnail" class="col-md-offset-1 col-md-3 img-responsive" data-bind="attr: {src: currentMusic().thumbnail()}">
<div class="col-md-8 title_playing">
<div class="marquee">
<a class="now-playing" data-bind="attr: {href: currentMusic().url() }, text: currentMusic().name()"></a>
</div>
</div>
</div>
<div data-bind="if: !currentMusic()">
<div class="col-md-12 title">
<div class="marquee">
<span class="now-playing">No music :'( Add yours now !</span>
</div>
</div>
</div>
</div>
<!-- END HEADER REMOTE -->
<!-- PLAYLIST -->
<div class="row players" data-bind="css: { 'display-none': !playerOpen() }">
<div class="col-md-offset-1 col-md-10 wrappeur">
<!-- PLAYER ZONE -->
<div id="player-wrapper" class="col-md-12 player">
<div class="player-child player-child-no-music col-xs-12">
<a id="btn-open-player"><img src="img/btn-play-large.png"></a>
</div>
<div id="wrapper-youtube-player" class="player-child col-xs-12">
<div id="youtubePlayer"></div>
</div>
<div id="wrapper-soundcloud-player" class="player-child col-xs-12">
<iframe id="soundcloudPlayer" src="https://w.soundcloud.com/player/?url=http://api.soundcloud.com/" width="100%" height="100%" scrolling="no" frameborder="no"></iframe>
</div>
<div id="wrapper-slider-volume">
<span id="icon-volume" class="col-xs-1"></span>
<div id="slider-volume" class="col-xs-offset-1 col-xs-10"></div>
</div>
</div>
<!-- END PLAYER ZONE -->
</div>
</div>
<!-- Playlist -->
<div class="row playlist-mid" data-bind="css: { 'display-none': playerOpen() }">
<div class="col-md-offset-1 col-md-10 wrappeur">
<div class="wrappeur" data-bind="template: { name: 'playlist-template' }"></div>
</div>
</div>
<!-- END PLAYLIST -->
<!-- PROGRESS BAR -->
<div class="row" data-bind="with:room">
<div class="col-md-offset-1 col-md-10 wrapper-progress-bar">
<div class="progress progress-striped active">
<div class="progress-bar"></div>
</div>
<div id="time-left-progress-bar-wrapper">
<span id="time-left-progress-bar"></span>
<span id="time-left-progress-bar-duration">
<!-- ko if: currentMusic() -->/ <!--ko text: humanizeSeconds(currentMusic().duration()) --><!--/ko--><!--/ko-->
</span>
</div>
</div>
</div>
<!-- END PROGRESS BAR -->
<!-- CONTROL BUTTONS -->
<div>
<div class="row" data-bind="with: room">
<div class="col-xs-offset-2 col-xs-2">
<form data-bind="submit: $root.patchShuffle">
<button type="submit" id="submit-shuffle" class="btn btn-default btn-control" title="Shuffle" alt="Shuffle" data-bind="css: {'btn-shuffle-false' : !shuffle()}">
<i class="fa fa-random fa-2x"></i>
</button>
</form>
</div>
<div class="col-xs-offset-3 col-xs-4">
<form data-bind="submit: $root.postNext">
<button id="btn-next" type="submit" title="Next Music" alt="Next Music" class="btn btn-default btn-control btn-skip-music" data-bind="enable: currentMusic()">
<i class="fa fa-fast-forward fa-2x"></i>
</button>
</form>
</div>
</div>
</div>
<!-- END CONTROL BUTTONS -->
</div>
</div>
<!-- END REMOTE ZONE -->
<!-- LIBRARY -->
<div class="col-md-4 ko-library">
<div class=" col-md-12 LIB">
<div class="row input-lib">
<div class="col-lg-12">
<form class="search-form" data-bind="submit: searchMusic">
<div class="input-group">
<span class="input-group-btn">
<select data-width="auto" data-bind="selectPicker: sourceSearch, optionsText: 'name', optionsValue : 'name', selectPickerOptions: { optionsArray: sources }"></select>
</span>
<input type="text" name="query" class="form-control query" id="querySearch" placeholder="Titre" data-bind="textInput: querySearch">
<span class="input-group-btn">
<button class="btn btn-default btn-search-icon" type="submit"><i class="fa fa-search"></i></button>
</span>
</div>
</form>
</div>
</div>
<div class="row list-lib">
<div class="col-md-12">
<div class="wrappeur">
<ul class="nav nav-tabs nav-justified">
<li id="tab_btn_search" data-bind="if: musicSearch().length, css: { 'display-none': musicSearch().length < 1 }"><a data-toggle="tab" href="#search-tab">Search Result</a></li>
<li id="tab_btn_library" class="active"><a data-toggle="tab" href="#library">Library</a></li>
<!-- ko stopBinding -->
<li id="tab_btn_playlist" class="ko-room" data-bind="css: { 'display-none': !playerOpen() }">
<a data-toggle="tab" href="#playlist">
Playlist
<span class="badge" data-bind="text: playlistTracks().length"></span>
</a>
</li>
<!-- /ko -->
</ul>
<div id="popover-container-custom" class="tab-content">
<!-- Tab Search -->
<div class="tab-pane" id="search-tab" data-bind="if: musicSearch().length">
<ul id="list-search" class="list-group" data-bind="foreach: musicSearch">
<li class="list-group-item item-lib row row-list-item">
<!-- SEARCH MUSIC DATA -->
<div class="row-list-item">
<div class="search-img-music">
<img data-bind="attr: { src: thumbnail }">
</div>
<div class="search-music-info">
<div class="row">
<div class="col-xs-12" style="min-height:45px" data-bind="text: name"></div>
</div>
<div class="row">
<div class="col-xs-8" style="color:black;font-weight:normal;">
<span class="bold" data-bind="text: count"></span> views
</div>
<div class="col-xs-4">
<span class="badge" data-bind="text: humanizeSeconds(duration())"></span>
</div>
</div>
</div>
<div class="add-music-form">
<button class='btn btn-default btn-lg btn-add-music' type='button' alt='Ajouter à la playlist' title='Ajouter à la playlist' data-bind="click: function() { $root.addMusic($data) }">
<span class='glyphicon glyphicon-play-circle'></span>
</button>
<button class="btn btn-default btn-lg" type="button" data-bind="popover: {template: 'popover-edit-music-template',
options: {trigger: 'click', placement: 'left', trigger: 'focus', canDelete: false} }">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</button>
</div>
</div>
</li>
</ul>
</div>
<!-- End Tab Search -->
<!-- TAB Library -->
<div class="tab-pane active" id="library">
<ul id="list-library" class="list-group" data-bind="foreach: musicsLibrary">
<li class="list-group-item item-lib row row-list-item">
<div class="row-list-item">
<div class="library-img-music">
<img data-bind="attr: { src: thumbnail }">
</div>
<div class="library-music-info">
<div class="row">
<div class="col-xs-12" style="min-height:45px" data-bind="text: name"></div>
</div>
<div class="row">
<div class="col-xs-8" style="color:black;font-weight:normal;">
Played <span class="bold" data-bind="text: count"></span> times
</div>
<div class="col-xs-4">
<span class="badge" data-bind="text: humanizeSeconds(duration())"></span>
</div>
</div>
</div>
<div class="add-music-form">
<button class='btn btn-default btn-lg btn-add-music' type='button' alt='Ajouter à la playlist' title='Ajouter à la playlist' data-bind="click: function() { $root.addMusic($data) }">
<span class='glyphicon glyphicon-play-circle'></span>
</button>
<button class="btn btn-default btn-lg" type="button" data-bind="popover: {template: 'popover-edit-music-template',
options: {trigger: 'click', placement: 'left', trigger: 'focus', canDelete: true} }">
<span class="glyphicon glyphicon-menu-hamburger"></span>
</button>
</div>
</div>
</li>
</ul>
<div class="list-group-item row-list-item">
<button title="Previous" class="btn btn-default" data-bind="click: getLibrary, value: hasPrevious, enable: hasPrevious" style="margin-right: 30px;">Previous musics</button>
<button title="Next" class="btn btn-default" data-bind="click: getLibrary, value: hasNext, enable: hasNext">Next musics</button>
</div>
</div>
<!-- End Tab Library -->
<!-- Tab Playlist -->
<div class="tab-pane playlist" id="playlist" data-bind="stopBinding">
<div class="ko-room" data-bind="css: { 'display-none': !playerOpen() }">
<div data-bind="template: { name: 'playlist-template' }"></div>
</div>
</div>
<!-- End Tab Playlist -->
</div>
</div>
</div>
</div>
</div>
</div>
<!-- END LIBRARY -->
</div>
</div>
<!-- FOOTER -->
<footer class="foot ko-room" data-bind="with: room">
<form class="pull-left" data-bind="submit: function(){ $root.deleteMusic($data.currentMusic()) }">
<button id="dead-link" class="btn btn-primary btn-skip-music" type="submit" data-bind="enable: currentMusic()">Dead link ?</button>
</form>
<a class="btn btn-primary pull-right">Company Terms</a>
</footer>
<!-- END FOOTER -->
</div>
<!-- END PAGE -->
<div class="modal fade modal-on-top ko-login" id="modal-error-ws" data-bind="css: { 'display-block' : wsError() }">
<div class="modal-dialog modal-sm">
<div class="modal-content modal-content-custom">
<div class="modal-body">
<span class="glyphicon glyphicon-exclamation-sign"></span>
Connexion to server lost !<br/>
Trying to reconnect...
</div>
</div>
</div>
</div>
<div class="modal fade modal-on-top" id="modal-next-music">
<div class="modal-dialog modal-sm">
<div class="modal-content modal-content-custom">
<div class="modal-body">
Skipped !
<button type="button" class="close" data-dismiss="modal">x</button>
</div>
</div>
</div>
</div>
<div class="modal fade modal-on-top" id="modal-delete-playlistTrack">
<div class="modal-dialog modal-sm">
<div class="modal-content modal-content-custom">
<div class="modal-body">
Playlist track deleted !
<button type="button" class="close" data-dismiss="modal">x</button>
</div>
</div>
</div>
</div>
<div class="modal fade modal-on-top" id="modal-shuffle-on">
<div class="modal-dialog modal-sm">
<div class="modal-content modal-content-custom">
<div class="modal-body">
<p class="col-xs-8">Everyday i'm shuffling</p>
<i class="fa fa-music fa-2x col-xs-1"></i>
<button type="button" class="close col-xs-1 col-xs-offset-1" data-dismiss="modal">x</button>
</div>
</div>
</div>
</div>
<div class="modal fade modal-on-top" id="modal-shuffle-off">
<div class="modal-dialog modal-sm">
<div class="modal-content modal-content-custom">
<div class="modal-body">
<p class="col-xs-8">Shuffle is off</p>
<span class="fa-stack fa-lg col-xs-1">
<i class="fa fa-music fa-stack-1x"></i>
<i class="fa fa-ban fa-stack-2x"></i>
</span>
<button type="button" class="close col-xs-1 col-xs-offset-1" data-dismiss="modal">x</button>
</div>
</div>
</div>
</div>
<div class="modal fade modal-on-top" id="modal-add-music">
<div class="modal-dialog modal-sm">
<div class="modal-content modal-content-custom">
<div class="modal-body">
<p>Music added to the playlist ;)</p>
<button type="button" class="close" data-dismiss="modal">x</button>
</div>
</div>
</div>
</div>
<div class="tooltip tooltip-preview-timer-start"></div>
<div class="tooltip tooltip-preview-timer-end"></div>
<div class="modal fade ko-library" id="music_preview">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Preview</h4>
</div>
<div data-bind="visibleKeepDOM: musicPreview()">
<div id="preview_player" class="youtube">Youtube Player</div>
<div id="wrapper-soundcloud-player" class="soundcloud">
<iframe id="soundcloudPreviewPlayer" src="https://w.soundcloud.com/player/?url=http://api.soundcloud.com/" width="100%" height="300px" scrolling="no" frameborder="no"></iframe>
</div>
</div>
<div data-bind="if: musicPreview()">
<div class="modal-body">
<div id="slider-preview"></div>
<p>
<label for="timers">Time range:</label>
<span id="timers">
<span id="time_start" style="font-weight:bold;"></span>
<span> - </span>
<span id="time_end" style="font-weight:bold;"></span>
</span>
</p>
<div data-bind="if: musicPreview().channel_name() && musicPreview().description()">
<div id="music-channel" data-bind="text: 'Posted by : ' + musicPreview().channel_name()"></div>
<div id="music-description" data-bind="text: musicPreview().description()"></div>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-info" id="btn-modal-preview-valid" data-dismiss="modal" data-bind="click: function() { closePreviewMusic(true) }">Ajouter</button>
<button class="btn btn-info" id="btn-modal-preview-cancel" data-dismiss="modal" data-bind="click: function() { closePreviewMusic(false) }">Annuler</button>
</div>
</div>
</div>
</div>
</div>
<div id="tooltip_volume_slider" class="tooltip tooltip-volume-player"></div>
<script type="text/javascript" src="https://w.soundcloud.com/player/api.js"></script>
<script type="text/javascript" src="js/player/soundcloud.js"></script>
<script type="text/javascript" src="js/player/youtube.js"></script>
<script type="text/javascript" src="js/player/player.js"></script>
<!-- TEMPLATES -->
<script type="text/html" id="playlist-template">
<div class="wrappeur">
<div class="overlay-playlist">
<i class="fa fa-spinner fa-pulse fa-3x fa-fw loader"></i>
</div>
<div class="panel panel-default panel-playlist">
<div class="panel-heading">
<h3 class="panel-title">Playlist</h3>
</div>
<table class="table table-striped table-condensed header-fixed">
<!-- ko if: playlistTracks().length -->
<tbody class="playlist-ajax playlist-sortable" data-bind="sortable: {data: playlistTracks, options: sortableOptions, afterMove: afterMoveSortable}">
<tr class="playlist-item" data-bind="attr: { 'data-pkplaylisttrack': pk() }">
<td class="icon-trash" data-bind="click: function() { $root.deletePlaylistTrack($data) }"><i class="fa fa-2x fa-trash-o"></i></td>
<td class="name" data-bind="text: music().name"></td>
<td class="duration"><span class="badge" data-bind="text: humanizeSeconds(music().duration())"></span></td>
<td class="ordering" data-bind="css : { 'max' : $index()!=0 && $index() < $parent.playlistTracks().length - 1, 'medium' : $parent.playlistTracks().length > 1 }">
<i class="fa fa-1-5 fa-angle-double-up ordering-to-top" data-action="top" data-bind="visible : $index()!=0" ></i>
<i class="fa fa-1-5 fa-angle-up ordering-move-up" data-action="up" data-bind="visible : $index()!=0" ></i>
<i class="fa fa-1-5 fa-angle-down ordering-move-down" data-action="down" data-bind="visible: $index() < $parent.playlistTracks().length - 1"></i>
<i class="fa fa-1-5 fa-angle-double-down ordering-to-bot" data-action="bottom" data-bind="visible: $index() < $parent.playlistTracks().length - 1"></i>
<span class="pull-right">| <i class="fa fa-arrows"></i></span>
</td>
</tr>
</tbody>
<!-- /ko -->
<!-- ko with: room -->
<!-- ko if: (shuffle() && $root.playlistTracks().length === 0) -->
<tbody>
<tr class="empty">
<td>Shuffle activated...<br /><br />Let the music be your guide</td>
</tr>
</tbody>
<!-- /ko -->
<!-- ko if: (!shuffle() && $root.playlistTracks().length === 0) -->
<tbody>
<tr class="empty">
<td>No more musics in the playlist !</td>
</tr>
</tbody>
<!-- /ko -->
<!-- /ko -->
</table>
</div>
</div>
</script>
<script type="text/html" id="popover-edit-music-template">
<div class='wrapper-popover-add-music'>
<div data-bind='visible: false'>
<i class="fa fa-2x fa-refresh fa-spin"></i>
</div>
<div>
<button class='btn btn-default btn-lg' type='button' href='#music_preview' data-toggle='modal' data-backdrop='static' alt='Edit duration' title='Edit duration' data-bind='click: function() { $root.openPreviewMusic($data)}, visible: true' style='display: none'>
<span class='glyphicon glyphicon-time'></span> Edit duration
</button>
<!-- ko if: options.canDelete === true -->
<button class='btn btn-default btn-lg' type='button' alt='Delete music' title='Delete music' data-bind='click: function() { $root.deleteMusic($data) }, visible: options.canDelete === true' style='display: none;'>
<i class="fa fa-2x fa-trash-o"></i> Delete music
</button>
<!-- /ko -->
</div>
</div>
</script>
</body>
</html>