-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
374 lines (343 loc) · 14.3 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
<!DOCTYPE html>
<!--
Copyright (C) 2021 Michael Slíva <[email protected]>
Licensed under the Academic Free License version 3.0
You should have received a copy of the Academic Free License version 3.0
along with this program. If not, see <https://spdx.org/licenses/AFL-3.0.html>.
-->
<html lang="en">
<head>
<title>MagicD3VIL's Radio Player</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="preload" href="./css/style.css" as="style">
<link rel="preload" href="./css/radio.css" as="style">
<link rel="stylesheet" href="./css/style.css">
<link rel="stylesheet" href="./css/radio.css">
<link rel="stylesheet" href="./css/jquery.modal.css">
<link rel="stylesheet" href="./css/fa.all.min.css">
<link rel='shortcut icon' type="image/x-icon" href='./favicon.ico'>
<link href="https://fonts.googleapis.com/css2?family=Exo+2&family=Lato&family=Montserrat&family=Ubuntu&family=IBM+Plex+Mono&display=swap" rel="stylesheet">
</head>
<body>
<script>0</script> <!-- FOUC fix -->
<div id="deadCenter">
<div id="radioPlayerContainer">
<!-- MagicD3VIL's Radio Player -->
<div id="MagicPlayer">
<div id="playerInfo"><div id="playerInfoHeading">PLAYING: </div><div id="playerInfoPlayingContainer"><span id="playerInfoPlaying" class="marquee"></span></div></div>
<div id="playerMiddleLine"><p id="radioPlayer"><i onclick="radioPlayerPlay()" class="fa fa-play-circle"></i><i onclick="radioPlayerPause()" class="fa fa-pause-circle"></i><span class="span8"> </span><input id="volume" type="range" min="0" max="100" step="1" oninput="setVolume(this.value)" onchange="setVolume(this.value)"><span class="span8"> </span>
<div id="equaliser-container"> <ol class="equaliser-column"> <li class="colour-bar"></li> </ol> <ol class="equaliser-column"> <li class="colour-bar"></li> </ol> <ol class="equaliser-column"> <li class="colour-bar"></li> </ol> <ol class="equaliser-column"> <li class="colour-bar"></li> </ol> <ol class="equaliser-column"> <li class="colour-bar"></li> </ol></div>
<span class="rememberHelp" id="playerAbout" title="MagicD3VIL's Radio Player"><i style ="font-size:1rem" class="far fa-question-circle"></i></span></div><div id="currentVolume"></div>
<div id="playerBottomLine"><p id="playerRememberHelp"><span class="rememberHelp" title="If you check this box, next time when you load or refresh this page your set volume will remain the same. By checking this box you agree to the use of cookies."><input type="checkbox" id="rememberVolume" onclick="rememberCheck()"/> Remember volume</span></p><div id="playerLogo"><p id="playerProviderLogo"><a href="https://clanhouse.eu" target="_blank"><img src="./clanhouse_24x28.png" alt="Clanhouse.eu Logo"></a></p><p id="playerRadioStationLogo"><a href="https://jetstreamradio.com/" target="_blank"><img src="./jetstream_28x28.png" alt="JetStream Radio Logo"></a></p></div>
<audio id="radio" preload="none">Your browser does not support <code><audio></code> element</audio></div>
</div>
<!-- END MagicD3VIL's Radio Player -->
</div>
</div>
<div class="linkButtons">
<div title="Project source code on GitHub" id="githubButton"><i onclick='window.open("https://github.com/MagicD3VIL/RadioPlayer", "_blank");' class="fab fa-github"></i></div>
</div>
<div class="toggleButtons">
<div title="Darkmode By clicking this button you agree to the use of cookies." id="darkmodeToggle"><i onclick="setDarkmode()" class="fas fa-lightbulb"></i></div>
<div title="Download the m3u file for your own player" id="downloadButton"><i onclick='window.open("https://listen.jetstreamradio.com:8000/autodj.m3u", "_blank");' class="fas fa-download"></i></div>
<div title="History" id="historyButton"><i onclick="historyModalOpen()" class="fas fa-history"></i></div>
<div title="Timer"><svg id="timerButton" onclick="timerModalOpen()" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M6.5 0a.5.5 0 0 0 0 1H7v1.07a7.001 7.001 0 0 0-3.273 12.474l-.602.602a.5.5 0 0 0 .707.708l.746-.746A6.97 6.97 0 0 0 8 16a6.97 6.97 0 0 0 3.422-.892l.746.746a.5.5 0 0 0 .707-.708l-.601-.602A7.001 7.001 0 0 0 9 2.07V1h.5a.5.5 0 0 0 0-1h-3zm1.038 3.018a6.093 6.093 0 0 1 .924 0 6 6 0 1 1-.924 0zM8.5 5.5a.5.5 0 0 0-1 0v3.362l-1.429 2.38a.5.5 0 1 0 .858.515l1.5-2.5A.5.5 0 0 0 8.5 9V5.5zM0 3.5c0 .753.333 1.429.86 1.887A8.035 8.035 0 0 1 4.387 1.86 2.5 2.5 0 0 0 0 3.5zM13.5 1c-.753 0-1.429.333-1.887.86a8.035 8.035 0 0 1 3.527 3.527A2.5 2.5 0 0 0 13.5 1z"/></svg></div>
</div>
<!-- SCRIPTS -->
<script src="./js/jquery-3.4.1.min.js"></script>
<script src="./js/jquery.modal.min.js"></script>
<!-- HISTORY -->
<script>
let history = new Array(9);
let historyTimestamp = new Array(9);
function printHistory() {
var historyHTML = "";
for (var i = 0; (i < 10) && (i <= history.length) && (history[i] !== undefined); i++) {
historyHTML += "<p>" + historyTimestamp[i] + history[i] + "</p>";
}
$("#songList").html(historyHTML);
}
function historyModalOpen() {
$("#historyModal").modal({
fadeDuration: 585,
});
printHistory();
}
function songToHistory(song) {
if ((song !== "") && (song !== undefined) && !(song.includes("<b>Warning</b>:") || song.includes("<b>Error</b>:"))) {
if (history[0] != song) {
for (var i = 8; i >= 0; i--) {
history[i+1] = history[i];
historyTimestamp[i+1] = historyTimestamp[i];
}
var timestamp = new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit', hour12: false});
history[0] = song;
historyTimestamp[0] = "<code>" + timestamp + "</code> | ";
printHistory();
}
}
}
</script>
<!-- END HISTORY -->
<!-- MagicD3VIL's Radio Player -->
<script src="./radioPlayer.js"></script>
<!-- END MagicD3VIL's Radio Player -->
<!-- NIGHTMODE -->
<script>
function getDarkmode() {
var result = Number(getCookieValue("darkmode"));
if (result == 0) {
return false;
} else {
return true;
}
}
function setDarkmode() {
if (!getDarkmode()) {
$("html").css("background-color", "#303030");
$("body").css("background-color", "#303030");
$("#githubButton").css("color", "#FFD034");
$("#darkmodeToggle").css("color", "#FFD034");
$("#historyButton").css("color", "#FFD034");
$("#timerButton").css("fill", "#FFD034");
$("#downloadButton").css("color", "#FFD034");
$("#MagicPlayer").css("border-color", "transparent");
document.cookie = "darkmode=" + 1 + ";" + expires + ";path=/;SameSite=Strict;Secure";
}
else {
$("html").css("background-color", "white");
$("body").css("background-color", "white");
$("#githubButton").css("color", "#585858");
$("#darkmodeToggle").css("color", "#585858");
$("#historyButton").css("color", "#585858");
$("#timerButton").css("fill", "#585858");
$("#downloadButton").css("color", "#585858");
$("#MagicPlayer").css("border-color", "initial");
document.cookie = "darkmode=" + 0 + ";" + expires + ";path=/;SameSite=Strict;Secure";
}
}
if (getDarkmode()) {
$("html").css("background-color", "#303030");
$("body").css("background-color", "#303030");
$("#githubButton").css("color", "#FFD034");
$("#darkmodeToggle").css("color", "#FFD034");
$("#historyButton").css("color", "#FFD034");
$("#timerButton").css("fill", "#FFD034");
$("#downloadButton").css("color", "#FFD034");
$("#MagicPlayer").css("border-color", "transparent");
}
$("#githubButton").mouseover(function() {
if (getDarkmode()) {
$(this).css("color","white");
}
else {
$(this).css("color","black");
}
}).mouseout(function() {
if (getDarkmode()) {
$(this).css("color","#FFD034");
}
else {
$(this).css("color","#585858");
}
});
$("#darkmodeToggle").mouseover(function() {
if (getDarkmode()) {
$(this).css("color","white");
}
else {
$(this).css("color","black");
}
}).mouseout(function() {
if (getDarkmode()) {
$(this).css("color","#FFD034");
}
else {
$(this).css("color","#585858");
}
});
$("#historyButton").mouseover(function() {
if (getDarkmode()) {
$(this).css("color","white");
}
else {
$(this).css("color","black");
}
}).mouseout(function() {
if (getDarkmode()) {
$(this).css("color","#FFD034");
}
else {
$(this).css("color","#585858");
}
});
$("#timerButton").mouseover(function() {
if (getDarkmode()) {
$(this).css("fill","white");
}
else {
$(this).css("fill","black");
}
}).mouseout(function() {
if (getDarkmode()) {
$(this).css("fill","#FFD034");
}
else {
$(this).css("fill","#585858");
}
});
$("#downloadButton").mouseover(function() {
if (getDarkmode()) {
$(this).css("color","white");
}
else {
$(this).css("color","black");
}
}).mouseout(function() {
if (getDarkmode()) {
$(this).css("color","#FFD034");
}
else {
$(this).css("color","#585858");
}
});
</script>
<!-- END NIGHTMODE -->
<!-- TIMER -->
<script>
var timer = 0;
var timerMinutes = false;
var timerRemainingMinutes = 0;
var timerRemainingSeconds = 0;
var timerRemainingHours = 0;
var timerRemainingMinutesInterval;
var timerRemainingSecondsInterval;
var timerTimeout;
var timerIntervalMinute = 60000; // 1 minute in ms
var timerIntervalSecond = 1000; // 1 second in ms
var timerIntervalHour = 3600000; // 1 second in ms
function timerModalOpen() {
$("#timerModal").modal({
fadeDuration: 585,
});
}
function timerRemainingMinutesDecrease() {
timerMinutes--;
if (timerMinutes < 0) {
timer = 0;
timerMinutes = false;
timerRemainingMinutes = 0;
timerRemainingSeconds = 0;
timerRemainingHours = 0;
clearInterval(timerRemainingSecondsInterval);
$("#timerLeft").text("");
clearInterval(timerRemainingMinutesInterval);
}
if (timerRemainingHours > 0) {
if (timerRemainingMinutes <= 0) {
timerRemainingMinutes = 60;
timerRemainingHours--;
}
else if (timerRemainingMinutes > 60) {
timerRemainingMinutes = 60;
}
}
timerRemainingMinutes--;
}
function timerRemainingSecondsDecrease() {
if (timerRemainingSeconds <= 0)
timerRemainingSeconds = 60;
else if (timerRemainingSeconds > 60) {
timerRemainingSeconds = 60;
}
timerRemainingSeconds--;
var timerLeftText = "Time left before radio stops: ";
if ((timerRemainingHours > 0) && (timerRemainingHours >= 10)) {
timerLeftText += timerRemainingHours + ":";
}
else if ((timerRemainingHours > 0) && (timerRemainingHours < 10)) {
timerLeftText += "0" + timerRemainingHours + ":";
}
if (timerRemainingMinutes >= 10) {
timerLeftText += timerRemainingMinutes + ":";
}
else {
timerLeftText += "0" + timerRemainingMinutes + ":";
}
if (timerRemainingSeconds >= 10) {
timerLeftText += timerRemainingSeconds;
}
else {
timerLeftText += "0" + timerRemainingSeconds;
}
$("#timerLeft").text(timerLeftText);
}
function timerShowRemaining() {
if (timerMinutes != false) {
timerRemainingSeconds = 59;
timerRemainingMinutes--;
if (timerRemainingMinutes > 59) {
timerRemainingHours = Math.floor(timerRemainingMinutes / 60);
timerRemainingMinutes = timerRemainingMinutes % 60;
}
timerRemainingMinutesInterval = setInterval(timerRemainingMinutesDecrease, timerIntervalMinute);
timerRemainingSecondsInterval = setInterval(timerRemainingSecondsDecrease, timerIntervalSecond);
timerMinutes--;
}
}
function timerSet() {
if (timer != 0) {
timerClear();
}
timerMinutes = parseInt($("#timerNumber").val());
timerRemainingMinutes = timerMinutes;
timer = timerMinutes * timerIntervalMinute;
timerShowRemaining();
timerTimeout = setTimeout(radioPlayerPause, timer);
}
function timerClear() {
clearTimeout(timerTimeout);
timer = 0;
timerMinutes = false;
timerRemainingMinutes = 0;
timerRemainingSeconds = 0;
timerRemainingHours = 0;
$("#timerLeft").text("");
clearInterval(timerRemainingSecondsInterval);
clearInterval(timerRemainingMinutesInterval);
}
</script>
<!-- END TIMER -->
<!-- END SCRIPTS -->
<!-- MODAL WINDOWS -->
<div id="timerModal" class="modal">
<h2>Set the player timer</h2>
<hr>
<span id="timerLeft"></span>
<form class="formColumn">
<div class="nameColumn">
<label for="timerNumber">Minutes</label>
</div>
<div class="inputColumn">
<input type="number" id="timerNumber" name="timerNumber" min="1" max="1440" placeholder="30" required>
</div>
</form>
<div class="buttonContainer">
<a class="btn" href="#" rel="modal:close">Close</a>
<a class="btn" href="#" onclick="timerClear()">Reset timer</a>
<a class="btn" href="#" onclick="timerSet()">Set timer</a>
</div>
</div>
<div id="historyModal" class="modal">
<h2>Song history</h2>
<hr>
<div id="songList">
</div>
<div class="buttonContainer">
<a class="btn" href="#" rel="modal:close">Close</a>
</div>
</div>
<!-- END MODAL WINDOWS -->
</body>
</html>