diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-05-24 05:28:46 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-05-24 05:28:46 +0900 |
| commit | 89461c598f4746287d13dad6fa6d1215cb43c030 (patch) | |
| tree | 4159971a9b58fa143382a0c91a9c9fede8647a31 /src/client/app/boot.js | |
| parent | :art: (diff) | |
| download | misskey-89461c598f4746287d13dad6fa6d1215cb43c030.tar.gz misskey-89461c598f4746287d13dad6fa6d1215cb43c030.tar.bz2 misskey-89461c598f4746287d13dad6fa6d1215cb43c030.zip | |
Refactor
Diffstat (limited to 'src/client/app/boot.js')
| -rw-r--r-- | src/client/app/boot.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/client/app/boot.js b/src/client/app/boot.js index da1b64823f..7b884c8a54 100644 --- a/src/client/app/boot.js +++ b/src/client/app/boot.js @@ -18,6 +18,14 @@ return; } + //#region Load settings + let settings = null; + const vuex = localStorage.getItem('vuex'); + if (vuex) { + settings = JSON.parse(vuex); + } + //#endregion + // Get the current url information const url = new URL(location.href); @@ -35,10 +43,8 @@ // The default language is English if (!LANGS.includes(lang)) lang = 'en'; - const vuex = localStorage.getItem('vuex'); - if (vuex) { - const data = JSON.parse(vuex); - if (data.device.lang) lang = data.device.lang; + if (settings) { + if (settings.device.lang) lang = settings.device.lang; } //#endregion @@ -68,8 +74,10 @@ } // Dark/Light - if (localStorage.getItem('darkmode') == 'true') { - document.documentElement.setAttribute('data-darkmode', 'true'); + if (settings) { + if (settings.device.darkmode) { + document.documentElement.setAttribute('data-darkmode', 'true'); + } } // Script version |