mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-25 00:49:17 +09:00
boot: remove setAttribute() calls and translate reload msg (#5532)
* boot: remove setAttribute() calls and translate reload msg * Update src/client/app/boot.js Co-Authored-By: Acid Chicken (硫酸鶏) <root@acid-chicken.com>
This commit is contained in:
parent
cfd2d84b14
commit
70bb5879f9
@ -72,13 +72,17 @@
|
|||||||
//#region Fetch locale data
|
//#region Fetch locale data
|
||||||
const cachedLocale = localStorage.getItem('locale');
|
const cachedLocale = localStorage.getItem('locale');
|
||||||
const localeKey = localStorage.getItem('localeKey');
|
const localeKey = localStorage.getItem('localeKey');
|
||||||
|
let localeData = null;
|
||||||
|
|
||||||
if (cachedLocale == null || localeKey != `${ver}.${lang}`) {
|
if (cachedLocale == null || localeKey != `${ver}.${lang}`) {
|
||||||
const locale = await fetch(`/assets/locales/${lang}.json?ver=${ver}`)
|
const locale = await fetch(`/assets/locales/${lang}.json?ver=${ver}`)
|
||||||
.then(response => response.json());
|
.then(response => response.json());
|
||||||
|
localeData = locale;
|
||||||
|
|
||||||
localStorage.setItem('locale', JSON.stringify(locale));
|
localStorage.setItem('locale', JSON.stringify(locale));
|
||||||
localStorage.setItem('localeKey', `${ver}.${lang}`);
|
localStorage.setItem('localeKey', `${ver}.${lang}`);
|
||||||
|
} else {
|
||||||
|
localeData = JSON.parse(cachedLocale);
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
@ -99,8 +103,7 @@
|
|||||||
// If mobile, insert the viewport meta tag
|
// If mobile, insert the viewport meta tag
|
||||||
if (isMobile) {
|
if (isMobile) {
|
||||||
const viewport = document.getElementsByName("viewport").item(0);
|
const viewport = document.getElementsByName("viewport").item(0);
|
||||||
viewport.setAttribute('content',
|
viewport.content = `${viewport.content},minimum-scale=1,maximum-scale=1,user-scalable=no`;
|
||||||
`${viewport.getAttribute('content')},minimum-scale=1,maximum-scale=1,user-scalable=no`);
|
|
||||||
head.appendChild(viewport);
|
head.appendChild(viewport);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,9 +116,9 @@
|
|||||||
// Note: 'async' make it possible to load the script asyncly.
|
// Note: 'async' make it possible to load the script asyncly.
|
||||||
// 'defer' make it possible to run the script when the dom loaded.
|
// 'defer' make it possible to run the script when the dom loaded.
|
||||||
const script = document.createElement('script');
|
const script = document.createElement('script');
|
||||||
script.setAttribute('src', `/assets/${app}.${ver}.js`);
|
script.src = `/assets/${app}.${ver}.js`;
|
||||||
script.setAttribute('async', 'true');
|
script.async = true;
|
||||||
script.setAttribute('defer', 'true');
|
script.defer = true;
|
||||||
head.appendChild(script);
|
head.appendChild(script);
|
||||||
|
|
||||||
// 3秒経ってもスクリプトがロードされない場合はバージョンが古くて
|
// 3秒経ってもスクリプトがロードされない場合はバージョンが古くて
|
||||||
@ -138,10 +141,10 @@
|
|||||||
localStorage.setItem('v', meta.version);
|
localStorage.setItem('v', meta.version);
|
||||||
|
|
||||||
alert(
|
alert(
|
||||||
'Misskeyの新しいバージョンがあります。ページを再度読み込みします。' +
|
localeData.common._settings["update-available"] +
|
||||||
'\n\n' +
|
'\n' +
|
||||||
'New version of Misskey available. The page will be reloaded.');
|
localeData.common._settings["update-available-desc"]
|
||||||
|
);
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
}, 3000);
|
}, 3000);
|
||||||
|
Loading…
Reference in New Issue
Block a user