add nav buttons to loading and clean up intervals

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

View file

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