update download contents as more files become available
This commit is contained in:
parent
007289ffe5
commit
be4decde12
4 changed files with 80 additions and 16 deletions
14
static/js/download.js
Normal file
14
static/js/download.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
document.addEventListener("DOMContentLoaded", () => {
|
||||
const table = document.getElementById("download_contents").getElementsByTagName("tbody")[0];
|
||||
if (table.children.length === 0) { return; }
|
||||
|
||||
setInterval(() => {
|
||||
fetch(`info?code=${CODE}`)
|
||||
.then((res) => res.json())
|
||||
.then((info) => {
|
||||
for (const [index, offset] of info.offsets.entries()) {
|
||||
table.children[index].className = (offset > info.available) ? "unavailable" : "";
|
||||
}
|
||||
});
|
||||
}, 5000);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue