-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
75 lines (70 loc) · 2.61 KB
/
index.html
File metadata and controls
75 lines (70 loc) · 2.61 KB
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
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<title>Lecteur Spot2SB</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="infoDiv"></div>
<div class="player" id="player" style="display:none;">
<div class="bg-blur" id="bg-blur"></div>
<div class="player-content">
<div class="cover-art" id="cover-art"></div>
<div class="info-bar">
<div class="track-name"><span id="track-name"></span></div>
<div class="artist-name" id="artist-name"></div>
<div class="requester-name" id="requester-name"></div>
<div class="time-row">
<div class="time-bar-bg" id="time-bar-bg">
<div class="time-bar-fill" id="time-bar-fill"></div>
</div>
<div class="time-remaining" id="time-remaining">0:00</div>
</div>
</div>
<div class="requester-pfp" id="requester-pfp"></div>
</div>
</div>
<script>
// Fonction de chargement d'un script, renvoie une promesse
function loadScript(src) {
return new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = src;
script.onload = resolve;
script.onerror = () => reject(new Error("Erreur de chargement : " + src));
document.head.appendChild(script);
});
}
// Fonction qui charge une librairie en testant trois sources : unpkg, jsDelivr, puis local
function loadLibrary(unpkgUrl, jsdelivrUrl, localUrl) {
return loadScript(unpkgUrl)
.catch(() => {
console.warn("CDN unpkg indisponible, passage à jsDelivr pour :", unpkgUrl);
return loadScript(jsdelivrUrl);
})
.catch(() => {
console.warn("CDN jsDelivr indisponible, passage au fallback local pour :", jsdelivrUrl);
return loadScript(localUrl);
});
}
// Charger StreamerbotClient
loadLibrary(
"https://unpkg.com/@streamerbot/client/dist/streamerbot-client.js",
"https://cdn.jsdelivr.net/npm/@streamerbot/client/dist/streamerbot-client.js",
"assets/js/websocket-client.umd.js"
)
// Charger ColorThief ensuite
.then(() => loadLibrary(
"https://unpkg.com/colorthief/dist/color-thief.umd.js",
"https://cdn.jsdelivr.net/npm/colorthief@2.3.2/dist/color-thief.umd.js",
"assets/js/color-thief.umd.js"
))
// Charger enfin ton script principal
.then(() => loadScript("script.js"))
.catch((err) => {
console.error("Erreur lors du chargement des scripts : ", err);
});
</script>
</body>
</html>