add nav buttons to loading and clean up intervals

mistress
xenofem 2020-05-29 12:58:55 -04:00
parent f97243199d
commit 89736633b5
2 changed files with 81 additions and 57 deletions

View File

@ -4,6 +4,7 @@
<link rel="stylesheet" href="loading.css">
</head>
<body>
<div id="main-container">
<div id="config">
<div>
User configuration: You are a...
@ -52,6 +53,8 @@
Beginning installation...
</div>
</div>
</div>
<div id="controls"><a id="back" href=".."><img src="../back.svg"></a> <a id="reload" style="display: none;" href="."><img src="../reload.svg"></a></div>
<script type="text/javascript">
var boringStatuses = [
"Initializing database...",
@ -101,18 +104,25 @@
}
var progress = 0;
var progressInterval;
function makeProgress() {
if (progress >= 100) {
document.getElementById("status").innerText = "SLEEP";
document.getElementById("back").style.display = "";
document.getElementById("reload").style.display = "";
clearInterval(progressInterval);
return;
}
progress += 0.1;
document.getElementById("filled").style.width = progress + "%";
}
var statusInterval;
function updateStatus() {
var newStatus;
if (progress >= 100) {
newStatus = "SLEEP";
} else {
clearInterval(statusInterval);
return;
}
var newStatus;
if (Math.random()*100 < progress) {
if (optionalLewdStatuses.length > 0 && Math.floor(Math.random()*(lewdStatuses.length+1)) === 0) {
newStatus = randomChoice(optionalLewdStatuses);
@ -122,7 +132,6 @@
} else {
newStatus = randomChoice(boringStatuses);
}
}
document.getElementById("status").innerText = newStatus;
}
@ -139,9 +148,10 @@
document.getElementById("start").onclick = function() {
document.getElementById("config").style.display = "none";
document.getElementById("back").style.display = "none";
document.getElementById("installer").style.display = "";
setInterval(makeProgress, 50);
setInterval(updateStatus, 1500);
progressInterval = setInterval(makeProgress, 50);
statusInterval = setInterval(updateStatus, 1500);
};
</script>
</body>

View File

@ -2,6 +2,7 @@
font-family: 'Raleway';
src: url('../fonts/Raleway-Regular.otf');
}
body {
background-color: black;
color: red;
@ -9,8 +10,11 @@ body {
font-size: 25px;
font-weight: bold;
text-align: center;
width: 100%;
margin: 0px;
}
#main-container {
width: 100%;
position: absolute;
top: 50%;
transform: translateY(-50%);
@ -81,6 +85,16 @@ span.button:hover {
}
}
#controls {
position: absolute;
bottom: 10px;
left: 10px;
}
#controls img {
width: 40px;
height: 40px;
}
/*
* https://css-tricks.com/custom-styling-form-inputs-with-modern-css-features/
* https://codepen.io/aaroniker/pen/ZEYoxEY