mirror of
https://github.com/C4illin/ConvertX.git
synced 2025-10-23 04:52:18 +00:00
25 lines
733 B
JavaScript
25 lines
733 B
JavaScript
const webroot = document.querySelector("meta[name='webroot']").content;
|
|
const jobId = window.location.pathname.split("/").pop();
|
|
const main = document.querySelector("main");
|
|
let progressElem = document.querySelector("progress");
|
|
|
|
const refreshData = () => {
|
|
// console.log("Refreshing data...", progressElem.value, progressElem.max);
|
|
if (progressElem.value !== progressElem.max) {
|
|
fetch(`${webroot}/progress/${jobId}`, {
|
|
method: "POST",
|
|
})
|
|
.then((res) => res.text())
|
|
.then((html) => {
|
|
main.innerHTML = html;
|
|
})
|
|
.catch((err) => console.log(err));
|
|
|
|
setTimeout(refreshData, 1000);
|
|
}
|
|
|
|
progressElem = document.querySelector("progress");
|
|
};
|
|
|
|
refreshData();
|