From 3055e6d8c7c533018ca10de55c8cc803499eba48 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 30 Dec 2020 10:15:16 +0900 Subject: [PATCH] =?UTF-8?q?locale=E3=81=A8theme=E3=81=AE=E3=82=AD=E3=83=A3?= =?UTF-8?q?=E3=83=83=E3=82=B7=E3=83=A5=E3=82=AF=E3=83=AA=E3=82=A2=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- locales/ja-JP.yml | 1 + src/client/init.ts | 6 +----- src/client/pages/settings/index.vue | 8 ++++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 99b148253..6b71acb1c 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -672,6 +672,7 @@ wide: "広い" narrow: "狭い" reloadToApplySetting: "設定はページリロード後に反映されます。今すぐリロードしますか?" showTitlebar: "タイトルバーを表示する" +clearCache: "キャッシュをクリア" _aboutMisskey: about: "Misskeyはsyuiloによって2014年から開発されている、オープンソースのソフトウェアです。" diff --git a/src/client/init.ts b/src/client/init.ts index 968307578..7c3df68c3 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -91,10 +91,6 @@ if (_DEV_) { // タッチデバイスでCSSの:hoverを機能させる document.addEventListener('touchend', () => {}, { passive: true }); -if (localStorage.theme == null) { - applyTheme(require('@/themes/l-light.json5')); -} - //#region SEE: https://css-tricks.com/the-trick-to-viewport-units-on-mobile/ // TODO: いつの日にか消したい const vh = window.innerHeight * 0.01; @@ -204,7 +200,7 @@ watch(defaultStore.reactiveState.darkMode, (darkMode) => { const themes = builtinThemes.concat(ColdDeviceStorage.get('themes')); applyTheme(themes.find(x => x.id === (darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme')))); }); -}); +}, { immediate: localStorage.theme == null }); //#region Sync dark mode if (ColdDeviceStorage.get('syncDeviceDarkMode')) { diff --git a/src/client/pages/settings/index.vue b/src/client/pages/settings/index.vue index 05756716d..aa9fe2716 100644 --- a/src/client/pages/settings/index.vue +++ b/src/client/pages/settings/index.vue @@ -27,6 +27,9 @@ API {{ $ts.other }} + + {{ $ts.clearCache }} + {{ $ts.logout }} @@ -126,6 +129,11 @@ export default defineComponent({ logout: () => { signout(); }, + clear: () => { + localStorage.removeItem('locale'); + localStorage.removeItem('theme'); + location.reload(); + }, faPalette, faPlug, faUser, faListUl, faLock, faLaugh, faCommentSlash, faMusic, faBell, faCogs, faEllipsisH, faBan, faShareAlt, faLockOpen, faKey, faBoxes, faEnvelope, }; },