update(front): links to loader code, add css

This commit is contained in:
rick 2021-08-31 18:58:29 +02:00
parent e16b1c1fa8
commit 620c6c6aae
Signed by: Rick
GPG key ID: 2B593F087240EE99

View file

@ -1,6 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<head> <head>
<link rel="stylesheet" href="/css/style.css"> <link rel="stylesheet" href="/css/style.css">
<link rel="stylesheet" href="/css/loader.css">
</head> </head>
<html> <html>
<body> <body>
@ -10,8 +11,8 @@
<div id="inf-loader"> <div id="inf-loader">
<div id="loader"></div> <div id="loader"></div>
<p>La playlist est en cours de traitement [<span id="nb-fait"></span>/<span id="nb-total"></span>]…</p> <p>La playlist est en cours de traitement [<span id="nb-fait">0</span>/<span id="nb-total">0</span>]…</p>
<p>[Code Source du loader](https://codepen.io/brunjo/pen/bNEWjV) sous [licence MIT](https://blog.codepen.io/documentation/licensing/).</p> <p><a href="https://codepen.io/brunjo/pen/bNEWjV">Code Source du loader</a> sous <a href="https://blog.codepen.io/documentation/licensing/">licence MIT</a>.</p>
</div> </div>
<div id="my-list"> <div id="my-list">
@ -22,11 +23,6 @@
async function test() { async function test() {
const data = await fetch('/refresh').then(response => response.json()); const data = await fetch('/refresh').then(response => response.json());
if (data != null) { if (data != null) {
if (data.done === data.todo) {
document.getElementById("inf-loader").remove();
clearInterval(refreshList);
}
if (data.url != null) { if (data.url != null) {
for (const elem of data.url) { for (const elem of data.url) {
let tmp = document.createTextNode(elem); let tmp = document.createTextNode(elem);
@ -38,6 +34,11 @@
document.getElementById("nb-fait").textContent = data.done; document.getElementById("nb-fait").textContent = data.done;
document.getElementById("nb-total").textContent = data.todo; document.getElementById("nb-total").textContent = data.todo;
if (data.done === data.todo) {
document.getElementById("inf-loader").remove();
clearInterval(refreshList);
}
} }
} }