feat(showcase): use vanilla js instead due to incompatibility of wallpaper engine

This commit is contained in:
Haoyu Xu
2023-01-16 17:52:09 -05:00
parent 6d54eb068c
commit 2f53443064
25 changed files with 642 additions and 1365 deletions

30
src/index.js Normal file
View File

@@ -0,0 +1,30 @@
import '@/index.css'
import '@/libs/wallpaper_engine'
import check_web_gl from '@/libs/check_web_gl'
import Settings from '@/components/settings'
document.querySelector('#app').innerHTML = `
<img src="./assets/${import.meta.env.VITE_LOGO_FILENAME}.png" class="logo invert-filter" id="logo" alt="operator logo" />
<div id="settings"></div>
<div id="widget-wrapper">
<div id="fallback"
style="background-image: url(./assets/${import.meta.env.VITE_FALLBACK_FILENAME}.png)"
hidden
></div>
<div id="player" hidden></div>
</div>
`
window.settings = new Settings(document.querySelector('#settings'), document.querySelector('#logo'))
document.title = import.meta.env.VITE_TITLE
console.log("All resources are extracted from Arknights. Github: https://github.com/Halyul/aklive2d")
if (check_web_gl()) {
import('@/components/player').then(({ default: spinePlayer }) => {
window.settings.spinePlayer = spinePlayer(document.querySelector('#player'))
})
} else {
import('@/components/fallback').then(({ default: fallback }) => {
fallback(document.querySelector('#fallback'))
})
}