Frederik Baerentsen
3 months ago
3 changed files with 113 additions and 4 deletions
@ -0,0 +1,75 @@ |
|||
<!doctype html> |
|||
<html> |
|||
|
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
|
|||
<style> |
|||
|
|||
body { |
|||
background-color: #D64F2A; |
|||
} |
|||
|
|||
.progress { |
|||
display: flex; |
|||
position: absolute; |
|||
height: 100%; |
|||
width: 100%; |
|||
} |
|||
|
|||
.status { |
|||
color: white; |
|||
margin: auto; |
|||
} |
|||
|
|||
.status h2 { |
|||
padding: 50px; |
|||
font-size: 80px; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
</style> |
|||
|
|||
<title>Status Update</title> |
|||
|
|||
</head> |
|||
|
|||
<body> |
|||
<div class="progress"> |
|||
<div class="status"> |
|||
<h2 id="innerStatus">Loading...</h2> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
|
|||
<script> |
|||
var timeout; |
|||
|
|||
async function getStatus() { |
|||
|
|||
let get; |
|||
|
|||
try { |
|||
const res = await fetch("/status"); |
|||
get = await res.json(); |
|||
} catch (e) { |
|||
console.error("Error: ", e); |
|||
} |
|||
|
|||
document.getElementById("innerStatus").innerHTML = Math.round(get.status / get.total * 100,0) + "%"; |
|||
|
|||
if (get.status == get.total){ |
|||
document.getElementById("innerStatus").innerHTML += " Done."; |
|||
clearTimeout(timeout); |
|||
// Simulate a mouse click: |
|||
window.location.href = "/"; |
|||
return false; |
|||
} |
|||
|
|||
timeout = setTimeout(getStatus, 1000); |
|||
} |
|||
|
|||
getStatus(); |
|||
</script> |
|||
|
|||
</html> |
Loading…
Reference in new issue