Update index.html
Browse files- index.html +17 -25
index.html
CHANGED
@@ -17,23 +17,20 @@
|
|
17 |
height: 100vh;
|
18 |
overflow: hidden;
|
19 |
}
|
20 |
-
|
21 |
header {
|
22 |
width: 100%;
|
23 |
background-color: #1DB954;
|
24 |
-
padding: 10px 40px;
|
25 |
display: flex;
|
26 |
align-items: center;
|
27 |
justify-content: space-between;
|
28 |
-
box-sizing: border-box;
|
29 |
}
|
30 |
-
|
31 |
header h1 {
|
32 |
margin: 0;
|
33 |
font-size: 24px;
|
34 |
-
|
35 |
}
|
36 |
-
|
37 |
.stop-button {
|
38 |
background-color: #4A4A4A;
|
39 |
color: #B3B3B3;
|
@@ -43,11 +40,9 @@
|
|
43 |
cursor: pointer;
|
44 |
font-size: 16px;
|
45 |
}
|
46 |
-
|
47 |
.stop-button:hover {
|
48 |
background-color: #C5303A;
|
49 |
}
|
50 |
-
|
51 |
.genre-container {
|
52 |
margin: 20px;
|
53 |
padding: 20px;
|
@@ -57,18 +52,15 @@
|
|
57 |
width: 90%;
|
58 |
max-width: 600px;
|
59 |
}
|
60 |
-
|
61 |
.genre-title {
|
62 |
font-size: 20px;
|
63 |
margin-bottom: 10px;
|
64 |
}
|
65 |
-
|
66 |
.track-list {
|
67 |
list-style: none;
|
68 |
padding: 0;
|
69 |
margin: 0;
|
70 |
}
|
71 |
-
|
72 |
.track-list li {
|
73 |
display: flex;
|
74 |
justify-content: space-between;
|
@@ -79,16 +71,13 @@
|
|
79 |
border-radius: 5px;
|
80 |
transition: all 0.3s ease;
|
81 |
}
|
82 |
-
|
83 |
.track-list li:last-child {
|
84 |
margin-bottom: 0;
|
85 |
}
|
86 |
-
|
87 |
.track-list li:hover {
|
88 |
background-color: #444;
|
89 |
transform: scale(1.05);
|
90 |
}
|
91 |
-
|
92 |
.track-list button {
|
93 |
background-color: #1DB954;
|
94 |
color: #FFF;
|
@@ -99,16 +88,13 @@
|
|
99 |
font-size: 14px;
|
100 |
transition: background-color 0.3s ease;
|
101 |
}
|
102 |
-
|
103 |
.track-list button:hover {
|
104 |
background-color: #1AA34A;
|
105 |
}
|
106 |
-
|
107 |
.playing {
|
108 |
background-color: #555;
|
109 |
cursor: not-allowed;
|
110 |
}
|
111 |
-
|
112 |
footer {
|
113 |
margin-top: auto;
|
114 |
padding: 10px;
|
@@ -118,7 +104,6 @@
|
|
118 |
width: 100%;
|
119 |
color: #B3B3B3;
|
120 |
}
|
121 |
-
|
122 |
.firework {
|
123 |
position: absolute;
|
124 |
width: 10px;
|
@@ -126,7 +111,6 @@
|
|
126 |
border-radius: 50%;
|
127 |
animation: explode 2s ease-out forwards;
|
128 |
}
|
129 |
-
|
130 |
@keyframes explode {
|
131 |
0% {
|
132 |
transform: translateY(0) scale(1);
|
@@ -146,7 +130,10 @@
|
|
146 |
<body>
|
147 |
<header>
|
148 |
<h1>Stream</h1>
|
149 |
-
<
|
|
|
|
|
|
|
150 |
</header>
|
151 |
|
152 |
<div class="genre-container">
|
@@ -160,7 +147,7 @@
|
|
160 |
Rock
|
161 |
<button class="play-button" onclick="playMusic('N5M1kIdcKhE', this)">Play</button>
|
162 |
</li>
|
163 |
-
|
164 |
Dubstep
|
165 |
<button class="play-button" onclick="playMusic('sR-sbG98ldM', this)">Play</button>
|
166 |
</li>
|
@@ -179,7 +166,6 @@
|
|
179 |
tag.src = "https://www.youtube.com/iframe_api";
|
180 |
var firstScriptTag = document.getElementsByTagName('script')[0];
|
181 |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
182 |
-
|
183 |
var player;
|
184 |
var fireworkInterval;
|
185 |
|
@@ -215,11 +201,9 @@
|
|
215 |
|
216 |
function playMusic(videoId, button) {
|
217 |
if (player) {
|
218 |
-
// Сначала останавливаем текущий трек, если он играет
|
219 |
stopMusic();
|
220 |
player.loadVideoById(videoId);
|
221 |
player.playVideo();
|
222 |
-
// Заменяем кнопку на "Серую"
|
223 |
button.classList.add('playing');
|
224 |
button.textContent = "Playing...";
|
225 |
}
|
@@ -230,13 +214,21 @@
|
|
230 |
player.stopVideo();
|
231 |
}
|
232 |
clearInterval(fireworkInterval);
|
233 |
-
// Возвращаем все кнопки Play в исходное состояние
|
234 |
document.querySelectorAll('.play-button').forEach(button => {
|
235 |
button.classList.remove('playing');
|
236 |
button.textContent = "Play";
|
237 |
});
|
238 |
}
|
239 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
function updateTime() {
|
241 |
const now = new Date();
|
242 |
const timeString = now.toLocaleTimeString();
|
|
|
17 |
height: 100vh;
|
18 |
overflow: hidden;
|
19 |
}
|
|
|
20 |
header {
|
21 |
width: 100%;
|
22 |
background-color: #1DB954;
|
23 |
+
padding: 10px 40px;
|
24 |
display: flex;
|
25 |
align-items: center;
|
26 |
justify-content: space-between;
|
27 |
+
box-sizing: border-box;
|
28 |
}
|
|
|
29 |
header h1 {
|
30 |
margin: 0;
|
31 |
font-size: 24px;
|
32 |
+
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7);
|
33 |
}
|
|
|
34 |
.stop-button {
|
35 |
background-color: #4A4A4A;
|
36 |
color: #B3B3B3;
|
|
|
40 |
cursor: pointer;
|
41 |
font-size: 16px;
|
42 |
}
|
|
|
43 |
.stop-button:hover {
|
44 |
background-color: #C5303A;
|
45 |
}
|
|
|
46 |
.genre-container {
|
47 |
margin: 20px;
|
48 |
padding: 20px;
|
|
|
52 |
width: 90%;
|
53 |
max-width: 600px;
|
54 |
}
|
|
|
55 |
.genre-title {
|
56 |
font-size: 20px;
|
57 |
margin-bottom: 10px;
|
58 |
}
|
|
|
59 |
.track-list {
|
60 |
list-style: none;
|
61 |
padding: 0;
|
62 |
margin: 0;
|
63 |
}
|
|
|
64 |
.track-list li {
|
65 |
display: flex;
|
66 |
justify-content: space-between;
|
|
|
71 |
border-radius: 5px;
|
72 |
transition: all 0.3s ease;
|
73 |
}
|
|
|
74 |
.track-list li:last-child {
|
75 |
margin-bottom: 0;
|
76 |
}
|
|
|
77 |
.track-list li:hover {
|
78 |
background-color: #444;
|
79 |
transform: scale(1.05);
|
80 |
}
|
|
|
81 |
.track-list button {
|
82 |
background-color: #1DB954;
|
83 |
color: #FFF;
|
|
|
88 |
font-size: 14px;
|
89 |
transition: background-color 0.3s ease;
|
90 |
}
|
|
|
91 |
.track-list button:hover {
|
92 |
background-color: #1AA34A;
|
93 |
}
|
|
|
94 |
.playing {
|
95 |
background-color: #555;
|
96 |
cursor: not-allowed;
|
97 |
}
|
|
|
98 |
footer {
|
99 |
margin-top: auto;
|
100 |
padding: 10px;
|
|
|
104 |
width: 100%;
|
105 |
color: #B3B3B3;
|
106 |
}
|
|
|
107 |
.firework {
|
108 |
position: absolute;
|
109 |
width: 10px;
|
|
|
111 |
border-radius: 50%;
|
112 |
animation: explode 2s ease-out forwards;
|
113 |
}
|
|
|
114 |
@keyframes explode {
|
115 |
0% {
|
116 |
transform: translateY(0) scale(1);
|
|
|
130 |
<body>
|
131 |
<header>
|
132 |
<h1>Stream</h1>
|
133 |
+
<div>
|
134 |
+
<button class="stop-button" onclick="playRandom()">Play Random</button>
|
135 |
+
<button class="stop-button" onclick="stopMusic()">Stop All</button>
|
136 |
+
</div>
|
137 |
</header>
|
138 |
|
139 |
<div class="genre-container">
|
|
|
147 |
Rock
|
148 |
<button class="play-button" onclick="playMusic('N5M1kIdcKhE', this)">Play</button>
|
149 |
</li>
|
150 |
+
<li class="dubstep">
|
151 |
Dubstep
|
152 |
<button class="play-button" onclick="playMusic('sR-sbG98ldM', this)">Play</button>
|
153 |
</li>
|
|
|
166 |
tag.src = "https://www.youtube.com/iframe_api";
|
167 |
var firstScriptTag = document.getElementsByTagName('script')[0];
|
168 |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
|
|
|
169 |
var player;
|
170 |
var fireworkInterval;
|
171 |
|
|
|
201 |
|
202 |
function playMusic(videoId, button) {
|
203 |
if (player) {
|
|
|
204 |
stopMusic();
|
205 |
player.loadVideoById(videoId);
|
206 |
player.playVideo();
|
|
|
207 |
button.classList.add('playing');
|
208 |
button.textContent = "Playing...";
|
209 |
}
|
|
|
214 |
player.stopVideo();
|
215 |
}
|
216 |
clearInterval(fireworkInterval);
|
|
|
217 |
document.querySelectorAll('.play-button').forEach(button => {
|
218 |
button.classList.remove('playing');
|
219 |
button.textContent = "Play";
|
220 |
});
|
221 |
}
|
222 |
|
223 |
+
function playRandom() {
|
224 |
+
const tracks = document.querySelectorAll('.track-list li');
|
225 |
+
const randomIndex = Math.floor(Math.random() * tracks.length);
|
226 |
+
const randomTrack = tracks[randomIndex];
|
227 |
+
const button = randomTrack.querySelector('.play-button');
|
228 |
+
const videoId = button.getAttribute('onclick').match(/'(.*?)'/)[1];
|
229 |
+
playMusic(videoId, button);
|
230 |
+
}
|
231 |
+
|
232 |
function updateTime() {
|
233 |
const now = new Date();
|
234 |
const timeString = now.toLocaleTimeString();
|