diff options
| author | Mary <Ipadlover8322@gmail.com> | 2019-11-16 10:44:21 -0500 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2019-11-17 00:44:21 +0900 |
| commit | 70bb5879f99fc2c648925596dbdd1f1cdf883399 (patch) | |
| tree | 8dc93897509d90f9616b2905afa91530565e6e77 /src | |
| parent | Link joinmisskey (diff) | |
| download | sharkey-70bb5879f99fc2c648925596dbdd1f1cdf883399.tar.gz sharkey-70bb5879f99fc2c648925596dbdd1f1cdf883399.tar.bz2 sharkey-70bb5879f99fc2c648925596dbdd1f1cdf883399.zip | |
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>
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/app/boot.js | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/client/app/boot.js b/src/client/app/boot.js index c244050a54..64d4629883 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -72,13 +72,17 @@ //#region Fetch locale data const cachedLocale = localStorage.getItem('locale'); const localeKey = localStorage.getItem('localeKey'); + let localeData = null; if (cachedLocale == null || localeKey != `${ver}.${lang}`) { const locale = await fetch(`/assets/locales/${lang}.json?ver=${ver}`) .then(response => response.json()); + localeData = locale; localStorage.setItem('locale', JSON.stringify(locale)); localStorage.setItem('localeKey', `${ver}.${lang}`); + } else { + localeData = JSON.parse(cachedLocale); } //#endregion @@ -99,8 +103,7 @@ // If mobile, insert the viewport meta tag if (isMobile) { const viewport = document.getElementsByName("viewport").item(0); - viewport.setAttribute('content', - `${viewport.getAttribute('content')},minimum-scale=1,maximum-scale=1,user-scalable=no`); + viewport.content = `${viewport.content},minimum-scale=1,maximum-scale=1,user-scalable=no`; head.appendChild(viewport); } @@ -113,9 +116,9 @@ // Note: 'async' make it possible to load the script asyncly. // 'defer' make it possible to run the script when the dom loaded. const script = document.createElement('script'); - script.setAttribute('src', `/assets/${app}.${ver}.js`); - script.setAttribute('async', 'true'); - script.setAttribute('defer', 'true'); + script.src = `/assets/${app}.${ver}.js`; + script.async = true; + script.defer = true; head.appendChild(script); // 3秒経ってもスクリプトがロードされない場合はバージョンが古くて @@ -138,10 +141,10 @@ localStorage.setItem('v', meta.version); alert( - 'Misskeyの新しいバージョンがあります。ページを再度読み込みします。' + - '\n\n' + - 'New version of Misskey available. The page will be reloaded.'); - + localeData.common._settings["update-available"] + + '\n' + + localeData.common._settings["update-available-desc"] + ); refresh(); } }, 3000); |