mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-22 17:43:09 +02:00
added setting
This commit is contained in:
parent
395ea9ab9f
commit
8f300cf460
7 changed files with 17 additions and 6 deletions
|
@ -688,6 +688,7 @@ channel: "Channels"
|
||||||
create: "Create"
|
create: "Create"
|
||||||
notificationSetting: "Notification settings"
|
notificationSetting: "Notification settings"
|
||||||
notificationSettingDesc: "Select the types of notification to display."
|
notificationSettingDesc: "Select the types of notification to display."
|
||||||
|
enableFaviconNotificationDot: "Enable favicon notification dot"
|
||||||
useGlobalSetting: "Use global settings"
|
useGlobalSetting: "Use global settings"
|
||||||
useGlobalSettingDesc: "If turned on, your account's notification settings will be used. If turned off, individual configurations can be made."
|
useGlobalSettingDesc: "If turned on, your account's notification settings will be used. If turned off, individual configurations can be made."
|
||||||
other: "Other"
|
other: "Other"
|
||||||
|
|
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
@ -2764,6 +2764,10 @@ export interface Locale extends ILocale {
|
||||||
* 表示する通知の種別を選択してください。
|
* 表示する通知の種別を選択してください。
|
||||||
*/
|
*/
|
||||||
"notificationSettingDesc": string;
|
"notificationSettingDesc": string;
|
||||||
|
/**
|
||||||
|
* ファビコン通知ドットを有効にする
|
||||||
|
*/
|
||||||
|
"enableFaviconNotificationDot": string;
|
||||||
/**
|
/**
|
||||||
* グローバル設定を使う
|
* グローバル設定を使う
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -687,6 +687,7 @@ channel: "チャンネル"
|
||||||
create: "作成"
|
create: "作成"
|
||||||
notificationSetting: "通知設定"
|
notificationSetting: "通知設定"
|
||||||
notificationSettingDesc: "表示する通知の種別を選択してください。"
|
notificationSettingDesc: "表示する通知の種別を選択してください。"
|
||||||
|
enableFaviconNotificationDot: "ファビコン通知ドットを有効にする"
|
||||||
useGlobalSetting: "グローバル設定を使う"
|
useGlobalSetting: "グローバル設定を使う"
|
||||||
useGlobalSettingDesc: "オンにすると、アカウントの通知設定が使用されます。オフにすると、個別に設定できるようになります。"
|
useGlobalSettingDesc: "オンにすると、アカウントの通知設定が使用されます。オフにすると、個別に設定できるようになります。"
|
||||||
other: "その他"
|
other: "その他"
|
||||||
|
|
|
@ -180,6 +180,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
<div class="_gaps_m">
|
<div class="_gaps_m">
|
||||||
<div class="_gaps_s">
|
<div class="_gaps_s">
|
||||||
|
<MkSwitch v-model="enableFaviconNotificationDot">{{ i18n.ts.enableFaviconNotificationDot }}</MkSwitch>
|
||||||
<MkSwitch v-model="warnMissingAltText">{{ i18n.ts.warnForMissingAltText }}</MkSwitch>
|
<MkSwitch v-model="warnMissingAltText">{{ i18n.ts.warnForMissingAltText }}</MkSwitch>
|
||||||
<MkSwitch v-model="imageNewTab">{{ i18n.ts.openImageInNewTab }}</MkSwitch>
|
<MkSwitch v-model="imageNewTab">{{ i18n.ts.openImageInNewTab }}</MkSwitch>
|
||||||
<MkSwitch v-model="useReactionPickerForContextMenu">{{ i18n.ts.useReactionPickerForContextMenu }}</MkSwitch>
|
<MkSwitch v-model="useReactionPickerForContextMenu">{{ i18n.ts.useReactionPickerForContextMenu }}</MkSwitch>
|
||||||
|
@ -337,6 +338,7 @@ const oneko = computed(defaultStore.makeGetterSetter('oneko'));
|
||||||
const loadRawImages = computed(defaultStore.makeGetterSetter('loadRawImages'));
|
const loadRawImages = computed(defaultStore.makeGetterSetter('loadRawImages'));
|
||||||
const highlightSensitiveMedia = computed(defaultStore.makeGetterSetter('highlightSensitiveMedia'));
|
const highlightSensitiveMedia = computed(defaultStore.makeGetterSetter('highlightSensitiveMedia'));
|
||||||
const imageNewTab = computed(defaultStore.makeGetterSetter('imageNewTab'));
|
const imageNewTab = computed(defaultStore.makeGetterSetter('imageNewTab'));
|
||||||
|
const enableFaviconNotificationDot = computed(defaultStore.makeGetterSetter('enableFaviconNotificationDot'));
|
||||||
const warnMissingAltText = computed(defaultStore.makeGetterSetter('warnMissingAltText'));
|
const warnMissingAltText = computed(defaultStore.makeGetterSetter('warnMissingAltText'));
|
||||||
const nsfw = computed(defaultStore.makeGetterSetter('nsfw'));
|
const nsfw = computed(defaultStore.makeGetterSetter('nsfw'));
|
||||||
const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostForm'));
|
const showFixedPostForm = computed(defaultStore.makeGetterSetter('showFixedPostForm'));
|
||||||
|
|
|
@ -72,6 +72,7 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
|
||||||
'advancedMfm',
|
'advancedMfm',
|
||||||
'loadRawImages',
|
'loadRawImages',
|
||||||
'warnMissingAltText',
|
'warnMissingAltText',
|
||||||
|
'enableFaviconNotificationDot',
|
||||||
'imageNewTab',
|
'imageNewTab',
|
||||||
'dataSaver',
|
'dataSaver',
|
||||||
'disableShowingAnimatedImages',
|
'disableShowingAnimatedImages',
|
||||||
|
|
|
@ -268,6 +268,10 @@ export const defaultStore = markRaw(new Storage('base', {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
default: true,
|
default: true,
|
||||||
},
|
},
|
||||||
|
enableFaviconNotificationDot: {
|
||||||
|
where: 'device',
|
||||||
|
default: true,
|
||||||
|
},
|
||||||
imageNewTab: {
|
imageNewTab: {
|
||||||
where: 'device',
|
where: 'device',
|
||||||
default: false,
|
default: false,
|
||||||
|
|
|
@ -80,8 +80,6 @@ class NotificationFavIconDot {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.canvas = document.createElement('canvas');
|
this.canvas = document.createElement('canvas');
|
||||||
|
|
||||||
if (this.faviconEL == null) return;
|
|
||||||
|
|
||||||
this.src = this.faviconEL.getAttribute('href');
|
this.src = this.faviconEL.getAttribute('href');
|
||||||
this.ctx = this.canvas.getContext('2d');
|
this.ctx = this.canvas.getContext('2d');
|
||||||
|
|
||||||
|
@ -162,11 +160,11 @@ function onNotification(notification: Misskey.entities.Notification, isClient =
|
||||||
if ($i) {
|
if ($i) {
|
||||||
const connection = useStream().useChannel('main', null, 'UI');
|
const connection = useStream().useChannel('main', null, 'UI');
|
||||||
connection.on('notification', onNotification);
|
connection.on('notification', onNotification);
|
||||||
|
|
||||||
watch(() => $i?.hasUnreadNotification, (hasAny) => notificationDot.setVisible(hasAny ?? false));
|
|
||||||
|
|
||||||
if ($i.hasUnreadNotification) notificationDot.setVisible(true);
|
|
||||||
|
|
||||||
|
watch(() => $i?.hasUnreadNotification, (hasAny) => notificationDot.setVisible((defaultStore.state.enableFaviconNotificationDot ? hasAny : false) ?? false));
|
||||||
|
|
||||||
|
if ($i.hasUnreadNotification && defaultStore.state.enableFaviconNotificationDot) notificationDot.setVisible(true);
|
||||||
|
|
||||||
globalEvents.on('clientNotification', notification => onNotification(notification, true));
|
globalEvents.on('clientNotification', notification => onNotification(notification, true));
|
||||||
|
|
||||||
//#region Listen message from SW
|
//#region Listen message from SW
|
||||||
|
|
Loading…
Reference in a new issue