2021-12-29 15:18:48 +03:00
|
|
|
<script context="module" lang="ts">
|
|
|
|
declare const Neutralino;
|
|
|
|
</script>
|
2021-12-29 15:59:55 +03:00
|
|
|
|
2021-12-29 15:02:12 +03:00
|
|
|
<script lang="ts">
|
|
|
|
import { onMount } from 'svelte';
|
|
|
|
import { _, locale } from 'svelte-i18n';
|
|
|
|
|
2022-01-28 20:37:44 +03:00
|
|
|
import { Configs, IPC, Windows } from './empathize';
|
2021-12-29 15:02:12 +03:00
|
|
|
|
2022-01-30 17:26:20 +03:00
|
|
|
import constants from './ts/Constants';
|
|
|
|
|
2021-12-29 15:56:54 +03:00
|
|
|
import Splash from './assets/gifs/running-qiqi.gif';
|
|
|
|
import SplashSecret from './assets/gifs/loading-marie-please.gif';
|
|
|
|
|
|
|
|
const splash = Math.round(Math.random() * 100) < 100 ? Splash : SplashSecret;
|
2021-12-29 15:02:12 +03:00
|
|
|
|
2022-01-10 13:20:15 +03:00
|
|
|
let phrase = Math.round(Math.random() * 8);
|
2021-12-29 15:02:12 +03:00
|
|
|
|
|
|
|
onMount(() => {
|
2022-01-28 20:37:44 +03:00
|
|
|
Windows.current.show();
|
2022-01-30 02:18:41 +03:00
|
|
|
Windows.current.center(300, 400);
|
2021-12-29 15:02:12 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
const isLauncherLoaded = () => {
|
2022-01-02 00:57:50 +03:00
|
|
|
IPC.read().then(async (records) => {
|
2022-01-02 00:40:26 +03:00
|
|
|
const launcherLoaded = records.filter((record) => record.data === 'launcher-loaded');
|
|
|
|
|
|
|
|
if (launcherLoaded.length > 0)
|
|
|
|
{
|
2022-01-02 00:57:50 +03:00
|
|
|
for (const record of launcherLoaded)
|
|
|
|
await record.pop();
|
2021-12-29 15:02:12 +03:00
|
|
|
|
2022-01-28 20:37:44 +03:00
|
|
|
Windows.current.hide();
|
2021-12-29 15:02:12 +03:00
|
|
|
Neutralino.app.exit();
|
2022-01-02 00:40:26 +03:00
|
|
|
}
|
|
|
|
|
2022-01-06 00:27:00 +03:00
|
|
|
else setTimeout(isLauncherLoaded, 500);
|
2022-01-02 00:40:26 +03:00
|
|
|
});
|
2021-12-29 15:02:12 +03:00
|
|
|
};
|
|
|
|
|
2022-01-06 00:27:00 +03:00
|
|
|
Neutralino.events.on('ready', () => isLauncherLoaded());
|
2021-12-29 15:02:12 +03:00
|
|
|
|
|
|
|
Neutralino.events.on('windowClose', () => {
|
|
|
|
Neutralino.app.exit();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Auto theme switcher
|
2021-12-29 15:56:54 +03:00
|
|
|
Configs.get('theme').then((theme) => {
|
|
|
|
if (theme === 'system')
|
|
|
|
theme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
|
|
|
|
|
|
document.body.setAttribute('data-theme', theme as string);
|
|
|
|
});
|
2021-12-29 15:02:12 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
{#if typeof $locale === 'string'}
|
|
|
|
<main>
|
2021-12-29 15:56:54 +03:00
|
|
|
<img src={splash} alt="" />
|
2021-12-29 15:02:12 +03:00
|
|
|
|
|
|
|
<h2>{$_('splash.title')}</h2>
|
2022-01-30 17:26:20 +03:00
|
|
|
<p>{$_(`splash.phrases.${phrase}`, {
|
|
|
|
values: {
|
|
|
|
// Required by de-de locale
|
|
|
|
game: constants.placeholders.uppercase.full
|
|
|
|
}
|
|
|
|
})}</p>
|
2021-12-29 15:02:12 +03:00
|
|
|
</main>
|
|
|
|
{/if}
|