This commit is contained in:
tamaina 2019-04-19 11:07:54 +09:00 committed by Satsuki Yanagi
parent c2fc637575
commit 2afcdda058
No known key found for this signature in database
GPG key ID: 889CA74CC28378D0
5 changed files with 65 additions and 8 deletions

View file

@ -460,6 +460,8 @@ common/views/components/connect-failed.troubleshooter.vue:
flush: "キャッシュの削除" flush: "キャッシュの削除"
set-version: "バージョン指定" set-version: "バージョン指定"
common/views/components/media-banner.vue: common/views/components/media-banner.vue:
sensitive: "閲覧注意" sensitive: "閲覧注意"
click-to-show: "クリックして表示" click-to-show: "クリックして表示"
@ -637,6 +639,17 @@ common/views/components/emoji-picker.vue:
symbols: "記号" symbols: "記号"
flags: "旗" flags: "旗"
common/views/components/settings/client-mode.vue:
title: "クライアント"
select-app-type: "利用するクライアントのモード"
choices:
auto: "自動で選択"
desktop: "デスクトップ版に固定"
mobile: "モバイル版に固定"
desktop: "デスクトップ"
mobile: "モバイル"
info: "変更はページの再度読み込み後に反映されます。"
common/views/components/signin.vue: common/views/components/signin.vue:
username: "ユーザー名" username: "ユーザー名"
password: "パスワード" password: "パスワード"

View file

@ -35,12 +35,12 @@
const url = new URL(location.href); const url = new URL(location.href);
//#region Detect app name //#region Detect app name
let app = null; var appType = null;
if (`${url.pathname}/`.startsWith('/docs/')) app = 'docs'; if (`${url.pathname}/`.startsWith('/docs/')) appType = 'docs';
if (`${url.pathname}/`.startsWith('/dev/')) app = 'dev'; if (`${url.pathname}/`.startsWith('/dev/')) appType = 'dev';
if (`${url.pathname}/`.startsWith('/auth/')) app = 'auth'; if (`${url.pathname}/`.startsWith('/auth/')) appType = 'auth';
if (`${url.pathname}/`.startsWith('/admin/')) app = 'admin'; if (`${url.pathname}/`.startsWith('/admin/')) appType = 'admin';
//#endregion //#endregion
// Script version // Script version
@ -103,15 +103,15 @@
} }
// Switch desktop or mobile version // Switch desktop or mobile version
if (app == null) { if (appType == null) {
app = isMobile ? 'mobile' : 'desktop'; appType = isMobile ? 'mobile' : 'desktop';
} }
// Load an app script // Load an app script
// 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.setAttribute('src', `/assets/${appType}.${ver}.js`);
script.setAttribute('async', 'true'); script.setAttribute('async', 'true');
script.setAttribute('defer', 'true'); script.setAttribute('defer', 'true');
head.appendChild(script); head.appendChild(script);

View file

@ -0,0 +1,40 @@
<template>
<ui-card>
<template #title><fa :icon="faMobile"/> {{ $t('title') }}</template>
<section class="fit-top">
<ui-select v-model="lang" :placeholder="$t('select-app-type')">
<option v-for="x in ['auto', 'desktop', 'mobile']" :value="x" :key="x">{{ $t(`choices.${x}`) }}</option>
</ui-select>
<ui-info>Current: <i>{{ $t(currentAppType) }}</i></ui-info>
<ui-info warn>{{ $t('info') }}</ui-info>
</section>
</ui-card>
</template>
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../../i18n';
import { langs } from '../../../../config';
import { faMobile } from '@fortawesome/free-solid-svg-icons'
export default Vue.extend({
i18n: i18n('common/views/components/settings/client-mode.vue'),
data() {
return {
langs,
currentAppType: (window as any).appType,
faMobile
};
},
computed: {
appTypeForce: {
get() { return this.$store.state.device.appTypeForce; },
set(value) { this.$store.commit('device/set', { key: 'appTypeForce', value }); }
},
},
});
</script>

View file

@ -163,6 +163,7 @@
</ui-card> </ui-card>
<x-language/> <x-language/>
<x-app-type/>
</template> </template>
<template v-if="page == null || page == 'notification'"> <template v-if="page == null || page == 'notification'">
@ -271,6 +272,7 @@ import XPassword from './password.vue';
import XProfile from './profile.vue'; import XProfile from './profile.vue';
import XApi from './api.vue'; import XApi from './api.vue';
import XLanguage from './language.vue'; import XLanguage from './language.vue';
import XAppType from './app-type.vue';
import XNotification from './notification.vue'; import XNotification from './notification.vue';
import { url, version } from '../../../../config'; import { url, version } from '../../../../config';
@ -291,6 +293,7 @@ export default Vue.extend({
XProfile, XProfile,
XApi, XApi,
XLanguage, XLanguage,
XAppType,
XNotification, XNotification,
}, },
props: { props: {

View file

@ -60,6 +60,7 @@ const defaultDeviceSettings = {
soundVolume: 0.5, soundVolume: 0.5,
mediaVolume: 0.5, mediaVolume: 0.5,
lang: null, lang: null,
appTypeForce: 'auto',
debug: false, debug: false,
lightmode: false, lightmode: false,
loadRawImages: false, loadRawImages: false,