88 lines
2.0 KiB
HTML
88 lines
2.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>ESTABLO</title>
|
|
|
|
<style>
|
|
body {
|
|
padding: 0;
|
|
margin: 0;
|
|
background: #ffffff;
|
|
}
|
|
|
|
#loading {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: #ffffff;
|
|
}
|
|
|
|
#app {
|
|
width: 100vw;
|
|
height: 100vh;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="loading">
|
|
<img src=logo.svg>
|
|
</div>
|
|
|
|
<iframe frameborder="0" id="app"></iframe>
|
|
|
|
<script>
|
|
|
|
const loadingScreen = document.getElementById("loading");
|
|
const app = document.getElementById("app");
|
|
let timeout
|
|
app.style.display = "none";
|
|
|
|
function request_image(url) {
|
|
return new Promise(function (resolve, reject) {
|
|
var img = new Image();
|
|
img.onload = function () { resolve(img); };
|
|
img.onerror = function () { reject(url); };
|
|
img.src = url + '?random-no-cache=' + Math.floor((1 + Math.random()) * 0x10000).toString(16);
|
|
});
|
|
}
|
|
|
|
function checkApp(url) {
|
|
request_image(`http://localhost:5173/favicon.ico`).then(function () {
|
|
timeout = setTimeout(function () {
|
|
// show app
|
|
loadingScreen.style.display = "none";
|
|
if (app.style.display === "none") {
|
|
app.style.display = "block";
|
|
// reinitialize iframe
|
|
app.src = app.src;
|
|
}
|
|
}, 2000)
|
|
}).catch(function (error) {
|
|
// show loading screen
|
|
clearTimeout(timeout)
|
|
|
|
app.style.display = "none";
|
|
loadingScreen.style.display = "flex";
|
|
})
|
|
}
|
|
|
|
function init() {
|
|
app.src = "http://localhost:5173/";
|
|
url = app.src;
|
|
loadingScreen.style.display = "flex";
|
|
setInterval(function () { checkApp(url) }, 1000)
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", init)
|
|
</script>
|
|
</body>
|
|
|
|
</html>
|