OpenAsar/src/splash/index.html

141 lines
2.9 KiB
HTML
Raw Normal View History

2021-12-12 15:00:08 +00:00
<video loop autoplay src="https://goosemod.com/vid/discord_loading.webm"></video>
<div id="text">Launching...</div>
2021-12-09 16:25:14 +00:00
<div id="bar-container"></div>
<div id="bar-fill"></div>
<div id="debug"></div>
2021-12-09 16:25:14 +00:00
<style>
2021-12-16 16:52:25 +00:00
:root {
--background-primary: #282b30;
--background-secondary: rgba(255, 255, 255, 0.1);
--brand-experiment: #5865F2;
--header-primary: #fff;
--text-muted: #72767d;
}
@font-face {
font-family: Whitney;
font-weight: 400;
font-style: normal;
src: url(https://goosemod.com/font/whitney_400.woff) format("woff");
}
2021-12-09 16:25:14 +00:00
html, body {
-webkit-app-region: drag;
overflow: hidden;
2021-12-09 16:25:14 +00:00
margin: 0;
padding: 0;
width: 100%;
height: 100%;
2021-12-16 16:52:25 +00:00
background: var(--background-primary);
2021-12-09 16:25:14 +00:00
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
2021-12-09 16:25:14 +00:00
}
* {
font-family: 'Whitney', sans-serif;
box-sizing: border-box;
-webkit-user-select: none;
cursor: default;
2021-12-09 16:25:14 +00:00
}
video {
width: 200px;
height: 150px;
object-fit: cover;
}
2021-12-09 16:25:14 +00:00
#text {
2021-12-09 16:25:14 +00:00
font-size: 7vw;
text-align: center;
2021-12-16 16:52:25 +00:00
color: var(--header-primary);
font-weight: 400;
font-style: italic;
font-size: 16px;
text-transform: uppercase;
2021-12-09 16:25:14 +00:00
width: 100%;
}
#bar-container, #bar-fill {
margin-top: 10px;
2021-12-09 16:25:14 +00:00
transform: translate(-50%, -50%);
width: 180px;
height: 8px;
2021-12-09 16:25:14 +00:00
border-radius: 4px;
visibility: hidden;
2021-12-09 16:25:14 +00:00
}
#bar-container {
position: absolute;
2021-12-16 16:52:25 +00:00
background: var(--background-secondary);
2021-12-09 16:25:14 +00:00
}
#bar-fill {
2021-12-16 16:52:25 +00:00
background-color: var(--brand-experiment);
2021-12-09 16:25:14 +00:00
width: 0;
transform: translate(0%, -50%);
left: 10%;
}
#debug {
position: absolute;
bottom: 6px;
right: 6px;
text-align: right;
font-size: 10px;
2021-12-16 16:52:25 +00:00
color: var(--text-muted);
white-space: pre;
}
2021-12-09 16:25:14 +00:00
</style>
<script>
const text = document.querySelector('#text');
const barContainer = document.querySelector('#bar-container');
const barFill = document.querySelector('#bar-fill');
DiscordSplash.signalReady();
const outOfStates = [ 'downloading-updates', 'installing-updates' ];
2021-12-09 16:25:14 +00:00
DiscordSplash.onStateUpdate(({ status, current, total, progress }) => {
text.textContent = status.replaceAll('-', ' ') + '...';
if (outOfStates.includes(state)) text.textContent += ` (${current}/${total})`;
2021-12-09 16:25:14 +00:00
if (progress) {
barContainer.style.visibility = 'visible';
barFill.style.visibility = 'visible';
2021-12-09 16:25:14 +00:00
barFill.style.width = 80 * (progress / 100) + '%';
} else {
barContainer.style.display = '';
barFill.style.display = '';
}
});
document.querySelector('#debug').textContent = DiscordSplash.getDebugInfo();
2021-12-16 16:52:25 +00:00
DiscordSplash.getCSS((css) => {
document.body.classList.add('theme-dark'); // Theme compat
const cssInject = document.createElement('style');
cssInject.appendChild(document.createTextNode(css));
document.body.appendChild(cssInject);
});
2021-12-09 16:25:14 +00:00
</script>