1
0
mirror of https://github.com/vladmandic/sdnext.git synced 2026-01-27 15:02:48 +03:00
Files
sdnext/javascript/loader.js
2023-07-19 14:07:54 -04:00

20 lines
888 B
JavaScript

async function createSplash() {
const dark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
const num = Math.floor(Math.random() * 7) + 1;
const splash = `
<div id="splash" class="splash" style="background: ${dark ? 'black' : 'white'}">
<div class="loading"><div class="loader"></div></div>
<div class="splash-img" alt="logo" style="background-image: url(file=html/logo-bg-${dark ? 'dark' : 'light'}.jpg), url(file=html/logo-bg-${num}.jpg); background-blend-mode: ${dark ? 'color-burn' : 'color-dodge'}"></div>
</div>`;
document.body.insertAdjacentHTML('beforeend', splash);
console.log('createSplash', dark);
}
async function removeSplash() { // called at the end of setHints
const splash = document.getElementById('splash');
if (splash) splash.remove();
console.log('removeSplash');
}
window.onload = createSplash;