add more Pari Plus! settings

This commit is contained in:
fly_mc 2024-10-19 00:32:03 +08:00
parent 4ab14afd42
commit 67424e98a0
8 changed files with 47 additions and 15 deletions

View file

@ -1279,7 +1279,10 @@ noteOfThisUser: "Notes by this user"
clipNoteLimitExceeded: "No more notes can be added to this clip." clipNoteLimitExceeded: "No more notes can be added to this clip."
timeTravel: "Time Travel" timeTravel: "Time Travel"
timeTravelDescription: "Show posts before this date." timeTravelDescription: "Show posts before this date."
pariPlusNoteSettings: "Pari Plus! note settings"
autoTranslateButton: "Display translation function on posts in different languages" autoTranslateButton: "Display translation function on posts in different languages"
showDetailTimeWhenHover: "Hover/long press the timestamp of the post to expand the detailed time"
noteClickToOpen: "Click to open note details"
performance: "Performance" performance: "Performance"
modified: "Modified" modified: "Modified"
discard: "Discard" discard: "Discard"

View file

@ -1288,7 +1288,10 @@ passkeyVerificationFailed: "验证通行密钥失败。"
passkeyVerificationSucceededButPasswordlessLoginDisabled: "通行密钥验证成功,但账户未开启无密码登录。" passkeyVerificationSucceededButPasswordlessLoginDisabled: "通行密钥验证成功,但账户未开启无密码登录。"
timeTravel: "时光机" timeTravel: "时光机"
timeTravelDescription: "显示该日期以前的帖子" timeTravelDescription: "显示该日期以前的帖子"
pariPlusNoteSettings: "Pari Plus! 的帖文设置"
autoTranslateButton: "在不同语言的帖文上显示翻译功能" autoTranslateButton: "在不同语言的帖文上显示翻译功能"
showDetailTimeWhenHover: "悬浮/长按帖文时间戳时,展开详细时间"
noteClickToOpen: "点击展开帖文详情"
messageToFollower: "给关注者的消息" messageToFollower: "给关注者的消息"
target: "对象" target: "对象"
testCaptchaWarning: "此功能为测试 CAPTCHA 用。<strong>请勿在正式环境中使用。</strong>" testCaptchaWarning: "此功能为测试 CAPTCHA 用。<strong>请勿在正式环境中使用。</strong>"

View file

@ -1288,7 +1288,10 @@ passkeyVerificationFailed: "驗證金鑰失敗。"
passkeyVerificationSucceededButPasswordlessLoginDisabled: "雖然驗證金鑰成功,但是無密碼登入的方式是停用的。" passkeyVerificationSucceededButPasswordlessLoginDisabled: "雖然驗證金鑰成功,但是無密碼登入的方式是停用的。"
timeTravel: "時光機" timeTravel: "時光機"
timeTravelDescription: "回到指定的日期" timeTravelDescription: "回到指定的日期"
pariPlusNoteSettings: "Pari Plus! 的貼文設定"
autoTranslateButton: "在不同語言的帖文上顯示翻譯功能" autoTranslateButton: "在不同語言的帖文上顯示翻譯功能"
showDetailTimeWhenHover: "長按帖文時間戳記時展開詳細時間"
noteClickToOpen: "點擊展開帖文詳情"
messageToFollower: "給追隨者的訊息" messageToFollower: "給追隨者的訊息"
target: "目標 " target: "目標 "
testCaptchaWarning: "此功能用於 CAPTCHA 的測試。<strong>請勿在正式環境中使用。</strong>" testCaptchaWarning: "此功能用於 CAPTCHA 的測試。<strong>請勿在正式環境中使用。</strong>"

View file

@ -45,14 +45,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkAvatar :class="$style.collapsedRenoteTargetAvatar" :user="appearNote.user" link preview/> <MkAvatar :class="$style.collapsedRenoteTargetAvatar" :user="appearNote.user" link preview/>
<Mfm :text="getNoteSummary(appearNote)" :plain="true" :nowrap="true" :author="appearNote.user" :nyaize="'respect'" :class="$style.collapsedRenoteTargetText" @click="renoteCollapsed = false"/> <Mfm :text="getNoteSummary(appearNote)" :plain="true" :nowrap="true" :author="appearNote.user" :nyaize="'respect'" :class="$style.collapsedRenoteTargetText" @click="renoteCollapsed = false"/>
</div> </div>
<article v-else :class="$style.article" @contextmenu.stop="onContextmenu"> <article v-else :class="$style.article" @click.stop="defaultStore.state.noteClickToOpen ? noteClickToOpen(appearNote.id) : undefined" @contextmenu.stop="onContextmenu">
<div style="display: flex; padding-bottom: 10px;"> <div style="display: flex; padding-bottom: 10px;">
<div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div> <div v-if="appearNote.channel" :class="$style.colorBar" :style="{ background: appearNote.channel.color }"></div>
<MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/> <MkAvatar :class="$style.avatar" :user="appearNote.user" :link="!mock" :preview="!mock"/>
<div :class="$style.main"> <div :class="$style.main">
<MkNoteHeader :note="appearNote" :mini="true"/> <MkNoteHeader :note="appearNote" :mini="true"/>
<MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/> <MkInstanceTicker v-if="showTicker" :instance="appearNote.user.instance"/>
</div> </div>
</div> </div>
<div style="container-type: inline-size;"> <div style="container-type: inline-size;">
<p v-if="appearNote.cw != null" :class="$style.cw"> <p v-if="appearNote.cw != null" :class="$style.cw">
@ -219,6 +219,7 @@ import { isEnabledUrlPreview } from '@/instance.js';
import { type Keymap } from '@/scripts/hotkey.js'; import { type Keymap } from '@/scripts/hotkey.js';
import { focusPrev, focusNext } from '@/scripts/focus.js'; import { focusPrev, focusNext } from '@/scripts/focus.js';
import { getAppearNote } from '@/scripts/get-appear-note.js'; import { getAppearNote } from '@/scripts/get-appear-note.js';
import { useRouter } from '@/router/supplier.js';
import { miLocalStorage } from '@/local-storage.js'; import { miLocalStorage } from '@/local-storage.js';
import detectLanguage from '@/scripts/detect-language.js'; import detectLanguage from '@/scripts/detect-language.js';
@ -238,6 +239,8 @@ const emit = defineEmits<{
(ev: 'removeReaction', emoji: string): void; (ev: 'removeReaction', emoji: string): void;
}>(); }>();
const router = useRouter();
const inTimeline = inject<boolean>('inTimeline', false); const inTimeline = inject<boolean>('inTimeline', false);
const inChannel = inject('inChannel', null); const inChannel = inject('inChannel', null);
const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null); const currentClip = inject<Ref<Misskey.entities.Clip> | null>('currentClip', null);
@ -431,6 +434,13 @@ if (!props.mock) {
} }
} }
function noteClickToOpen(id: string) {
const selection = document.getSelection();
if (selection?.toString().length === 0) {
router.push(`/notes/${id}`);
}
}
function renote(viaKeyboard = false) { function renote(viaKeyboard = false) {
pleaseLogin(undefined, pleaseLoginContext.value); pleaseLogin(undefined, pleaseLoginContext.value);
showMovedDialog(); showMovedDialog();

View file

@ -28,8 +28,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
<MkA v-else :to="notePage(note)" @mouseenter="setDetail(true)" @mouseleave="setDetail(false)" :style="{ textDecoration: 'none', userSelect: 'none' }"> <MkA v-else :to="notePage(note)" @mouseenter="setDetail(true)" @mouseleave="setDetail(false)" :style="{ textDecoration: 'none', userSelect: 'none' }">
<MkTime <MkTime
:time="isDetail ? note.createdAt : note.createdAt" :time="note.createdAt"
:mode="isDetail ? 'detail' : undefined" :mode="(defaultStore.state.showDetailTimeWhenHover && isDetail) ? 'detail' : undefined"
colored colored
/> />
</MkA> </MkA>

View file

@ -110,6 +110,11 @@ const menuDef = computed(() => [{
text: i18n.ts.theme, text: i18n.ts.theme,
to: '/settings/theme', to: '/settings/theme',
active: currentPage.value?.route.name === 'theme', active: currentPage.value?.route.name === 'theme',
}, {
icon: 'ti ti-plus',
text: 'Pari Plus!',
to: '/settings/pari',
active: currentPage.value?.route.name === 'pari',
}, { }, {
icon: 'ti ti-menu-2', icon: 'ti ti-menu-2',
text: i18n.ts.navbar, text: i18n.ts.navbar,
@ -130,11 +135,6 @@ const menuDef = computed(() => [{
text: i18n.ts.plugins, text: i18n.ts.plugins,
to: '/settings/plugin', to: '/settings/plugin',
active: currentPage.value?.route.name === 'plugin', active: currentPage.value?.route.name === 'plugin',
}, {
icon: 'ti ti-plus',
text: 'Pari Plus',
to: '/settings/pari',
active: currentPage.value?.route.name === 'pari',
}], }],
}, { }, {
title: i18n.ts.otherSettings, title: i18n.ts.otherSettings,

View file

@ -5,7 +5,10 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div class="_gaps_m"> <div class="_gaps_m">
<div class="label">{{ i18n.ts.pariPlusNoteSettings }}</div>
<MkSwitch v-model="autoTranslateButton">{{ i18n.ts.autoTranslateButton }}</MkSwitch> <MkSwitch v-model="autoTranslateButton">{{ i18n.ts.autoTranslateButton }}</MkSwitch>
<MkSwitch v-model="showDetailTimeWhenHover">{{ i18n.ts.showDetailTimeWhenHover }}</MkSwitch>
<MkSwitch v-model="noteClickToOpen">{{ i18n.ts.noteClickToOpen }}</MkSwitch>
</div> </div>
</template> </template>
@ -17,9 +20,11 @@ import { defaultStore } from '@/store.js';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
const autoTranslateButton = computed(defaultStore.makeGetterSetter('autoTranslateButton')); const autoTranslateButton = computed(defaultStore.makeGetterSetter('autoTranslateButton'));
const showDetailTimeWhenHover = computed(defaultStore.makeGetterSetter('showDetailTimeWhenHover'));
const noteClickToOpen = computed(defaultStore.makeGetterSetter('noteClickToOpen'));
definePageMetadata(() => ({ definePageMetadata(() => ({
title: 'Pari Plus', title: 'Pari Plus!',
icon: 'ti ti-plus', icon: 'ti ti-plus',
})); }));
</script> </script>

View file

@ -507,6 +507,14 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device', where: 'device',
default: true, default: true,
}, },
showDetailTimeWhenHover: {
where: 'device',
default: true,
},
noteClickToOpen: {
where: 'device',
default: false,
},
})); }));
// TODO: 他のタブと永続化されたstateを同期 // TODO: 他のタブと永続化されたstateを同期