1
0
mirror of https://github.com/coalaura/whiskr.git synced 2025-09-09 09:19:54 +00:00

loading screen and icon preload

This commit is contained in:
Laura
2025-08-19 17:12:36 +02:00
parent c24b0e87f7
commit ebb27ef34e
5 changed files with 102 additions and 2 deletions

View File

@@ -51,6 +51,12 @@
}, 0);
}
function preloadIcons(icons) {
for (const icon of icons) {
new Image().src = `/css/icons/${icon}`;
}
}
function mark(index) {
for (let x = 0; x < messages.length; x++) {
messages[x].mark(Number.isInteger(index) && x >= index);
@@ -977,6 +983,9 @@
return false;
}
// start icon preload
preloadIcons(data.icons);
// render version
if (data.version === "dev") {
$version.remove();
@@ -1416,5 +1425,9 @@
restore();
document.body.classList.remove("loading");
setTimeout(() => {
document.getElementById("loading").remove();
}, 500);
});
})();