-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathmain.js
2329 lines (2084 loc) · 109 KB
/
main.js
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
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'use strict';
const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);
const PLAYER_STORAGE_KEY = 'VIK_PLAYER';
const DURATION_STORAGE_KEY = 'VIK_DURATION';
const appContainers = Array.from($$('.app__container'));
const audio = $('#audio');
const authors = Array.from($$('.player__song-author'));
const albumLists = Array.from($$('.album--container'));
const albumScrollBtns = $$('.container__move-btn.move-btn--album');
const artistLists = Array.from($$('.artist--container'));
const artistScrollBtns = $$('.container__move-btn.move-btn--artist');
const brandLists = Array.from($$('.brand--container'));
const cdThumbs = Array.from($$('.player__song-thumb .thumb-img'));
const closeModalBtn = $('.modal__close-btn');
const containerTabs = $$('.container__tab');
const durationTimes = Array.from($$('.durationtime'));
const eventLists = Array.from($$('.event--container'))
const exploreSlideLists = Array.from($$('.explore__slide--container'));
const favArtistLists = Array.from($$('.fav-artist--container'))
const header = $('.header');
const headerNavTitles = $$('.tab-home .container__header-title');
const homeMVs = $$('.tab-home .mv--container .row__item.item--mv');
const labelContainers = Array.from($$('.tab--explore .label--container'));
const logOutOption = $('.app__header-options.options--log-out');
const logOutBtn = $('.option__log-out');
const modalTheme = $('.modal-theme');
const mvLists = Array.from($$('.mv--container'));
const mvScrollBtns = $$('.container__move-btn.move-btn--mv');
const navbarItems = Array.from($$('.content__navbar-item'));
const navSettingBtn = $('.header__nav-btn.btn--nav-setting');
const navSettingMenu = $('.setting__menu');
const navThemeBtn = $('.header__nav-btn.nav-btn--theme');
const nextBtns = Array.from($$('.btn-next'));
const newPlaylistLists = Array.from($$('.new-playlist--container'));
const newPlaylistMoveBtns = Array.from($$('.move-btn--new-playlist'))
const normalPlaylistLists = Array.from($$('.normal-playlist--section'))
const favArtistMoveBtns = Array.from($$('.move-btn--fav-artist'))
const playAllBtns = $$('.btn--play-all');
const player = $('.player');
const playerContainer = $('.player__container');
const playerInfos = Array.from($$('.player__song-info'));
const playerPopUp = $('.player .player__popup');
const playerPopUpFooter = $('.player .player__popup .player__popup-footer');
const popUpSongName = $('.player__popup-cd-info h2');
const popUpSongAuthor = $('.player__popup-cd-info h3');
const popUpCdThumb = $('.player__popup-cd-display .player__popup-cd-img');
const popUpCdDisplay = $('.player__popup-cd-display');
const postLists = Array.from($$('.story--container'));
const playlistLists = Array.from($$('.playlist--container'));
const playlistScrollBtns = $$('.container__move-btn.move-btn--playlist');
const playBtns = Array.from($$('.btn-toggle-play'));
const prevBtns = Array.from($$('.btn-prev'));
const progress = Array.from($$('.progress'));
const progressBlocks = Array.from($$('.progress-block'));
const progressTracks = Array.from($$('.progress__track.song--track .progress__track-update'));
const radioLists = Array.from($$('.radio--container'));
const randomBtns = Array.from($$('.btn-random'));
const exploreRadioMoveBtns = Array.from($$('.tab--explore .container__move-btn.move-btn--radio'))
const radioTabMoveBtns = Array.from($$('.tab--radio .container__move-btn.move-btn--radio'))
const repeatBtns = Array.from($$('.btn-repeat'));
const searchHistory = $('.header__search-history');
const sidebar = $('.app__sidebar');
const sidebarExpandBtn = $('.sidebar__expand-btn.btn--expand');
const sidebarNavItems = Array.from($$('.sidebar__nav .sidebar__nav-item'))
const sidebarShrinkBtn = $('.sidebar__expand-btn.btn--shrink');
const slideImgs = $$('.container__slide-item');
const sidebarSubnav = $('.sidebar__subnav');
const sidebarSubnavItems = Array.from($$('.sidebar__subnav .subnab--item'))
const singerSlideContainers = Array.from($$('.singer-slide--container'));
const songLists = Array.from($$('.playlist__list'));
const songAnimateTitles = Array.from($$('.player__title-animate'));
const specialPlaylistLists = Array.from($$('.special-playlist--section'))
const tabCharts = $('.app__container.tab--charts');
const themeContainer = $('.theme__container');
const trackTimes = Array.from($$('.tracktime'));
const volumes = Array.from($$('.volume__range'));
const volumeBtns = Array.from($$('.player__options-btn.volume.option-btn'))
const volumeTracks = Array.from($$('.progress__track.volume--track .progress__track-update'));
const volumeIcons = Array.from($$('.volume .btn--icon'));
const App = $('.app');
const app = {
isPlaying: false,
isRandom: false,
isRepeat: false,
isSeeking: false,
isChangeVolume: false,
scrollToRight: [true, true, true, true, true, true, true, true, true, true], //use when click move btn
currentScreen: [],
currentIndex: 0,
currentPlaylist: 0, //choose playlist
themeList: 0, //Theme list index (have > 1 lists)
currentTheme: 0, //Current theme index in theme list
indexArray: [], //Use for random song
slideIndexs: [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], //Index of Each tab (playlist, album, mv, artist)
slideSelectors: [
'.tab-home .playlist--container .row__item.item--playlist',
'.tab-home .album--container .row__item.item--album',
'.tab-home .mv--container .row__item.item--mv',
'.tab-home .artist--container .row__item.item--artist',
'.tab--explore .radio--container .row__item.item--radio',
'.tab--explore .singer-slide--container .singer__slide-item',
'.tab--explore .new-playlist--container .row__item.item--new-playlist',
'.tab--explore .fav-artist--container .row__item.item--fav-artist',
'.tab--radio .radio--container .row__item.item--radio',
'.tab--following .singer-slide--container .singer__slide-item',
],
slideTitleWidth: 0, //Width of player title on footer
songPlaylists: JSON.parse(localStorage.getItem(MUSIC_STORAGE_KEY) || '[]'),
playlists: JSON.parse(localStorage.getItem(PLAYLIST_STORAGE_KEY) || '[]'),
albums: JSON.parse(localStorage.getItem(ALBUM_STORAGE_KEY) || '[]'),
mvs: JSON.parse(localStorage.getItem(MV_STORAGE_KEY) || '[]'),
artists: JSON.parse(localStorage.getItem(ARTIST_STORAGE_KEY) || '[]'),
exploreSlides: JSON.parse(localStorage.getItem(EXPLORE_SLIDE_STORAGE_KEY) || '[]'),
radios: JSON.parse(localStorage.getItem(RADIO_STORAGE_KEY) || '[]'),
labels: JSON.parse(localStorage.getItem(LABEL_STORAGE_KEY) || '[]'),
singerSlides: JSON.parse(localStorage.getItem(SINGER_SLIDE_STORAGE_KEY) || '[]'),
events: JSON.parse(localStorage.getItem(EVENT_STORAGE_KEY) || '[]'),
newPlaylists: JSON.parse(localStorage.getItem(NEW_PLAYLIST_STORAGE_KEY) || '[]'),
favArtists: JSON.parse(localStorage.getItem(FAVORITE_ARTIST_STORAGE_KEY) || '[]'),
brands: JSON.parse(localStorage.getItem(BRAND_STORAGE_KEY) || '[]'),
specialPlaylists: JSON.parse(localStorage.getItem(SPECIAL_PLAYLIST_STORAGE_KEY) || '[]'),
normalPlaylists: JSON.parse(localStorage.getItem(NORMAL_PLAYLIST_STORAGE_KEY) || '[]'),
listSongCharts: JSON.parse(localStorage.getItem(SONG_CHARTS_STORAGE_KEY) || '[]'),
posts: JSON.parse(localStorage.getItem(POST_STORAGE_KEY) || '[]'),
durationList: JSON.parse(localStorage.getItem(DURATION_STORAGE_KEY) || `[
["04:30","03:18","04:33","04:20","03:24","06:05","03:55","03:22","03:44","03:08","04:15","03:53","04:07","04:13","04:42","04:08","03:17","04:05","03:11","04:16","04:04"],
["04:02","02:57","03:21","14:50","03:57","04:21","04:45","03:06","04:46","05:02","04:24","04:27","08:26","04:48","03:01","03:25","04:24","03:19","03:43","03:34"],
["03:16","03:21","02:38","03:28","03:48","03:32","03:04","03:37","03:31","03:11","03:28","03:17","02:37","03:28","03:16","05:32"],
["03:25","04:45","03:14","04:15","02:54","02:51","02:01","04:28","03:23","04:04","02:45","03:57","03:21","02:28","02:34","04:03","03:56"]
]`),
themeLists: JSON.parse(localStorage.getItem(THEME_LIST_STORAGE_KEY) || '[]'), // List theme image to render to view
themes: JSON.parse(localStorage.getItem(THEME_STORAGE_KEY) || '[]'), //List theme to apply background
config: JSON.parse(localStorage.getItem(PLAYER_STORAGE_KEY) || '{}'),
setConfig: function(key, value) {
this.config[key] = value;
localStorage.setItem(PLAYER_STORAGE_KEY, JSON.stringify(this.config));
},
html([first, ...string], ...values) {
return values.reduce(
(acc, cur) => acc.concat(cur, string.shift())
, [first]
)
.filter(x => x && x !== true || x === 0)
.join('')
},
renderSong() {
this.songs = this.songPlaylists[this.currentPlaylist]
songLists.forEach((songList, songIndex) => {
songList.innerHTML = app.html`${app.songs.map(function(song, index) {
return app.html`
<div class="playlist__list-song media ${app.currentIndex === index ? 'active' : ''}" data-index="${index}">
<div class="playlist__song-info media__left">
${songIndex === 1 && app.html`
<div class="playlist__song-check">
<input type="checkbox" name="" id="playlist__check-${index}" class="mr-10" style="display: none">
<label for="playlist__check-${index}"></label>
</div>
<i class="bi bi-music-note-beamed mr-10"></i>
`}
<div class="playlist__song-thumb media__thumb mr-10" style="background: url('${song.image}') no-repeat center center / cover">
<div class="thumb--animate">
<div class="thumb--animate-img" style="background: url('./assets/img/SongActiveAnimation/icon-playing.gif') no-repeat 50% / contain">
</div>
</div>
<div class="play-song--actions">
<div class="control-btn btn-toggle-play btn--play-song">
<i class="bi bi-play-fill"></i>
</div>
</div>
</div>
<div class="playlist__song-body media__info">
<span class="playlist__song-title info__title">${song.name}</span>
<p class="playlist__song-author info__author">
${song.singer.map((singer,index) => {
return app.html`
<a href="#" class="is-ghost">${singer}</a>${index < song.singer.length - 1 && ', '}
`
})}
</p>
</div>
</div>
<span class="playlist__song-time media__content">${app.durationList[app.currentPlaylist][index]}</span>
<div class="playlist__song-option ${songIndex === 1 && "song--tab"} media__right">
<div class="playlist__song-btn btn--mic option-btn hide-on-mobile">
<i class="btn--icon song__icon bi bi-mic-fill"></i>
</div>
<div class="playlist__song-btn song-btn--heart option-btn hide-on-mobile">
<i class="btn--icon song__icon icon--heart bi bi-heart-fill primary"></i>
</div>
<div class="playlist__song-btn option-btn ${songIndex === 0 && 'hide-on-tablet'}">
<i class="btn--icon bi bi-three-dots"></i>
</div>
</div>
</div>
`
})}`
})
},
renderPlaylist() {
playlistLists.forEach((playlistList, playlistIndex) => {
playlistList.innerHTML = app.html`
<div class="col l-2-4 m-3 c-4 ${playlistIndex === 1 && 'mb-30'}">
<div class="row__item playlist--create item--playlist">
<div class="row__item-container flex--center item-create--properties">
<i class="bi bi-plus-lg album__create-icon"></i>
<span class="album__create-annotate text-center">Tạo playlist mới</span>
</div>
</div>
</div>
${app.playlists.map((playlist, index) => {
return app.html`
<div class="col l-2-4 m-3 c-4 ${playlistIndex === 1 && 'mb-30'}">
<div class="row__item item--playlist">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--square" style="background: url('${playlist.image}') no-repeat center center / cover"></div>
<div class="row__item-actions">
<div class="action-btn btn--heart">
<i class="btn--icon icon--heart bi bi-heart-fill primary"></i>
</div>
<div class="btn--play-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill"></i>
</div>
</div>
<div class="action-btn">
<i class="btn--icon bi bi-three-dots"></i>
</div>
</div>
<div class="overlay"></div>
</div>
<div class="row__item-info">
<a href="#" class="row__info-name is-twoline">${playlist.name}</a>
<h3 class="row__info-creator">${playlist.creator}</h3>
</div>
</div>
</div>
</div>
`
})}`
})
},
renderAlbum() {
albumLists.forEach((albumList, albumIndex) => {
albumList.innerHTML = app.html`
${app.albums.map((album,index) => {
return app.html`
<div class="col l-2-4 m-3 c-4 ${albumIndex === 1 && 'mb-30'}">
<div class="row__item item--album">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--square" style="background: url('${album.image}') no-repeat center center / cover"></div>
<div class="row__item-actions">
<div class="action-btn btn--heart">
<i class="btn--icon icon--heart bi bi-heart-fill primary"></i>
</div>
<div class="btn--play-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill icon-play"></i>
</div>
</div>
<div class="action-btn">
<i class="btn--icon bi bi-three-dots"></i>
</div>
</div>
<div class="overlay"></div>
</div>
<div class="row__item-info">
<a href="#" class="row__info-name is-twoline">${album.name}</a>
</div>
</div>
</div>
</div>
`
})}
`
})
},
renderMV() {
mvLists.forEach((mvList, mvIndex) => {
mvList.innerHTML = app.html`
${app.mvs.map((mv, index) => {
return app.html`
<div class="col l-4 m-6 c-12 ${mvIndex === 1 && 'mb-30'}">
<div class="row__item item--mv">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--mv" style="background: url('${mv.image}') no-repeat center center / cover"></div>
<div class="row__item-actions">
<div class="action-btn mv-btn--close">
<i class="bi bi-x-lg btn--icon"></i>
</div>
<div class="btn--play-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill icon-play"></i>
</div>
</div>
</div>
<div class="overlay"></div>
<div class="mv__time">${mv.time}</div>
</div>
<div class="row__item-info media">
<div class="media__left">
<div class="media__thumb is-rounded mr-10" style="background: url('${mv.authorAvatar}') no-repeat center center / cover"></div>
<div class="media__info">
<span class="info__title is-active is-twoline">${mv.name}</span>
<p class="info__author">
${mv.author.map((author, index) => {
return app.html`
<a href="#" class="is-ghost">${author}</a>${index < mv.author.length -1 && ', '}
`
})}
</p>
</div>
</div>
</div>
</div>
</div>
</div>
`
})}
`
})
},
renderArtist() {
artistLists.forEach((artistList, artistIndex) => {
artistList.innerHTML = app.html`
${app.artists.map((artist, index) => {
return app.html`
<div class="col l-2-4 m-3 c-6 ${artistIndex === 1 && 'mb-30'}">
<div class="row__item item--artist">
<div class="row__item-container flex--top-left">
<div class="row__item-display is-rounded">
<div class="row__item-img img--square is-rounded" style="background: url('${artist.image}') no-repeat center center / contain"></div>
<div class="row__item-actions">
<div class="btn--play-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill icon-play"></i>
</div>
</div>
</div>
<div class="overlay"></div>
</div>
<div class="row__item-info media artist--info">
<div class="media__left">
<div href="#" class="row__info-name is-ghost mt-15 lh-19 text-center">
${artist.name}
<i class="bi bi-star-fill row__info-icon">
<div class="icon-overlay"></div>
</i>
</div>
<h3 class="row__info-creator text-center">${artist.followers} quan tâm</h3>
</div>
</div>
<div class="row__item-btn">
<button class="button is-small button-primary">
<i class="bi bi-check2"></i>
<span> Đã quan tâm</span>
</button>
</div>
</div>
</div>
</div>
`
})}
`
})
},
renderModalTheme() {
themeContainer.innerHTML = app.html`
${this.themeLists.map((themeList, themeIndex)=> {
return app.html`
<div class="row sm-gutter theme__list">
<div class="col l-12 m-12 c-12">
<div class="theme__container-info">
<h3 class="theme__info-name">${themeList.type}</h3>
</div>
</div>
${themeList.themes.map((theme, index) => {
return app.html`
<div class="col l-2 m-4 c-6 mb-20">
<div class="theme__container-item" data-index="${index}">
<div class="theme__item-display row__item-display br-5">
<div class="theme__item-img row__item-img" style="background: url('${theme.image}') no-repeat center center / cover"></div>
<div class="overlay"></div>
<div class="theme__item-actions row__item-actions">
<button class="button theme__actions-btn btn--apply-theme button-primary">
<span class="theme__btn-title">Áp dụng</span>
</button>
<button class="button theme__actions-btn btn--preview hide-on-mobile">
<span class="theme__btn-title">Xem trước</span>
</button>
</div>
</div>
<div class="theme__item-info">
<div class="theme__item-name">${theme.name}</div>
</div>
</div>
</div>
`
})}
</div>
`
})}
`
},
renderExploreSlide() {
exploreSlideLists.forEach((exploreSlideList, slideIndex) => {
exploreSlideList.innerHTML = app.html`
<div class="explore__slide-move">
<div class="slide__move-btn btn--prev">
<i class="bi bi-chevron-left"></i>
</div>
<div class="slide__move-btn btn--next">
<i class="bi bi-chevron-right"></i>
</div>
</div>
${this.exploreSlides.map((exploreSlide, index) => {
return app.html`
<div
class="col l-4 m-4 c-6 explore__slide-item
${index === 0 && 'first next'}
${index === 1 && 'second'}
${index === 2 && 'third'}
${index === 3 && 'fourth'}
${index > 3 && index < app.exploreSlides.length - 1 && 'fifth'}
${index === app.exploreSlides.length - 1 && 'sixth prev'}
">
<div class="row__item-display">
<div class="explore__slide-img row__item-img img--rec" style="background: url('${exploreSlide.image}') no-repeat center center / cover"></div>
</div>
</div>
`
})}
`
})
},
renderRadios() {
radioLists.forEach((radioContainer, radioIndex) => {
radioContainer.innerHTML = app.html`
${this.radios.map((radio, index) => {
return app.html`
<div class="col l-1-7 m-2-4 c-3">
<div class="row__item item--radio">
<div class="row__item-container flex--top-left">
<div class="item--has-attach">
<svg class="svg row__item-frame" fill="transparent" width="100%" height="100%" viewBox="0 0 100 100">
<circle class="svg-circle-bg" stroke="rgba(255, 255, 255, 0.2)" cx="50" cy="50" r="48.75" stroke-width="2.5"></circle>
<circle class="svg-circle" stroke="#ff4b4a" cx="50" cy="50" r="48.75" stroke-width="2.5" stroke-dasharray="306.3052837250048" stroke-dashoffset="${Math.random() * 306}" style="transition: stroke-dashoffset 850ms ease-in-out 0s;"></circle>
</svg>
<div class="row__item-display is-rounded">
<div class="row__item-img img--square is-rounded" style="background: url('${radio.image}') no-repeat center center / contain"></div>
<div class="row__item-actions hide-on-mobile">
<div class="btn--play-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill icon-play"></i>
</div>
</div>
</div>
<div class="overlay"></div>
</div>
<div class="radio__label">LIVE</div>
<div class="radio__logo is-rounded">
<div class="radio__logo-img" style="background: url('${radio.logo}') no-repeat center center / cover"></div>
</div>
</div>
<div class="row__item-info media radio--info">
<div class="media__left">
<div class="media__info text-center">
<span class="info__title is-active is-oneline">${radio.name}</span>
<h3 class="row__info-creator text-center">${radio.viewers} đang nghe</h3>
</div>
</div>
</div>
</div>
</div>
</div>
`
})}
`
})
},
renderLabels() {
labelContainers.forEach((labelContainer, labelIndex) => {
labelContainer.innerHTML = app.html`
${this.labels.map((label, index) => {
return app.html`
<div class="col l-4 m-4 c-6 mb-30">
<div class="row__item item--label">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--label" style="background: url('${label.image}') no-repeat center center / cover"></div>
</div>
</div>
</div>
</div>
`
})}
`
})
},
renderSingerSlide() {
singerSlideContainers.forEach((singerSlideContainer, slideIndex) => {
singerSlideContainer.innerHTML = app.html`
<div class="singer__slide-move hide-on-mobile">
<div class="slide__move-btn btn--prev button--disabled">
<i class="bi bi-chevron-left"></i>
</div>
<div class="slide__move-btn btn--next">
<i class="bi bi-chevron-right"></i>
</div>
</div>
${this.singerSlides.map((singerSlide, index) => {
return app.html`
<div class="col l-2-4 m-3 c-4 row-item singer__slide-item">
<div class="row__item-display">
<div class="singer__slide-img img--singer-slide" style="background: url('${singerSlide.image}') no-repeat center center / cover"></div>
</div>
</div>
`
})}
`
})
},
renderEvent() {
eventLists.forEach((eventList, eventIndex) => {
eventList.innerHTML = app.html`
${this.events.map((event, index) => {
return app.html`
<div class="col l-4 m-6 c-12">
<div class="row__item item--event">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--mv" style="background: url('${event.image}') no-repeat center center / cover"></div>
<div class="blur"></div>
<div class="row__item-display-content">
<div class="display__content-label">Sự Kiện</div>
<h3 class="display__content-title">${event.name}</h3>
<p class="display__content-time">${event.time}</p>
</div>
</div>
<div class="row__item-info media">
<div class="media__left">
<div class="media__info">
<span class="info__title event--title is-active">Lượt chúc mừng</span>
<div class="info__avatar">
${event.fans.map(fan => {
return app.html`
<div class="info__avatar-item">
<div class="info__avatar-img" style="background: url('${fan}') no-repeat center center / cover"></div>
</div>
`
})}
<div class="info__avatar-item">
<p class="info__avatar-text">+${event.fanAmount}</p>
</div>
</div>
</div>
</div>
<div class="media__content">
<button class="button button-primary event__button">
<span>${event.action}</span>
</button>
</div>
</div>
</div>
</div>
</div>
`
})}
`
})
},
renderNewPlaylist() {
newPlaylistLists.forEach((newPlaylistList, playlistIndex) => {
newPlaylistList.innerHTML = app.html`
${this.newPlaylists.map((newPlaylist, index) => {
return app.html`
<div class="col l-4 m-6 c-12">
<div class="row__item item--new-playlist">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--square" style="background: url('${newPlaylist.image}') no-repeat center center / cover"></div>
<div class="row__item-actions">
<div class="btn--play-new-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill"></i>
</div>
</div>
</div>
<div class="overlay"></div>
</div>
<div class="row__item-info new-playlist--info">
<a href="#" class="row__info-name is-twoline">${newPlaylist.name}</a>
<h3 class="row__info-creator">
${newPlaylist.singer.map((singer, index) => {
return app.html`
<a href="#" class="is-ghost">${singer}</a>${index < newPlaylist.singer.length - 1 && ','}
`
})}
</h3>
<div class="row__item-detail">
<div class="info__detail-order">#${newPlaylist.order}</div>
<div class="info__detail-time">${newPlaylist.time}</div>
</div>
</div>
</div>
</div>
</div>
`
})}
<div class="col l-4 m-6 c-12">
<div class="row__item item--new-playlist">
<div class="row__item-container new-song--empty flex--top-left">
<span>Xem tất cả</span>
</div>
</div>
</div>
`
})
},
renderFavArtist() {
favArtistLists.forEach((favArtistList, artistIndex) => {
favArtistList.innerHTML = app.html`
${this.favArtists.map((favArtist, index) => {
return app.html`
<div class="col l-4 m-6 c-6">
<div class="row__item item--fav-artist">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--square" style="background: url('${favArtist.image}') no-repeat center center / cover"></div>
<div class="row__item-actions">
<div class="btn--fav-artist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill icon-play"></i>
</div>
</div>
</div>
<div class="overlay"></div>
<div class="blur"></div>
<div class="row__item-display-content">
<h3 class="display__content-explication is-oneline">${favArtist.explication}</h3>
<p class="display__content-artist is-oneline">${favArtist.name}</p>
<div class="display__content-list">
${favArtist.songs.map((song, index) => {
return app.html`
<div class="display__content-list-song">
<div class="display__content-song-img" style="background: url('${song}') no-repeat center center / cover"></div>
</div>
`
})}
</div>
</div>
</div>
</div>
</div>
</div>
`
})}
`
})
},
renderBrand() {
brandLists.forEach((brandList, brandIndex) => {
brandList.innerHTML = app.html`
${this.brands.map((brand, index) => {
return app.html`
<div class="col l-1-5 m-3 c-4 container__footer-brand-item mb-30">
<div class="footer__brand-container">
<div class="container__footer-brand-background img--rec"></div>
<img src="${brand.image}" alt="brand" class="container__footer-brand-img">
</div>
</div>
`
})}
`
})
},
renderSpecialPlaylist() {
specialPlaylistLists.forEach((specialPlaylistList, playlistListIndex) => {
specialPlaylistList.innerHTML = app.html`
<div class="col l-12 m-12 c-12 mb-16">
<div class="container__header special-playlist--header">
<div class="row__item-info media">
<div class="media__left">
<div class="row__item-display br-5">
<div class="row__item-img img--square" style="background: url('${app.specialPlaylists[playlistListIndex].header.image}') no-repeat center center / cover"></div>
</div>
<div class="media__info special-playlist--info">
<span class="info__explication">${app.specialPlaylists[playlistListIndex].header.explication}</span>
<h3 class="info__topic-name is-active">${app.specialPlaylists[playlistListIndex].header.topicName}</h3>
</div>
</div>
</div>
</div>
</div>
<div class="col l-12 m-12 c-12">
<div class="row no-wrap special-playlist--container">
${app.specialPlaylists[playlistListIndex].playlists.map((playlist, index) => {
return app.html`
<div class="col l-2-4 m-3 c-4">
<div class="row__item item--playlist">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--square" style="background: url('${playlist.image}') no-repeat center center / cover"></div>
<div class="row__item-actions">
<div class="action-btn btn--heart">
<i class="btn--icon icon--heart bi bi-heart-fill primary"></i>
</div>
<div class="btn--play-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill"></i>
</div>
</div>
<div class="action-btn">
<i class="btn--icon bi bi-three-dots"></i>
</div>
</div>
<div class="overlay"></div>
</div>
<div class="row__item-info explore-playlist--info">
<a href="#" class="row__info-name ${playlistListIndex < 2 && 'is-oneline' || 'is-twoline'}">${playlist.name}</a>
<p class="info__artist">
${playlist.artists.map((artist, artistIndex) => {
return app.html`
<a href="#" class="is-ghost">${artist}</a>${artistIndex < playlist.artists.length -1 && ', '}
`
})}
</p>
</div>
</div>
</div>
</div>
`
})}
</div>
</div>
`
})
},
renderNormalPlaylist() {
normalPlaylistLists.forEach((normalPlaylistList, playlistListIndex) => {
normalPlaylistList.innerHTML = app.html`
${playlistListIndex != 6 && app.html`
<div class="col l-12 m-12 c-12 mb-16">
<div class="container__header">
<a href="#" class="container__header-title">
<h3>${this.normalPlaylists[playlistListIndex].header}</h3>
</a>
<h3 class="container__header-subtitle">${this.normalPlaylists[playlistListIndex].header}</h3>
</div>
</div>
`}
<div class="col l-12 m-12 c-12">
<div class="row ${playlistListIndex !== 7 && 'no-wrap'} normal-playlist--container">
${app.normalPlaylists[playlistListIndex].playlists.map((playlist, index) => {
return app.html`
<div class="col l-2-4 m-3 c-4 ${playlistListIndex === 7 && 'mb-30'}">
<div class="row__item item--playlist">
<div class="row__item-container flex--top-left">
<div class="row__item-display br-5">
<div class="row__item-img img--square" style="background: url('${playlist.image}') no-repeat center center / cover"></div>
<div class="row__item-actions">
<div class="action-btn btn--heart">
<i class="btn--icon icon--heart bi bi-heart"></i>
</div>
<div class="btn--play-playlist">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill"></i>
</div>
</div>
<div class="action-btn">
<i class="btn--icon bi bi-three-dots"></i>
</div>
</div>
<div class="overlay"></div>
</div>
<div class="row__item-info explore-playlist--info">
${playlistListIndex != 3 && app.html`
<a href="#" class="row__info-name ${playlistListIndex != 5 && playlistListIndex != 7 && "is-oneline" || "is-twoline"}">${playlist.name}</a>
`
}
${playlistListIndex != 5 && app.html`
<p class="info__artist">
${playlist.artists.map((artist, artistIndex) => {
return app.html`
<a href="#" class="${playlistListIndex != 1 && playlistListIndex != 2 && 'is-ghost' || 'is-description'}">${artist}</a>${artistIndex < playlist.artists.length -1 && ', '}
`
})}
</p>
`}
</div>
</div>
</div>
</div>
`
})}
</div>
</div>
`
})
},
renderTabCharts() {
tabCharts.innerHTML = app.html`
<div class="app__container-content">
<div class="charts__container">
<div class="grid">
<div class="chart__container-header mb-40">
<h3 class="chart__header-name">#zingchart</h3>
<div class="chart__header-btn">
<i class="bi bi-play-fill chart__header-icon"></i>
</div>
</div>
<div class="row no-gutters chart--container mt-10 mb-20">
<div class=" col l-12 m-12 c-12">
<div class="container__playlist">
<div class="playlist__list-charts overflow-visible">
${this.listSongCharts.map((song, songIndex) => {
return app.html`
<div class="playlist__list-song media ${songIndex > 9 && 'song--not-expand'}">
<div class="playlist__song-info media__left">
<div class="playlist__song-rank">
<div
class="playlist__rank-number
${songIndex === 0 &&'is-outline--blue'}
${songIndex === 1 &&'is-outline--green'}
${songIndex === 2 &&'is-outline--red'}
${songIndex > 2 &&'is-outline--text'}
">
${song.rank}
</div>
<div class="playlist__rank-icon">
<i class="bi bi-dash-lg"></i>
</div>
</div>
<div class="playlist__song-thumb media__thumb mr-10" style="background: url('${song.image}') no-repeat center center / cover">
<div class="thumb--animate">
<div class="thumb--animate-img" style="background: url('./assets/img/SongActiveAnimation/icon-playing.gif') no-repeat 50% / contain">
</div>
</div>
<div class="play-song--actions">
<div class="control-btn btn-toggle-play">
<i class="bi bi-play-fill"></i>
</div>
</div>
</div>
<div class="playlist__song-body media__info">
<span class="playlist__song-title info__title">${song.name}</span>
<p class="playlist__song-author info__author">
${song.singers.map((singer, index) => {
return app.html`
<a href="#" class="is-ghost">${singer}</a>${index < song.singers.length - 1 && ', '}
`
})}
</p>
</div>
</div>
<span class="playlist__song-time media__content">${song.time}</span>
<div class="playlist__song-option song--tab media__right hide-on-mobile">
<div class="playlist__song-btn btn--mic option-btn">
<i class="btn--icon song__icon bi bi-mic-fill"></i>
</div>
<div class="playlist__song-btn btn--heart option-btn">
<i class="btn--icon song__icon icon--heart bi bi-heart-fill primary"></i>
</div>
<div class="playlist__song-btn option-btn">
<i class="btn--icon bi bi-three-dots"></i>
</div>
</div>
</div>
`
})}
</div>
</div>
</div>
</div>
<div class="charts__expand">
<button class="button charts__expand-btn">Xem top 100</button>
</div>
</div>
</div>
</div>
`
},
renderPost() {
postLists.forEach((postList, postIndex) => {
postList.innerHTML = app.html`
${this.posts[postIndex].map((post, index) => {
return app.html`
<div class="story__item mb-30">
<div class="story__item-container">
<div class="story__item-header">
<div class="row__item-info media story__header-info">
<div class="media__left">
<div class="media__thumb is-rounded mr-10" style="background: url('${post.authorAvatar}') no-repeat center center / cover"></div>
<div class="media__info">
<div class="media__info-header">
<div class="info__title is-active is-oneline">${post.name}</div>
<span> • </span>
<span class="follow-btn">Quan tâm</span>
</div>
<p class="info__time">
<a href="#" class="is-active">${post.time}</a>
</p>
</div>
</div>
</div>
<div class="story__header-content">
<span>${post.content}</span>
</div>
</div>
<div class="row__item-display br-5 story__item-display">
<div
class=
"
story__item-img
${postIndex === 0 && index < 2 && 'img--rec'}
${postIndex === 0 && index === 2 && 'img--rec-vertical'}
${postIndex === 0 && index === 3 && 'img--square'}
${postIndex === 0 && index === 4 && 'img--rec'}
${postIndex === 1 && index < 4 && 'img--square'}
${postIndex === 1 && index === 4 && 'img--rec'}
"
style="background: url('${post.image}') no-repeat center center / cover">
</div>
</div>
<div class="story__item-action">
<div class="action-btn story-btn--heart">
<i class="btn--icon icon--heart bi bi-heart"></i>
<span class="action__number">${Math.floor(Math.random() * 1000)}</span>
</div>
<div class="action-btn story-btn--comment">
<i class="btn--icon icon--comment bi bi-chat-dots"></i>
<span class="action__number">${Math.floor(Math.random() * 100)}</span>
</div>
</div>
</div>
</div>
`
})}
`
})
},