mirror of https://github.com/hykilpikonna/AquaDX
feat: add export to chu3
parent
2a6f3745c3
commit
7d214ba214
|
@ -6,7 +6,7 @@
|
||||||
type UserBox,
|
type UserBox,
|
||||||
type UserItem,
|
type UserItem,
|
||||||
} from "../../libs/generalTypes";
|
} from "../../libs/generalTypes";
|
||||||
import { DATA, USER, USERBOX } from "../../libs/sdk";
|
import { DATA, USER, USERBOX, GAME } from "../../libs/sdk";
|
||||||
import { t, ts } from "../../libs/i18n";
|
import { t, ts } from "../../libs/i18n";
|
||||||
import { DATA_HOST, FADE_IN, FADE_OUT, USERBOX_DEFAULT_URL } from "../../libs/config";
|
import { DATA_HOST, FADE_IN, FADE_OUT, USERBOX_DEFAULT_URL } from "../../libs/config";
|
||||||
import { fade, slide } from "svelte/transition";
|
import { fade, slide } from "svelte/transition";
|
||||||
|
@ -97,6 +97,23 @@
|
||||||
return fetchData()
|
return fetchData()
|
||||||
}).catch((e) => { loading = false; error = e.message });
|
}).catch((e) => { loading = false; error = e.message });
|
||||||
|
|
||||||
|
function exportData() {
|
||||||
|
submitting = "export"
|
||||||
|
GAME.export('chu3')
|
||||||
|
.then(data => download(JSON.stringify(data), `AquaDX_chu3_export_${userbox.userName}.json`))
|
||||||
|
.catch(e => error = e.message)
|
||||||
|
.finally(() => submitting = "")
|
||||||
|
}
|
||||||
|
|
||||||
|
function download(data: string, filename: string) {
|
||||||
|
const blob = new Blob([data]);
|
||||||
|
const url = URL.createObjectURL(blob);
|
||||||
|
const link = document.createElement('a');
|
||||||
|
link.href = url;
|
||||||
|
link.download = filename;
|
||||||
|
link.click();
|
||||||
|
}
|
||||||
|
|
||||||
let DDSreader: DDS | undefined;
|
let DDSreader: DDS | undefined;
|
||||||
|
|
||||||
let USERBOX_PROGRESS = 0;
|
let USERBOX_PROGRESS = 0;
|
||||||
|
@ -268,7 +285,11 @@
|
||||||
<button on:click={() => USERBOX_SETUP_RUN = !USERBOX_SETUP_RUN}>{t(!USERBOX_INSTALLED ? `userbox.new.activate_first` : `userbox.new.activate_update`)}</button>
|
<button on:click={() => USERBOX_SETUP_RUN = !USERBOX_SETUP_RUN}>{t(!USERBOX_INSTALLED ? `userbox.new.activate_first` : `userbox.new.activate_update`)}</button>
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
<ChuniMatchingSettings/>
|
<ChuniMatchingSettings/><br>
|
||||||
|
<button class="exportButton" on:click={exportData}>
|
||||||
|
<Icon icon="bxs:file-export"/>
|
||||||
|
{t('settings.export')}
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue