-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreate.html
174 lines (164 loc) · 7.6 KB
/
create.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
<!DOCTYPE html>
<!--suppress JSJQueryEfficiency -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>Pop-Up Player creation</title>
<link rel="stylesheet" href="assets/css/loader.min.css">
<link rel="stylesheet" href="assets/css/easy-autocomplete.min.css">
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css">
</head>
<body class="d-flex flex-column justify-content-center bg-white">
<div class="container">
<div class="row">
<div class="col-12 text-center">
<h1 class="display-2 font-weight-bolder">Pop-Up laut.fm Player</h1>
</div>
<div class="col-12">
<div class="md-form">
<input type="text" id="station" class="form-control" required>
<label for="station">Station Name</label>
</div>
</div>
<div class="col-md-4">
<div class="md-form">
<i class="fas fa-palette prefix" id="color-icon"></i>
<input class="form-control" type="text" id="color" value="#1ed9b4">
<label for="color">Color</label>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-6 mt-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="station_info" checked>
<label class="custom-control-label" for="station_info">Show station info (Logo, Social Media, description)</label>
</div>
</div>
<div class="col-lg-6 mt-3">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="history" checked>
<label class="custom-control-label" for="history">Show track history</label>
</div>
</div>
<div class="col-lg-6 mt-3" id="current_pl_wrapper">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="current_pl" checked>
<label class="custom-control-label" for="current_pl">Show current playlist</label>
</div>
</div>
<div class="col-lg-6 mt-3" id="next_pl_wrapper">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="next_pl" checked>
<label class="custom-control-label" for="next_pl">Show next playlist</label>
</div>
</div>
<div class="col-lg-6 mt-3" id="badge_wrapper">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="badges" checked>
<label class="custom-control-label" for="badges">Show type badges</label>
</div>
</div>
<div class="col-0 col-lg-6"></div>
<div class="col-lg-6 mt-3" id="autoplay_wrapper">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="autoplay">
<label class="custom-control-label" for="autoplay">Autoplay on startup</label>
<small id="autoplayHelper" class="form-text text-muted">
On some browsers like Firefox, the browser itself blocks the autoplay of media.
</small>
</div>
</div>
<div class="col-lg-6 mt-3" id="cover_wrapper">
<div class="custom-control custom-checkbox">
<input type="checkbox" class="custom-control-input" id="cover" aria-describedby="coverHelper">
<label class="custom-control-label" for="cover">Show cover instead of track numbers</label>
<small id="coverHelper" class="form-text text-muted">
The rights of use are held by iTunes. The copyrights are held by the respective author.
</small>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="md-form input-group">
<input type="text" id="url" class="form-control" readonly>
<label for="url" class="active">Player URL</label>
<div class="input-group-append">
<a id="url_href" href="#" class="input-group-text md-addon" target="_blank">
<i class="fas fa-external-link-square-alt"></i>
</a>
</div>
</div>
</div>
</div>
</div>
<script src="assets/js/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/mdb/mdb.js"></script>
<script src="assets/js/fontawesome/all.min.js"></script>
<script src="assets/js/jquery.easy-autocomplete.min.js"></script>
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
<script type="text/javascript">
$.getJSON("https://api.laut.fm/stations", function (stations) {
var options = {
data: stations,
getValue: "name",
};
$("#station").easyAutocomplete(options);
});
</script>
<script>
$(function () {
$('#color').colorpicker({
useHashPrefix: false,
format: 'hex'
});
$('#color-icon').css('color', "#1ed9b4");
});
$('#color').on('colorpickerChange', function (event) {
$('#color-icon').css('color', event.color.toString());
});
/* Live changed */
let color = "#1ed9b4";
$("#color").on('colorpickerChange', function (event) {
color = event.color.toString();
});
$(document).on("change paste keyup", "#station, #color, #badges, #station_info, #current_pl, #next_pl, #cover, #history, #autoplay", function () {
let station = $("#station"),
infos = $("#station_info"),
history = $("#history");
!$("label[for='url']").hasClass("active") && $("label[for='url']").addClass("active");
/* URL Creation */
let url = "https://timbruenjes.github.io/lfm-player.github.io/?station=" + station.val() + "&color=" + color.substr(1);
!station.val() ? station.addClass("is-invalid") : station.removeClass("is-invalid");
station.val() ? $('[for*="station"]').addClass("active") : $('[for*="station"]').removeClass("active");
$("#autoplay").is(":checked") && (url += "&autoplay=true");
if (infos.is(":checked")) {
$("#current_pl_wrapper").removeClass("d-none");
$("#next_pl_wrapper").removeClass("d-none");
!$("#current_pl").is(":checked") && (url += "¤t_show=false");
!$("#next_pl").is(":checked") && (url += "&next_show=false");
} else {
$("#current_pl_wrapper").addClass("d-none");
$("#next_pl_wrapper").addClass("d-none");
url += "&station_info=false"
}
if (history.is(":checked")) {
$("#cover_wrapper").removeClass("d-none");
$("#badge_wrapper").removeClass("d-none");
$("#cover").is(":checked") && (url += "&cover=true");
!$("#badges").is(":checked") && (url += "&badges=false");
} else {
$("#cover_wrapper").addClass("d-none");
$("#badge_wrapper").addClass("d-none");
!history.is(":checked") && (url += "&history=false");
}
$("#url").val(url);
$("#url_href").attr("href", url)
})
</script>
</body>
</html>