mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Support show in favorite pages (#3138)
This commit is contained in:
parent
c82129add8
commit
2ac10c8a4a
@ -1,8 +1,24 @@
|
|||||||
import { ComponentMetadata } from '@/components/types'
|
import { defineComponentMetadata, defineOptionsMetadata } from '@/components/define'
|
||||||
|
import { ComponentEntry } from '@/components/types'
|
||||||
|
import { matchUrlPattern } from '@/core/utils'
|
||||||
import { favoriteListUrls, videoUrls } from '@/core/utils/urls'
|
import { favoriteListUrls, videoUrls } from '@/core/utils/urls'
|
||||||
import { KeyBindingAction } from '../../utils/keymap/bindings'
|
import { KeyBindingAction } from '../../utils/keymap/bindings'
|
||||||
|
|
||||||
const entry = async () => {
|
const options = defineOptionsMetadata({
|
||||||
|
favoriteFolderID: {
|
||||||
|
defaultValue: 0,
|
||||||
|
displayName: '快速收藏夹ID',
|
||||||
|
hidden: true,
|
||||||
|
},
|
||||||
|
showInFavoritePages: {
|
||||||
|
defaultValue: false,
|
||||||
|
displayName: '在收藏夹播放页面仍然显示',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
const entry: ComponentEntry<typeof options> = async ({ settings }) => {
|
||||||
|
if (favoriteListUrls.some(matchUrlPattern) && !settings.options.showInFavoritePages) {
|
||||||
|
return
|
||||||
|
}
|
||||||
const {
|
const {
|
||||||
playerReady,
|
playerReady,
|
||||||
mountVueComponent,
|
mountVueComponent,
|
||||||
@ -32,11 +48,11 @@ const entry = async () => {
|
|||||||
vm.syncFavoriteState()
|
vm.syncFavoriteState()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export const component: ComponentMetadata = {
|
export const component = defineComponentMetadata({
|
||||||
name: 'quickFavorite',
|
name: 'quickFavorite',
|
||||||
displayName: '启用快速收藏',
|
displayName: '启用快速收藏',
|
||||||
description: {
|
description: {
|
||||||
'zh-CN': '启用快速收藏, 在视频页面可以一键收藏到设定的某个收藏夹. 首次启动时或者右键点击快速收藏图标可以配置快速收藏夹.',
|
'zh-CN': '启用快速收藏, 在视频页面可以一键收藏到设定的某个收藏夹. 首次启动时或者右键点击快速收藏图标可以配置快速收藏夹. 请注意如果在在收藏夹播放页面仍然显示, 是不会实时同步右侧的播放列表的.',
|
||||||
},
|
},
|
||||||
entry,
|
entry,
|
||||||
unload: () => {
|
unload: () => {
|
||||||
@ -46,17 +62,11 @@ export const component: ComponentMetadata = {
|
|||||||
dqa('.ops .quick-favorite').forEach((it: HTMLElement) => (it.style.display = 'inline-block'))
|
dqa('.ops .quick-favorite').forEach((it: HTMLElement) => (it.style.display = 'inline-block'))
|
||||||
},
|
},
|
||||||
urlInclude: videoUrls,
|
urlInclude: videoUrls,
|
||||||
urlExclude: favoriteListUrls,
|
// urlExclude: favoriteListUrls,
|
||||||
tags: [
|
tags: [
|
||||||
componentsTags.video,
|
componentsTags.video,
|
||||||
],
|
],
|
||||||
options: {
|
options,
|
||||||
favoriteFolderID: {
|
|
||||||
defaultValue: 0,
|
|
||||||
displayName: '快速收藏夹ID',
|
|
||||||
hidden: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
plugin: {
|
plugin: {
|
||||||
displayName: '快速收藏 - 快捷键支持',
|
displayName: '快速收藏 - 快捷键支持',
|
||||||
setup: ({ addData }) => {
|
setup: ({ addData }) => {
|
||||||
@ -74,4 +84,4 @@ export const component: ComponentMetadata = {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user