-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathviewer.js
57 lines (55 loc) · 1.53 KB
/
viewer.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
let count = 0;
let player;
let connector;
let YTMDesktopUrl = "http://127.0.0.1:9863";
let readyCheck = setInterval(function () {
if (count > 3) {
clearInterval(readyCheck);
player = new Player();
connector = new Connector(player);
}
}, 500);
document.addEventListener("DOMContentLoaded", function () {
let require = [
"class/moment.min.js?v=2",
"class/player.js?v=2",
"class/connector.js?v=2",
"class/GDMPSettings.js?v=2"
];
for (i in require) {
var s = document.createElement('script');
s.src = require[i];
(document.head || document.documentElement).appendChild(s);
s.onload = function () {
count++;
};
}
if (window.location.search.length > 0) {
let urlParams = new URLSearchParams(window.location.search);
if (urlParams.get('features') !== null && urlParams.get('features') !== "") {
urlParams.get('features').split(" ").forEach(function (value) {
document.getElementsByTagName("body")[0].classList.add(value);
});
}
if (urlParams.get('url') !== null && urlParams.get('url') !== "") {
if (isValidUrl(urlParams.get('url'))) {
YTMDesktopUrl = urlParams.get('url');
} else {
alert("Url " + urlParams.get('url') + " is not valid URL, btw dont forget about the port, usually :9863");
}
}
}
});
function isValidUrl(string) {
try {
new URL(string);
return true;
} catch (err) {
return false;
}
}
$(window).resize(function () {
if ($("body").hasClass("circle-progressbar")) {
$('.song-info__album-art-image').circleProgress({size: $(".song-info__album-art-image").width() + 1});
}
});