fix(boot): background is moving
This commit is contained in:
parent
71ee993f05
commit
e760b78963
2 changed files with 20 additions and 4 deletions
|
@ -137,9 +137,10 @@
|
||||||
document.documentElement.classList.add('useSystemFont');
|
document.documentElement.classList.add('useSystemFont');
|
||||||
}
|
}
|
||||||
|
|
||||||
const wallpaper = localStorage.getItem('wallpaper');
|
const wallpaper = localStorage.getItem('wallpaper') ?? meta.backgroundImageUrl;
|
||||||
if (wallpaper) {
|
if (wallpaper) {
|
||||||
document.documentElement.style.backgroundImage = `url(${wallpaper})`;
|
document.documentElement.style.background = `url(${wallpaper}) no-repeat fixed center`;
|
||||||
|
document.documentElement.style.backgroundSize = 'cover';
|
||||||
}
|
}
|
||||||
|
|
||||||
const customCss = localStorage.getItem('customCss');
|
const customCss = localStorage.getItem('customCss');
|
||||||
|
|
|
@ -21,6 +21,20 @@ async function main() {
|
||||||
renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.');
|
renderError('FORCED_ERROR', 'This error is forced by having forceError in local storage.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const metaRes = await window.fetch('/api/meta', {
|
||||||
|
method: 'POST',
|
||||||
|
body: JSON.stringify({}),
|
||||||
|
credentials: 'omit',
|
||||||
|
cache: 'no-cache',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (metaRes.status !== 200) {
|
||||||
|
renderError('META_FETCH');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const meta = await metaRes.json();
|
||||||
//#region Detect language & fetch translations
|
//#region Detect language & fetch translations
|
||||||
|
|
||||||
// dev-modeの場合は常に取り直す
|
// dev-modeの場合は常に取り直す
|
||||||
|
@ -77,9 +91,10 @@ async function main() {
|
||||||
document.documentElement.classList.add('useSystemFont');
|
document.documentElement.classList.add('useSystemFont');
|
||||||
}
|
}
|
||||||
|
|
||||||
const wallpaper = localStorage.getItem('wallpaper');
|
const wallpaper = localStorage.getItem('wallpaper') ?? meta.backgroundImageUrl;
|
||||||
if (wallpaper) {
|
if (wallpaper) {
|
||||||
document.documentElement.style.backgroundImage = `url(${wallpaper})`;
|
document.documentElement.style.background = `url(${wallpaper}) no-repeat fixed center`;
|
||||||
|
document.documentElement.style.backgroundSize = 'cover';
|
||||||
}
|
}
|
||||||
|
|
||||||
const customCss = localStorage.getItem('customCss');
|
const customCss = localStorage.getItem('customCss');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue