mirror of
https://github.com/Grasscutters/GrassClipper.git
synced 2024-08-14 13:11:48 +08:00
fix bg getting
This commit is contained in:
parent
2ff8c4ec38
commit
f069de5051
@ -181,7 +181,16 @@ async function setBackgroundImage() {
|
|||||||
await Neutralino.filesystem.createDirectory(NL_CWD + '/resources/bg/official')
|
await Neutralino.filesystem.createDirectory(NL_CWD + '/resources/bg/official')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Set default image, it will change if the bg folder exists
|
||||||
|
document.querySelector('#firstHalf').style.backgroundImage = `url("https://webstatic.hoyoverse.com/upload/event/2020/11/04/7fd661b5184e1734f91f628b6f89a31f_7367318474207189623.png")`
|
||||||
|
|
||||||
if (config.genshinImpactFolder) {
|
if (config.genshinImpactFolder) {
|
||||||
|
// See if bg folder exists in parent dir
|
||||||
|
const parentDir = await Neutralino.filesystem.readDirectory(config.genshinImpactFolder + '/..')
|
||||||
|
|
||||||
|
if (parentDir.find(dir => dir.entry === 'bg')) {
|
||||||
|
|
||||||
const officialImages = (await Neutralino.filesystem.readDirectory(config.genshinImpactFolder + '/../bg')).filter(file => file.type === 'FILE')
|
const officialImages = (await Neutralino.filesystem.readDirectory(config.genshinImpactFolder + '/../bg')).filter(file => file.type === 'FILE')
|
||||||
|
|
||||||
if (officialImages.length > 0) {
|
if (officialImages.length > 0) {
|
||||||
@ -204,9 +213,7 @@ async function setBackgroundImage() {
|
|||||||
|
|
||||||
// Set background image
|
// Set background image
|
||||||
document.querySelector('#firstHalf').style.backgroundImage = `url("../bg/official/${image}")`
|
document.querySelector('#firstHalf').style.backgroundImage = `url("../bg/official/${image}")`
|
||||||
} else {
|
}
|
||||||
// Set default image
|
|
||||||
document.querySelector('#firstHalf').style.backgroundImage = `url("https://webstatic.hoyoverse.com/upload/event/2020/11/04/7fd661b5184e1734f91f628b6f89a31f_7367318474207189623.png")`
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user