-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
379 lines (339 loc) · 13.2 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
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<title></title>
<style>
* {
box-sizing: border-box;
}
h1 {
text-align: center;
}
#player {
display: flex;
position: fixed;/*Не убирать. Располагает плеер в нижней части экрана.*/
margin:0; /*Не убирать. Располагает плеер в нижней части экрана.*/
bottom: 0; /*Не убирать. Располагает плеер в нижней части экрана.*/
left: 0; /*Не убирать. Располагает плеер в нижней части экрана.*/
width: 100%;
height: 15vh;
background-color: #f0f0f0;
}
#baseControls {
flex: 1;
}
#miniInfo {
display: flex;
height:100%;
flex:3
}
#controls{
flex:4;
}
#currentTextInfo {
margin: 1vh 1vh;
display: inline-grid;
height:100%;
}
#miniCover {
height: 15vh;
object-fit: contain;
}
#currentTextInfo {
display: flex ;
flex: 3;
flex-direction: column;
justify-content: center;
}
#currentTextInfo *{
height: 50%;
margin: 0;
}
#page {
position: fixed;/*Не убирать. Обеспечивает прокрутку страницы.*/
top: 0; /*Не убирать. Обеспечивает прокрутку страницы.*/
left: 0; /*Не убирать. Обеспечивает прокрутку страницы.*/
width: 100%;
height: 85vh; /*Не убирать. Обеспечивает прокрутку страницы.*/
overflow: auto; /*Не убирать. Обеспечивает прокрутку страницы.*/
background-color: #f0f0f0; /* Цвет фона для наглядности */
}
#albumInfo {
height: 20vh;
margin: 5% 5% 5%;
display: flex;
width: 80%;
}
img {
max-height: 100%; /* Занимает всю высоту блока */
object-fit: contain;
}
#textInfo {
padding-left: 2.5%;
flex: 3; /* Занимает половину доступной ширины */
display: flex;
flex-direction: column;
justify-content: center;
}
#authorName {
font-size: 3em;
text-align: left;
margin: 0;
flex: 1;
}
#description {
overflow:scroll;
margin:0;
flex: 3;
}
.song {
border: 0.2em solid #000000 ;
margin: 2em;
padding: 2em;
}
#baseControls {
display: flex;
}
.baseControls {
flex:1;
margin:3.75vh 3.75vh 0 3.75vh;
height: 7.5vh;
width: 7.5vh;
}
#controls {
display: flex;
justify-content: right;
}
.controls {
margin:3.75vh 3.75vh 0 3.75vh;
height: 7.5vh;
width: 7.5vh;
}
</style>
</head>
<body>
<div id="page">
<header>
<h1>Очень пафосное название сайта</h1>
</header>
<main>
<div id="albumInfo">
<img id="cover" src="" alt="Обложка альбома">
<div id="textInfo">
<h2 id="authorName">Группа</h2>
<p id ="description">Описание</p>
</div>
</div>
<div id="songsList">
</div>
</main>
<footer>
</footer>
</div>
<div id="player">
<span id="baseControls">
<button class="baseControls" id="back" onclick="back()"><<</button>
<button class="baseControls" id = "play" onclick="play()">|> </button>
<button class="baseControls" id="forward" onclick="forward()">>></button>
</span>
<span id="miniInfo">
<img id="miniCover" src="" alt="Обложка альбома">
<span id="currentTextInfo">
<h3 id="currentSongName"></h3>
<h3 id="currentAuthorName"></h3>
</span>
</span>
<span id="controls">
<button class="controls" id="loop" onclick="changeLoop(this.value)" value="0">8</button>
<button class="controls" id="volume">A</button>
<button class="controls" id="lyrics">T</button>
</div>
<audio id="audioPlayer" src="" controls> </audio>
<script>
function getSongList() {
return [
{
"songName": "Attack",
"songPath": "Albums/Hypnotyze/01 - Attack.mp3"
},
{
"songName": "Dreaming",
"songPath": "Albums/Hypnotyze/02 - Dreaming.mp3"
},
{
"songName": "Kill Rock 'N Roll",
"songPath": "Albums/Hypnotyze/03 - Kill Rock 'n Roll.mp3"
},
{
"songName": "Hypnotize",
"songPath": "Albums/Hypnotyze/04 - Hypnotize.mp3"
},
{
"songName": "Stealing Society",
"songPath": "Albums/Hypnotyze/05 - Stealing Society.mp3"
},
{
"songName": "Tentative",
"songPath": "Albums/Hypnotyze/06 - Tentative.mp3"
},
{
"songName": "U-Fig",
"songPath": "Albums/Hypnotyze/07 - U-Fig.mp3"
},
{
"songName": "Holy Mountains",
"songPath": "Albums/Hypnotyze/08 - Holy Mountains.mp3"
},
{
"songName": "Vicinity of Obscenity",
"songPath": "Albums/Hypnotyze/09 - Vicinity of Obscenity.mp3"
},
{
"songName": "She's Like Heroin",
"songPath": "Albums/Hypnotyze/10 - She's Like Heroin.mp3"
},
{
"songName": "Lonely Day",
"songPath": "Albums/Hypnotyze/11 - Lonely Day.mp3"
},
{
"songName": "Soldier Side",
"songPath": "Albums/Hypnotyze/12 - Soldier Side.mp3"
}
]
}
function getAlbumInfo () {
return {"authorName": "System Of A Down",
"albumName": "Hypnotyze",
"year": "2005",
"description":"Hypnotize — пятый студийный альбом американской альтернативной метал группы System of a Down, выпущенный 22 ноября 2005 года на звукозаписывающем лейбле Columbia Records. Продюсированием альбома занимались Рик Рубин и Дарон Малакян. Hypnotize является второй и завершающей частью концептуальной дилогии Mezmerize / Hypnotize. Так же, как и на предыдущем альбоме, гитарист группы Дарон Малакян исполняет не меньше вокальных партий, чем основной вокалист группы Серж Танкян. Hypnotize стал последней студийной работой System of the Down до их четырёхлетнего перерыва с августа 2006 года по ноябрь 2010 года. Художественное оформление обложки, как и предыдущего альбома, разрабатывал отец Дарона — американский художник армянского происхождения Вартан Малакян.<br><br>С альбома было выпущено два сингла: «Hypnotize» и «Lonely Day» 11 октября и 17 апреля соответственно. 7 декабря 2006 года песня «Lonely Day» участвовала в номинации «Лучшее хард-рок исполнение» на 49 церемонии вручения премии «Грэмми», но проиграла песне «Woman» группы Wolfmother. Так же, песня заняла 10 места в таких чартах, как Alternative Songs и Hot Mainstream Rock Tracks. Песня «Hypnotize» дебютировала под номером один в американском чарте Alternative Songs и под номером 5 в Hot Mainstream Rock Tracks, что сделало песню большим интернациональным хитом. На обе песни были сняты видеоклипы. Так же, в качестве промосинглов, были выпущены две песни: «Vicinity of Obscenity» и «Kill Rock 'n Roll».<br><br>Как и предыдущий альбом, Hypnotize дебютировал под номером 1 в американском чарте, что сделало группу наравне с The Beatles, Guns N' Roses и рэперами 2Pac и DMX единственными артистами, у которых когда-либо два студийных альбома стояли на первом месте в одном и том же году. Было продано свыше миллиона копий альбома; альбом Hypnotize получил платиновый сертификат от RIAA 13 декабря 2005 года, а после золотой сертификат 25 января 2006 года",
"coverPath": "Albums/Hypnotyze/Cover.jpg"}
}
var currentSongNum = 0;
var isGlobalLoop = 0;
var isLocalLoop = 0;
const audioPlayer = document.getElementById("audioPlayer");
const staticJSONSongsList = getSongList();
const songsList = JSON.parse(JSON.stringify(staticJSONSongsList));
const playlist = [];
const staticJSONAlbumInfo = getAlbumInfo();
const albumInfo= JSON.parse(JSON.stringify(staticJSONAlbumInfo));
function playNext() {
if (loop.value == 2) {
audioPlayer.play();
}
else if (currentSongNum < playlist.length-1 ) {
currentSongNum++;
audioPlayer.src = playlist[currentSongNum];
audioPlayer.play();
}
else {
currentSongNum = 0;
audioPlayer.src = playlist[currentSongNum];
console.log(playlist[currentSongNum]);
if (loop.value == 1) {
console.log("cho");
audioPlayer.play();
}
}
}
function changeLoop(state){
if (state == 2){
loop.value = 0;
}
else{
loop.value++;
}
}
function playLast() {
if (loop.value == 2) {
audioPlayer.play();
return;
}
else if (currentSongNum > 0) {
currentSongNum--;
}
else {
currentSongNum = playlist.length - 1;
}
audioPlayer.src = playlist[currentSongNum];
audioPlayer.play();
}
function selectSong(n) {
currentSongNum = n;
audioPlayer.src = playlist[currentSongNum];
audioPlayer.play();
}
function generateSongsList(songsList) {
for (var i = 0; i < songsList.length; i++) {
playlist.push(songsList[i]["songPath"]);
var song = document.createElement("div");
song.className = "song";
song.id = i;
var SongName = document.createElement("h3");
SongName.innerHTML = albumInfo["authorName"] + " - " + songsList[i]["songName"];
SongName.className = "songName";
var playButton = document.createElement("button");
playButton.value = i;
playButton.onclick = function(){selectSong(this.value);};
playButton.innerHTML = "Вставить сюда svg";
playButton.className = "playButton";
var list = document.getElementById("songsList");
list.appendChild(song);
song.appendChild(SongName);
song.appendChild(playButton);
}
}
function updateCurrentInfo(){
currentSongName.innerHTML = songsList[currentSongNum]["songName"];
currentAuthorName.innerHTML = albumInfo["authorName"];
}
function play(){
if (audioPlayer.paused) {
audioPlayer.play()
}
else {
audioPlayer.pause();
}
}//АНИМАЦИИИ
function back(){
if (audioPlayer.currentTime > 3) {
audioPlayer.currentTime = 0;
audioPlayer.play();
}
else {
playLast();
}
}
function forward() {
if (audioPlayer.paused) {
playNext();
audioPlayer.pause();
}
else {
playNext();
audioPlayer.play();
}
}
generateSongsList(songsList);
audioPlayer.addEventListener("ended", function() {playNext()});
var audioObserver = new MutationObserver(function(mutations){
mutations.forEach(function(mutation) {
if (mutation.attributeName === "src") {
updateCurrentInfo();
}})
});
audioObserver.observe (audioPlayer, {attributes: true});
audioPlayer.src = playlist[currentSongNum];
cover.src = albumInfo["coverPath"];
miniCover.src = albumInfo["coverPath"];
authorName.innerHTML =albumInfo["authorName"] + " — " + albumInfo["albumName"];
description.innerHTML = albumInfo["description"];
//TODO: Кнопка для показа текста.
//анимации
//звук!
//Информация о текущей песне
</script>
</body>
</html>