2021-08-29 21:12:17 +02:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<head>
|
|
|
|
<link rel="stylesheet" href="/css/style.css">
|
|
|
|
</head>
|
|
|
|
<html>
|
|
|
|
<body>
|
|
|
|
<h1>Spotify To Bandcamp</h1>
|
|
|
|
<p>Recherche dans une playlist les artistes se trouvant aussi sur Bandcamp !</p>
|
|
|
|
<hr />
|
|
|
|
|
2021-08-31 18:39:56 +02:00
|
|
|
<div id="inf-loader">
|
|
|
|
<div id="loader"></div>
|
|
|
|
<p>La playlist est en cours de traitement [<span id="nb-fait"></span>/<span id="nb-total"></span>]…</p>
|
|
|
|
<p>[Code Source du loader](https://codepen.io/brunjo/pen/bNEWjV) sous [licence MIT](https://blog.codepen.io/documentation/licensing/).</p>
|
|
|
|
</div>
|
|
|
|
|
2021-08-29 21:12:17 +02:00
|
|
|
<div id="my-list">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
<script>
|
|
|
|
async function test() {
|
|
|
|
const data = await fetch('/refresh').then(response => response.json());
|
|
|
|
if (data != null) {
|
2021-08-31 18:39:56 +02:00
|
|
|
if (data.done === data.todo) {
|
|
|
|
document.getElementById("inf-loader").remove();
|
|
|
|
clearInterval(refreshList);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (data.url != null) {
|
|
|
|
for (const elem of data.url) {
|
|
|
|
let tmp = document.createTextNode(elem);
|
|
|
|
let newP = document.createElement("p");
|
|
|
|
newP.appendChild(tmp);
|
|
|
|
document.getElementById("my-list").appendChild(newP);
|
|
|
|
}
|
2021-08-29 21:12:17 +02:00
|
|
|
}
|
2021-08-31 18:39:56 +02:00
|
|
|
|
|
|
|
document.getElementById("nb-fait").textContent = data.done;
|
|
|
|
document.getElementById("nb-total").textContent = data.todo;
|
2021-08-29 21:12:17 +02:00
|
|
|
}
|
|
|
|
}
|
2021-08-31 14:44:12 +02:00
|
|
|
|
|
|
|
window.onbeforeunload = function() {
|
|
|
|
return "Vous perdrez tous les artistes trouvés en rafraichissant la page."
|
|
|
|
}
|
2021-08-31 18:39:56 +02:00
|
|
|
|
|
|
|
const refreshList = setInterval(test, 3000);
|
2021-08-29 21:12:17 +02:00
|
|
|
</script>
|
|
|
|
<html>
|