From 91c20e88bee5cb53b419a504bbeb3b34b9357024 Mon Sep 17 00:00:00 2001 From: festoney8 Date: Tue, 26 Mar 2024 20:02:16 +0800 Subject: [PATCH 1/7] feat: hide next play --- CHANGELOG.md | 4 ++++ src/rules/video.ts | 9 ++++++++- vite.config.ts | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d80f9f6..a54903d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 3.2.2 + +- 新增:播放页隐藏接下来播放 + ## 3.2.1 - 新增:播放页隐藏UP主头像icon diff --git a/src/rules/video.ts b/src/rules/video.ts index 8544b058..9ca8fe88 100644 --- a/src/rules/video.ts +++ b/src/rules/video.ts @@ -7,7 +7,7 @@ import { isPageBnj, isPagePlaylist, isPageVideo } from '../utils/page-type' /** BV号转AV号 */ const bv2av = () => { /** - * 可能会出现转换后av号带短横的bug(溢出),作为后备方案 + * algo by bilibili-API-collect * @see https://www.zhihu.com/question/381784377/answer/1099438784 * @see https://github.com/SocialSisterYi/bilibili-API-collect/issues/740 * @see https://socialsisteryi.github.io/bilibili-API-collect/docs/misc/bvid_desc.html @@ -813,6 +813,13 @@ if (isPageVideo() || isPagePlaylist()) { description: '隐藏 自动连播按钮', itemCSS: `#reco_list .next-play .next-button {display: none !important;}`, }), + // 隐藏 接下来播放 + new CheckboxItem({ + itemID: 'video-page-hide-right-container-reco-list-next-play', + description: '隐藏 接下来播放', + itemCSS: `#reco_list .next-play {display: none !important;} + #reco_list .rec-list {margin-top: 0 !important;}`, + }), // 视频合集 增加合集列表高度, 默认开启 new CheckboxItem({ itemID: 'video-page-hide-right-container-section-height', diff --git a/vite.config.ts b/vite.config.ts index 86a2377a..fb6e6755 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,7 +8,7 @@ export default defineConfig({ userscript: { name: 'bilibili 页面净化大师', namespace: 'http://tampermonkey.net/', - version: '3.2.1', + version: '3.2.2', description: '净化 B站/哔哩哔哩 网页元素,去广告,BV号转AV号,播放器净化,过滤视频,过滤评论,提供300+项功能,定制自己的B站页面', author: 'festoney8', From 51689fe4553670e71c274f63df59f6c4e455ec86 Mon Sep 17 00:00:00 2001 From: festoney8 Date: Wed, 27 Mar 2024 00:21:50 +0800 Subject: [PATCH 2/7] update: simpleShare --- CHANGELOG.md | 1 + src/rules/video.ts | 16 +++++++--------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a54903d6..1f11b25c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 3.2.2 - 新增:播放页隐藏接下来播放 +- 更新:净化分享适配新版标题 ## 3.2.1 diff --git a/src/rules/video.ts b/src/rules/video.ts index 9ca8fe88..d317237f 100644 --- a/src/rules/video.ts +++ b/src/rules/video.ts @@ -63,15 +63,11 @@ const simpleShare = () => { // 新增click事件 // 若replace element, 会在切换视频后无法更新视频分享数量, 故直接新增click事件覆盖剪贴板 shareBtn.addEventListener('click', () => { - let title = document.querySelector('#viewbox_report > h1')?.textContent - if (!title) { - // 尝试稍后再看or收藏夹列表 - title = document.querySelector('.video-title-href')?.textContent - if (!title) { - return - } - } + let title = document.querySelector( + '.video-info-title .video-title, #viewbox_report > h1, .video-title-href', + )?.textContent if ( + title && !'(({【[[《「<{〔〖<〈『'.includes(title[0]) && !'))}】]]》」>}〕〗>〉』'.includes(title.slice(-1)) ) { @@ -79,7 +75,9 @@ const simpleShare = () => { } // 匹配av号, BV号, 分P号 const avbv = matchAvidBvid(location.href) - let shareText = `${title} \nhttps://www.bilibili.com/video/${avbv}` + let shareText = title + ? `${title} \nhttps://www.bilibili.com/video/${avbv}` + : `https://www.bilibili.com/video/${avbv}` const urlObj = new URL(location.href) const params = new URLSearchParams(urlObj.search) if (params.has('p')) { From dc40880b10e9766a3853416002188985ae1b32da Mon Sep 17 00:00:00 2001 From: festoney8 Date: Wed, 27 Mar 2024 19:28:53 +0800 Subject: [PATCH 3/7] feat: add uploader keyword filter --- CHANGELOG.md | 4 +- src/filters/videoFilter/agency/agency.ts | 21 +++++++ src/filters/videoFilter/filters/core.ts | 9 +++ .../filters/subfilters/titleKeyword.ts | 2 +- .../filters/subfilters/uploaderKeyword.ts | 60 +++++++++++++++++++ .../videoFilter/pages/actions/action.ts | 58 ++++++++++++++++++ src/filters/videoFilter/pages/channel.ts | 50 ++++++++++++---- src/filters/videoFilter/pages/homepage.ts | 50 +++++++++++----- src/filters/videoFilter/pages/popular.ts | 48 +++++++++++---- src/filters/videoFilter/pages/search.ts | 50 +++++++++++----- src/filters/videoFilter/pages/video.ts | 50 +++++++++++----- vite.config.ts | 2 +- 12 files changed, 333 insertions(+), 71 deletions(-) create mode 100644 src/filters/videoFilter/filters/subfilters/uploaderKeyword.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f11b25c..dd2408e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,9 @@ # CHANGELOG -## 3.2.2 +## 3.3.0 +- 新增:支持UP主昵称关键词过滤(首页、热门页、播放页、频道页、搜索页) +- 新增:UP主昵称关键词黑名单 - 新增:播放页隐藏接下来播放 - 更新:净化分享适配新版标题 diff --git a/src/filters/videoFilter/agency/agency.ts b/src/filters/videoFilter/agency/agency.ts index 9687d055..d7bededb 100644 --- a/src/filters/videoFilter/agency/agency.ts +++ b/src/filters/videoFilter/agency/agency.ts @@ -3,6 +3,7 @@ import durationFilterInstance from '../filters/subfilters/duration' import titleKeywordFilterInstance from '../filters/subfilters/titleKeyword' import titleKeywordWhitelistFilterInstance from '../filters/subfilters/titleKeywordWhitelist' import uploaderFilterInstance from '../filters/subfilters/uploader' +import uploaderKeywordFilterInstance from '../filters/subfilters/uploaderKeyword' import uploaderWhitelistFilterInstance from '../filters/subfilters/uploaderWhitelist' // 代理, 接收页面操作通知, 更新子过滤器的参数 @@ -86,6 +87,26 @@ class VideoFilterAgency { break } } + notifyUploaderKeyword(event: string, value?: string | string[]) { + switch (event) { + case 'disable': + uploaderKeywordFilterInstance.setStatus(false) + break + case 'enable': + uploaderKeywordFilterInstance.setStatus(true) + break + case 'add': + if (typeof value === 'string' && value.trim()) { + uploaderKeywordFilterInstance.addParam(value.trim()) + } + break + case 'edit': + if (Array.isArray(value)) { + uploaderKeywordFilterInstance.setParams(value.map((v) => v.trim()).filter((v) => v)) + } + break + } + } notifyUploaderWhitelist(event: string, value?: string | string[]) { switch (event) { case 'disable': diff --git a/src/filters/videoFilter/filters/core.ts b/src/filters/videoFilter/filters/core.ts index 6e737dc7..59e65a2c 100644 --- a/src/filters/videoFilter/filters/core.ts +++ b/src/filters/videoFilter/filters/core.ts @@ -6,6 +6,7 @@ import durationFilterInstance from './subfilters/duration' import titleKeywordFilterInstance from './subfilters/titleKeyword' import titleKeywordWhitelistFilterInstance from './subfilters/titleKeywordWhitelist' import uploaderFilterInstance from './subfilters/uploader' +import uploaderKeywordFilterInstance from './subfilters/uploaderKeyword' import uploaderWhitelistFilterInstance from './subfilters/uploaderWhitelist' // 子过滤器实现IVideoSubFilter,包括白名单 @@ -45,6 +46,7 @@ class CoreVideoFilter { const checkDuration = durationFilterInstance.isEnable && selectorFunc.duration !== undefined const checkTitleKeyword = titleKeywordFilterInstance.isEnable && selectorFunc.titleKeyword !== undefined const checkUploader = uploaderFilterInstance.isEnable && selectorFunc.uploader !== undefined + const checkUploaderKeyword = uploaderKeywordFilterInstance.isEnable && selectorFunc.uploader !== undefined const checkBvid = bvidFilterInstance.isEnable && selectorFunc.bvid !== undefined const checkUploaderWhitelist = uploaderWhitelistFilterInstance.isEnable && selectorFunc.uploader !== undefined @@ -84,6 +86,13 @@ class CoreVideoFilter { info.uploader = uploader } } + if (checkUploaderKeyword) { + const uploader = selectorFunc.uploader!(video)?.trim() + if (uploader) { + blackTasks.push(uploaderKeywordFilterInstance.check(uploader)) + info.uploader = uploader + } + } if (checkTitleKeyword) { const title = selectorFunc.titleKeyword!(video)?.trim() if (title) { diff --git a/src/filters/videoFilter/filters/subfilters/titleKeyword.ts b/src/filters/videoFilter/filters/subfilters/titleKeyword.ts index 550ab31e..bd1cc851 100644 --- a/src/filters/videoFilter/filters/subfilters/titleKeyword.ts +++ b/src/filters/videoFilter/filters/subfilters/titleKeyword.ts @@ -33,7 +33,7 @@ class TitleKeywordFilter implements IVideoSubFilter { // 关键词为正则表达式(反斜杠使用单斜杠),大小写不敏感,支持unicodeSets const pattern = new RegExp(word.slice(1, -1), 'iv') if (title.match(pattern)) { - // 命中白名单正则 + // 命中黑名单正则 flag = true reject(`TitleKeyword reject, ${title} match ${word} in blacklist`) } diff --git a/src/filters/videoFilter/filters/subfilters/uploaderKeyword.ts b/src/filters/videoFilter/filters/subfilters/uploaderKeyword.ts new file mode 100644 index 00000000..51280bac --- /dev/null +++ b/src/filters/videoFilter/filters/subfilters/uploaderKeyword.ts @@ -0,0 +1,60 @@ +import { error } from '../../../../utils/logger' +import { IVideoSubFilter } from '../core' + +class UploaderKeywordFilter implements IVideoSubFilter { + isEnable = false + private uploaderKeywordSet = new Set() + + setStatus(status: boolean) { + this.isEnable = status + } + + setParams(values: string[]) { + this.uploaderKeywordSet = new Set(values.map((v) => v.trim()).filter((v) => v)) + } + + addParam(value: string) { + if (value.trim()) { + this.uploaderKeywordSet.add(value.trim()) + } + } + + check(uploader: string): Promise { + // 忽略大小写 + uploader = uploader.trim().toLowerCase() + return new Promise((resolve, reject) => { + try { + if (!this.isEnable || uploader.length === 0 || this.uploaderKeywordSet.size === 0) { + resolve(`UploaderKeyword resolve, disable or empty`) + } + let flag = false + this.uploaderKeywordSet.forEach((word) => { + if (word.startsWith('/') && word.endsWith('/')) { + // 关键词为正则表达式(反斜杠使用单斜杠),大小写不敏感 + const pattern = new RegExp(word.slice(1, -1), 'iv') + if (uploader.match(pattern)) { + // 命中黑名单正则 + flag = true + reject(`UploaderKeyword reject, ${uploader} match ${word} in blacklist`) + } + } else { + if (word && uploader.includes(word.toLowerCase())) { + flag = true + reject(`UploaderKeyword reject, ${uploader} match ${word} in blacklist`) + } + } + }) + if (!flag) { + resolve(`UploaderKeyword resolve, uploader not match blacklist`) + } + } catch (err) { + error(err) + resolve(`UploaderKeyword resolve, error`) + } + }) + } +} + +// 单例 +const uploaderKeywordFilterInstance = new UploaderKeywordFilter() +export default uploaderKeywordFilterInstance diff --git a/src/filters/videoFilter/pages/actions/action.ts b/src/filters/videoFilter/pages/actions/action.ts index f1bd2b0b..92dbd4a5 100644 --- a/src/filters/videoFilter/pages/actions/action.ts +++ b/src/filters/videoFilter/pages/actions/action.ts @@ -7,6 +7,7 @@ import durationFilterInstance from '../../filters/subfilters/duration' import titleKeywordFilterInstance from '../../filters/subfilters/titleKeyword' import titleKeywordWhitelistFilterInstance from '../../filters/subfilters/titleKeywordWhitelist' import uploaderFilterInstance from '../../filters/subfilters/uploader' +import uploaderKeywordFilterInstance from '../../filters/subfilters/uploaderKeyword' import uploaderWhitelistFilterInstance from '../../filters/subfilters/uploaderWhitelist' // 定义各种黑名单功能、白名单功能的属性和行为 @@ -234,6 +235,63 @@ export class TitleKeywordAction implements VideoFilterAction { } } +export class UploaderKeywordAction implements VideoFilterAction { + statusKey: string + valueKey: string + checkVideoList: (fullSite: boolean) => void + status: boolean + value: string[] + blacklist: WordList + + /** + * 昵称关键字过滤操作 + * @param statusKey 是否启用的GM key + * @param valueKey 存储数据的GM key + * @param checkVideoList 检测视频列表函数 + */ + constructor(statusKey: string, valueKey: string, checkVideoList: (fullSite: boolean) => void) { + this.statusKey = statusKey + this.valueKey = valueKey + this.status = GM_getValue(`BILICLEANER_${this.statusKey}`, false) + this.value = GM_getValue(`BILICLEANER_${this.valueKey}`, []) + this.checkVideoList = checkVideoList + + // 配置子过滤器 + uploaderKeywordFilterInstance.setStatus(this.status) + uploaderKeywordFilterInstance.setParams(this.value) + // 初始化黑名单, callback触发edit + this.blacklist = new WordList( + this.valueKey, + '昵称关键词 黑名单', + `每行一个关键词,支持正则(iv),语法:/abc|\\d+/`, + (values: string[]) => { + this.edit(values) + }, + ) + } + + enable() { + // 告知agency + agencyInstance.notifyUploaderKeyword('enable') + // 触发全站过滤 + this.checkVideoList(true) + } + disable() { + agencyInstance.notifyUploaderKeyword('disable') + this.checkVideoList(true) + } + add(value: string) { + this.blacklist.addValue(value) + agencyInstance.notifyUploaderKeyword('add', value) + this.checkVideoList(true) + } + // edit由编辑黑名单的保存动作回调, 数据由编辑器实例存储 + edit(values: string[]) { + agencyInstance.notifyUploaderKeyword('edit', values) + this.checkVideoList(true) + } +} + export class UploaderWhitelistAction implements VideoFilterAction { statusKey: string valueKey: string diff --git a/src/filters/videoFilter/pages/channel.ts b/src/filters/videoFilter/pages/channel.ts index 557b7c0f..e14f1921 100644 --- a/src/filters/videoFilter/pages/channel.ts +++ b/src/filters/videoFilter/pages/channel.ts @@ -12,6 +12,7 @@ import { TitleKeywordAction, TitleKeywordWhitelistAction, UploaderAction, + UploaderKeywordAction, UploaderWhitelistAction, } from './actions/action' @@ -124,6 +125,11 @@ if (isPageChannel()) { 'global-uploader-filter-value', checkVideoList, ) + const channelUploaderKeywordAction = new UploaderKeywordAction( + 'channel-uploader-keyword-filter-status', + 'global-uploader-keyword-filter-value', + checkVideoList, + ) const channelBvidAction = new BvidAction('channel-bvid-filter-status', 'global-bvid-filter-value', checkVideoList) const channelTitleKeywordAction = new TitleKeywordAction( 'channel-title-keyword-filter-status', @@ -211,7 +217,7 @@ if (isPageChannel()) { // 启用 频道页时长过滤 new CheckboxItem({ itemID: channelDurationAction.statusKey, - description: '启用 频道页时长过滤', + description: '启用 时长过滤', /** * 需使用匿名函数包装后传参, 否则报错, 下同 * @@ -249,10 +255,10 @@ if (isPageChannel()) { // UI组件, UP主过滤 const uploaderItems = [ - // 启用 频道页UP主过滤 + // 启用 UP主过滤 new CheckboxItem({ itemID: channelUploaderAction.statusKey, - description: '启用 频道页UP主过滤', + description: '启用 UP主过滤 (右键单击UP主)', itemFunc: () => { // 启用右键功能 isContextMenuUploaderEnable = true @@ -265,7 +271,7 @@ if (isPageChannel()) { channelUploaderAction.disable() }, }), - // 按钮功能:打开uploader黑名单编辑框 + // 编辑 UP主黑名单 new ButtonItem({ itemID: 'channel-uploader-edit-button', description: '编辑 UP主黑名单', @@ -275,17 +281,35 @@ if (isPageChannel()) { channelUploaderAction.blacklist.show() }, }), + // 启用 昵称关键词过滤 + new CheckboxItem({ + itemID: channelUploaderKeywordAction.statusKey, + description: '启用 昵称关键词过滤', + itemFunc: () => { + channelUploaderKeywordAction.enable() + }, + callback: () => { + channelUploaderKeywordAction.disable() + }, + }), + // 编辑 昵称关键词黑名单 + new ButtonItem({ + itemID: 'channel-uploader-keyword-edit-button', + description: '编辑 昵称关键词黑名单', + name: '编辑', + itemFunc: () => { + channelUploaderKeywordAction.blacklist.show() + }, + }), ] - channelPageVideoFilterGroupList.push( - new Group('channel-uploader-filter-group', '频道页 UP主过滤 (右键单击UP主)', uploaderItems), - ) + channelPageVideoFilterGroupList.push(new Group('channel-uploader-filter-group', '频道页 UP主过滤', uploaderItems)) // UI组件, 标题关键词过滤 const titleKeywordItems = [ // 启用 频道页关键词过滤 new CheckboxItem({ itemID: channelTitleKeywordAction.statusKey, - description: '启用 频道页关键词过滤', + description: '启用 标题关键词过滤', itemFunc: () => { channelTitleKeywordAction.enable() }, @@ -296,7 +320,7 @@ if (isPageChannel()) { // 按钮功能:打开titleKeyword黑名单编辑框 new ButtonItem({ itemID: 'channel-title-keyword-edit-button', - description: '编辑 关键词黑名单(支持正则)', + description: '编辑 标题关键词黑名单(支持正则)', name: '编辑', // 按钮功能 itemFunc: () => { @@ -313,7 +337,7 @@ if (isPageChannel()) { // 启用 频道页BV号过滤 new CheckboxItem({ itemID: channelBvidAction.statusKey, - description: '启用 频道页BV号过滤', + description: '启用 BV号过滤', itemFunc: () => { // 启用右键功能 isContextMenuBvidEnable = true @@ -346,7 +370,7 @@ if (isPageChannel()) { // 启用 频道页UP主白名单 new CheckboxItem({ itemID: channelUploaderWhitelistAction.statusKey, - description: '启用 频道页UP主白名单', + description: '启用 UP主白名单 (右键单击UP主)', itemFunc: () => { channelUploaderWhitelistAction.enable() }, @@ -367,7 +391,7 @@ if (isPageChannel()) { // 启用 频道页标题关键词白名单 new CheckboxItem({ itemID: channelTitleKeyworldWhitelistAction.statusKey, - description: '启用 频道页标题关键词白名单', + description: '启用 标题关键词白名单', itemFunc: () => { channelTitleKeyworldWhitelistAction.enable() }, @@ -378,7 +402,7 @@ if (isPageChannel()) { // 编辑 关键词白名单 new ButtonItem({ itemID: 'channel-title-keyword-whitelist-edit-button', - description: '编辑 关键词白名单(支持正则)', + description: '编辑 标题关键词白名单(支持正则)', name: '编辑', // 按钮功能:显示白名单编辑器 itemFunc: () => { diff --git a/src/filters/videoFilter/pages/homepage.ts b/src/filters/videoFilter/pages/homepage.ts index 3d115284..f406e412 100644 --- a/src/filters/videoFilter/pages/homepage.ts +++ b/src/filters/videoFilter/pages/homepage.ts @@ -12,6 +12,7 @@ import { TitleKeywordAction, TitleKeywordWhitelistAction, UploaderAction, + UploaderKeywordAction, UploaderWhitelistAction, } from './actions/action' import { GM_getValue } from '$' @@ -158,6 +159,11 @@ if (isPageHomepage()) { 'global-uploader-filter-value', checkVideoList, ) + const homepageUploaderKeywordAction = new UploaderKeywordAction( + 'homepage-uploader-keyword-filter-status', + 'global-uploader-keyword-filter-value', + checkVideoList, + ) const homepageBvidAction = new BvidAction('homepage-bvid-filter-status', 'global-bvid-filter-value', checkVideoList) const homepageTitleKeywordAction = new TitleKeywordAction( 'homepage-title-keyword-filter-status', @@ -245,7 +251,7 @@ if (isPageHomepage()) { // 启用 首页时长过滤 new CheckboxItem({ itemID: homepageDurationAction.statusKey, - description: '启用 首页时长过滤', + description: '启用 时长过滤', /** * 需使用匿名函数包装后传参, 否则报错, 下同 * @@ -286,7 +292,7 @@ if (isPageHomepage()) { // 启用 首页UP主过滤 new CheckboxItem({ itemID: homepageUploaderAction.statusKey, - description: '启用 首页UP主过滤', + description: '启用 UP主过滤 (右键单击UP主)', itemFunc: () => { // 启用右键功能 isContextMenuUploaderEnable = true @@ -309,17 +315,35 @@ if (isPageHomepage()) { homepageUploaderAction.blacklist.show() }, }), + // 启用 昵称关键词过滤 + new CheckboxItem({ + itemID: homepageUploaderKeywordAction.statusKey, + description: '启用 昵称关键词过滤', + itemFunc: () => { + homepageUploaderKeywordAction.enable() + }, + callback: () => { + homepageUploaderKeywordAction.disable() + }, + }), + // 编辑 昵称关键词黑名单 + new ButtonItem({ + itemID: 'homepage-uploader-keyword-edit-button', + description: '编辑 昵称关键词黑名单', + name: '编辑', + itemFunc: () => { + homepageUploaderKeywordAction.blacklist.show() + }, + }), ] - homepagePageVideoFilterGroupList.push( - new Group('homepage-uploader-filter-group', '首页 UP主过滤 (右键单击UP主)', uploaderItems), - ) + homepagePageVideoFilterGroupList.push(new Group('homepage-uploader-filter-group', '首页 UP主过滤', uploaderItems)) // UI组件, 标题关键词过滤 const titleKeywordItems = [ // 启用 首页关键词过滤 new CheckboxItem({ itemID: homepageTitleKeywordAction.statusKey, - description: '启用 首页关键词过滤', + description: '启用 标题关键词过滤', itemFunc: () => { homepageTitleKeywordAction.enable() }, @@ -330,7 +354,7 @@ if (isPageHomepage()) { // 按钮功能:打开titleKeyword黑名单编辑框 new ButtonItem({ itemID: 'homepage-title-keyword-edit-button', - description: '编辑 关键词黑名单(支持正则)', + description: '编辑 标题关键词黑名单(支持正则)', name: '编辑', // 按钮功能 itemFunc: () => { @@ -347,7 +371,7 @@ if (isPageHomepage()) { // 启用 首页BV号过滤 new CheckboxItem({ itemID: homepageBvidAction.statusKey, - description: '启用 首页BV号过滤', + description: '启用 BV号过滤 (右键单击标题)', itemFunc: () => { // 启用右键功能 isContextMenuBvidEnable = true @@ -371,9 +395,7 @@ if (isPageHomepage()) { }, }), ] - homepagePageVideoFilterGroupList.push( - new Group('homepage-bvid-filter-group', '首页 BV号过滤 (右键单击标题)', bvidItems), - ) + homepagePageVideoFilterGroupList.push(new Group('homepage-bvid-filter-group', '首页 BV号过滤', bvidItems)) // UI组件, 例外和白名单 const whitelistItems = [ @@ -395,7 +417,7 @@ if (isPageHomepage()) { // 启用 首页UP主白名单 new CheckboxItem({ itemID: homepageUploaderWhitelistAction.statusKey, - description: '启用 首页UP主白名单', + description: '启用 UP主白名单 (右键单击UP主)', itemFunc: () => { homepageUploaderWhitelistAction.enable() }, @@ -416,7 +438,7 @@ if (isPageHomepage()) { // 启用 首页标题关键词白名单 new CheckboxItem({ itemID: homepageTitleKeyworldWhitelistAction.statusKey, - description: '启用 首页标题关键词白名单', + description: '启用 标题关键词白名单', itemFunc: () => { homepageTitleKeyworldWhitelistAction.enable() }, @@ -427,7 +449,7 @@ if (isPageHomepage()) { // 编辑 关键词白名单 new ButtonItem({ itemID: 'homepage-title-keyword-whitelist-edit-button', - description: '编辑 关键词白名单(支持正则)', + description: '编辑 标题关键词白名单(支持正则)', name: '编辑', // 按钮功能:显示白名单编辑器 itemFunc: () => { diff --git a/src/filters/videoFilter/pages/popular.ts b/src/filters/videoFilter/pages/popular.ts index 6db03f13..cd1c74aa 100644 --- a/src/filters/videoFilter/pages/popular.ts +++ b/src/filters/videoFilter/pages/popular.ts @@ -11,6 +11,7 @@ import { TitleKeywordAction, TitleKeywordWhitelistAction, UploaderAction, + UploaderKeywordAction, UploaderWhitelistAction, } from './actions/action' @@ -130,6 +131,11 @@ if (isPagePopular()) { 'global-uploader-filter-value', checkVideoList, ) + const popularUploaderKeywordAction = new UploaderKeywordAction( + 'popular-uploader-keyword-filter-status', + 'global-uploader-keyword-filter-value', + checkVideoList, + ) const popularBvidAction = new BvidAction('popular-bvid-filter-status', 'global-bvid-filter-value', checkVideoList) const popularTitleKeywordAction = new TitleKeywordAction( 'popular-title-keyword-filter-status', @@ -221,7 +227,7 @@ if (isPagePopular()) { // 启用 热门页 UP主过滤 new CheckboxItem({ itemID: popularUploaderAction.statusKey, - description: '启用 热门页 UP主过滤', + description: '启用 UP主过滤 (右键单击UP主)', itemFunc: () => { // 启用右键功能 isContextMenuUploaderEnable = true @@ -244,17 +250,35 @@ if (isPagePopular()) { popularUploaderAction.blacklist.show() }, }), + // 启用 昵称关键词过滤 + new CheckboxItem({ + itemID: popularUploaderKeywordAction.statusKey, + description: '启用 昵称关键词过滤', + itemFunc: () => { + popularUploaderKeywordAction.enable() + }, + callback: () => { + popularUploaderKeywordAction.disable() + }, + }), + // 编辑 昵称关键词黑名单 + new ButtonItem({ + itemID: 'popular-uploader-keyword-edit-button', + description: '编辑 昵称关键词黑名单', + name: '编辑', + itemFunc: () => { + popularUploaderKeywordAction.blacklist.show() + }, + }), ] - popularPageVideoFilterGroupList.push( - new Group('popular-uploader-filter-group', '热门页 UP主过滤 (右键单击UP主)', uploaderItems), - ) + popularPageVideoFilterGroupList.push(new Group('popular-uploader-filter-group', '热门页 UP主过滤', uploaderItems)) // UI组件, 标题关键词过滤part const titleKeywordItems = [ // 启用 热门页 关键词过滤 new CheckboxItem({ itemID: popularTitleKeywordAction.statusKey, - description: '启用 热门页 关键词过滤', + description: '启用 标题关键词过滤', itemFunc: () => { popularTitleKeywordAction.enable() }, @@ -265,7 +289,7 @@ if (isPagePopular()) { // 按钮功能:打开titleKeyword黑名单编辑框 new ButtonItem({ itemID: 'popular-title-keyword-edit-button', - description: '编辑 关键词黑名单(支持正则)', + description: '编辑 标题关键词黑名单(支持正则)', name: '编辑', // 按钮功能 itemFunc: () => { @@ -282,7 +306,7 @@ if (isPagePopular()) { // 启用 热门页 BV号过滤 new CheckboxItem({ itemID: popularBvidAction.statusKey, - description: '启用 热门页 BV号过滤', + description: '启用 BV号过滤 (右键单击标题)', itemFunc: () => { // 启用右键功能 isContextMenuBvidEnable = true @@ -306,16 +330,14 @@ if (isPagePopular()) { }, }), ] - popularPageVideoFilterGroupList.push( - new Group('popular-bvid-filter-group', '热门页 BV号过滤 (右键单击标题)', bvidItems), - ) + popularPageVideoFilterGroupList.push(new Group('popular-bvid-filter-group', '热门页 BV号过滤', bvidItems)) // UI组件, 例外和白名单part const whitelistItems = [ // 启用 热门页 UP主白名单 new CheckboxItem({ itemID: popularUploaderWhitelistAction.statusKey, - description: '启用 热门页 UP主白名单', + description: '启用 UP主白名单 (右键单击UP主)', itemFunc: () => { popularUploaderWhitelistAction.enable() }, @@ -336,7 +358,7 @@ if (isPagePopular()) { // 启用 热门页 标题关键词白名单 new CheckboxItem({ itemID: popularTitleKeywordWhitelistAction.statusKey, - description: '启用 热门页 标题关键词白名单', + description: '启用 标题关键词白名单', itemFunc: () => { popularTitleKeywordWhitelistAction.enable() }, @@ -347,7 +369,7 @@ if (isPagePopular()) { // 编辑 关键词白名单 new ButtonItem({ itemID: 'popular-title-keyword-whitelist-edit-button', - description: '编辑 关键词白名单(支持正则)', + description: '编辑 标题关键词白名单(支持正则)', name: '编辑', // 按钮功能:显示白名单编辑器 itemFunc: () => { diff --git a/src/filters/videoFilter/pages/search.ts b/src/filters/videoFilter/pages/search.ts index eb154901..3f034b58 100644 --- a/src/filters/videoFilter/pages/search.ts +++ b/src/filters/videoFilter/pages/search.ts @@ -11,6 +11,7 @@ import { TitleKeywordAction, TitleKeywordWhitelistAction, UploaderAction, + UploaderKeywordAction, UploaderWhitelistAction, } from './actions/action' import { GM_getValue } from '$' @@ -126,6 +127,11 @@ if (isPageSearch()) { 'global-uploader-filter-value', checkVideoList, ) + const searchUploaderKeywordAction = new UploaderKeywordAction( + 'search-uploader-keyword-filter-status', + 'global-uploader-keyword-filter-value', + checkVideoList, + ) const searchBvidAction = new BvidAction('search-bvid-filter-status', 'global-bvid-filter-value', checkVideoList) const searchTitleKeywordAction = new TitleKeywordAction( 'search-title-keyword-filter-status', @@ -214,7 +220,7 @@ if (isPageSearch()) { const durationItems = [ new CheckboxItem({ itemID: searchDurationAction.statusKey, - description: '启用 搜索页时长过滤', + description: '启用 时长过滤', itemFunc: () => { searchDurationAction.enable() }, @@ -241,7 +247,7 @@ if (isPageSearch()) { const uploaderItems = [ new CheckboxItem({ itemID: searchUploaderAction.statusKey, - description: '启用 搜索页UP主过滤', + description: '启用 UP主过滤 (右键单击UP主)', itemFunc: () => { // 启用右键功能 isContextMenuUploaderEnable = true @@ -264,16 +270,34 @@ if (isPageSearch()) { searchUploaderAction.blacklist.show() }, }), + // 启用 昵称关键词过滤 + new CheckboxItem({ + itemID: searchUploaderKeywordAction.statusKey, + description: '启用 昵称关键词过滤', + itemFunc: () => { + searchUploaderKeywordAction.enable() + }, + callback: () => { + searchUploaderKeywordAction.disable() + }, + }), + // 编辑 昵称关键词黑名单 + new ButtonItem({ + itemID: 'search-uploader-keyword-edit-button', + description: '编辑 昵称关键词黑名单', + name: '编辑', + itemFunc: () => { + searchUploaderKeywordAction.blacklist.show() + }, + }), ] - searchPageVideoFilterGroupList.push( - new Group('search-uploader-filter-group', '搜索页 UP主过滤 (右键单击UP主)', uploaderItems), - ) + searchPageVideoFilterGroupList.push(new Group('search-uploader-filter-group', '搜索页 UP主过滤', uploaderItems)) // UI组件, 标题关键词过滤part const titleKeywordItems = [ new CheckboxItem({ itemID: searchTitleKeywordAction.statusKey, - description: '启用 搜索页关键词过滤', + description: '启用 标题关键词过滤', itemFunc: () => { searchTitleKeywordAction.enable() }, @@ -284,7 +308,7 @@ if (isPageSearch()) { // 按钮功能:打开titleKeyword黑名单编辑框 new ButtonItem({ itemID: 'search-title-keyword-edit-button', - description: '编辑 关键词黑名单(支持正则)', + description: '编辑 标题关键词黑名单(支持正则)', name: '编辑', // 按钮功能 itemFunc: () => { @@ -300,7 +324,7 @@ if (isPageSearch()) { const bvidItems = [ new CheckboxItem({ itemID: searchBvidAction.statusKey, - description: '启用 搜索页BV号过滤', + description: '启用 BV号过滤 (右键单击标题)', itemFunc: () => { // 启用右键功能 isContextMenuBvidEnable = true @@ -324,9 +348,7 @@ if (isPageSearch()) { }, }), ] - searchPageVideoFilterGroupList.push( - new Group('search-bvid-filter-group', '搜索页 BV号过滤 (右键单击标题)', bvidItems), - ) + searchPageVideoFilterGroupList.push(new Group('search-bvid-filter-group', '搜索页 BV号过滤', bvidItems)) // UI组件, 例外和白名单part const whitelistItems = [ @@ -347,7 +369,7 @@ if (isPageSearch()) { }), new CheckboxItem({ itemID: searchUploaderWhitelistAction.statusKey, - description: '启用 搜索页UP主白名单', + description: '启用 UP主白名单', itemFunc: () => { searchUploaderWhitelistAction.enable() }, @@ -366,7 +388,7 @@ if (isPageSearch()) { }), new CheckboxItem({ itemID: searchTitleKeyworldWhitelistAction.statusKey, - description: '启用 搜索页标题关键词白名单', + description: '启用 标题关键词白名单', itemFunc: () => { searchTitleKeyworldWhitelistAction.enable() }, @@ -376,7 +398,7 @@ if (isPageSearch()) { }), new ButtonItem({ itemID: 'search-title-keyword-whitelist-edit-button', - description: '编辑 关键词白名单(支持正则)', + description: '编辑 标题关键词白名单(支持正则)', name: '编辑', // 按钮功能:显示白名单编辑器 itemFunc: () => { diff --git a/src/filters/videoFilter/pages/video.ts b/src/filters/videoFilter/pages/video.ts index e63b7cf7..e2b3eec8 100644 --- a/src/filters/videoFilter/pages/video.ts +++ b/src/filters/videoFilter/pages/video.ts @@ -11,6 +11,7 @@ import { TitleKeywordAction, TitleKeywordWhitelistAction, UploaderAction, + UploaderKeywordAction, UploaderWhitelistAction, } from './actions/action' import { GM_getValue } from '$' @@ -128,6 +129,11 @@ if (isPageVideo()) { 'global-uploader-filter-value', checkVideoList, ) + const videoUploaderKeywordAction = new UploaderKeywordAction( + 'video-uploader-keyword-filter-status', + 'global-uploader-keyword-filter-value', + checkVideoList, + ) const videoBvidAction = new BvidAction('video-bvid-filter-status', 'global-bvid-filter-value', checkVideoList) const videoTitleKeywordAction = new TitleKeywordAction( 'video-title-keyword-filter-status', @@ -214,7 +220,7 @@ if (isPageVideo()) { // 启用 播放页时长过滤 new CheckboxItem({ itemID: videoDurationAction.statusKey, - description: '启用 播放页时长过滤', + description: '启用 时长过滤', itemFunc: () => { videoDurationAction.enable() }, @@ -243,7 +249,7 @@ if (isPageVideo()) { // 启用 播放页UP主过滤 new CheckboxItem({ itemID: videoUploaderAction.statusKey, - description: '启用 播放页UP主过滤', + description: '启用 UP主过滤 (右键单击UP主)', itemFunc: () => { // 启用右键菜单功能 isContextMenuUploaderEnable = true @@ -266,17 +272,35 @@ if (isPageVideo()) { videoUploaderAction.blacklist.show() }, }), + // 启用 昵称关键词过滤 + new CheckboxItem({ + itemID: videoUploaderKeywordAction.statusKey, + description: '启用 昵称关键词过滤', + itemFunc: () => { + videoUploaderKeywordAction.enable() + }, + callback: () => { + videoUploaderKeywordAction.disable() + }, + }), + // 编辑 昵称关键词黑名单 + new ButtonItem({ + itemID: 'video-uploader-keyword-edit-button', + description: '编辑 昵称关键词黑名单', + name: '编辑', + itemFunc: () => { + videoUploaderKeywordAction.blacklist.show() + }, + }), ] - videoPageVideoFilterGroupList.push( - new Group('video-uploader-filter-group', '播放页 UP主过滤 (右键单击UP主)', uploaderItems), - ) + videoPageVideoFilterGroupList.push(new Group('video-uploader-filter-group', '播放页 UP主过滤', uploaderItems)) // UI组件, 标题关键词过滤part const titleKeywordItems = [ // 启用 播放页关键词过滤 new CheckboxItem({ itemID: videoTitleKeywordAction.statusKey, - description: '启用 播放页关键词过滤', + description: '启用 标题关键词过滤', itemFunc: () => { videoTitleKeywordAction.enable() }, @@ -287,7 +311,7 @@ if (isPageVideo()) { // 编辑 关键词黑名单 new ButtonItem({ itemID: 'video-title-keyword-edit-button', - description: '编辑 关键词黑名单(支持正则)', + description: '编辑 标题关键词黑名单(支持正则)', name: '编辑', // 按钮功能:打开编辑器 itemFunc: () => { @@ -304,7 +328,7 @@ if (isPageVideo()) { // 启用 播放页 BV号过滤 new CheckboxItem({ itemID: videoBvidAction.statusKey, - description: '启用 播放页BV号过滤', + description: '启用 BV号过滤 (右键单击标题)', itemFunc: () => { // 启用 右键功能 isContextMenuBvidEnable = true @@ -328,9 +352,7 @@ if (isPageVideo()) { }, }), ] - videoPageVideoFilterGroupList.push( - new Group('video-bvid-filter-group', '播放页 BV号过滤 (右键单击标题)', bvidItems), - ) + videoPageVideoFilterGroupList.push(new Group('video-bvid-filter-group', '播放页 BV号过滤', bvidItems)) // UI组件, 免过滤和白名单part const whitelistItems = [ @@ -351,7 +373,7 @@ if (isPageVideo()) { // 启用 播放页UP主白名单 new CheckboxItem({ itemID: videoUploaderWhitelistAction.statusKey, - description: '启用 播放页UP主白名单', + description: '启用 UP主白名单', itemFunc: () => { videoUploaderWhitelistAction.enable() }, @@ -372,7 +394,7 @@ if (isPageVideo()) { // 启用 播放页关键词白名单 new CheckboxItem({ itemID: videoTitleKeywordWhitelistAction.statusKey, - description: '启用 播放页关键词白名单', + description: '启用 标题关键词白名单', itemFunc: () => { videoTitleKeywordWhitelistAction.enable() }, @@ -383,7 +405,7 @@ if (isPageVideo()) { // 编辑 关键词白名单 new ButtonItem({ itemID: 'video-title-keyword-whitelist-edit-button', - description: '编辑 关键词白名单(支持正则)', + description: '编辑 标题关键词白名单(支持正则)', name: '编辑', // 按钮功能:打开编辑器 itemFunc: () => { diff --git a/vite.config.ts b/vite.config.ts index fb6e6755..86474ce8 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -8,7 +8,7 @@ export default defineConfig({ userscript: { name: 'bilibili 页面净化大师', namespace: 'http://tampermonkey.net/', - version: '3.2.2', + version: '3.3.0', description: '净化 B站/哔哩哔哩 网页元素,去广告,BV号转AV号,播放器净化,过滤视频,过滤评论,提供300+项功能,定制自己的B站页面', author: 'festoney8', From e2f13090b88b46fbebbaac909a2db58083d67eca Mon Sep 17 00:00:00 2001 From: festoney8 Date: Wed, 27 Mar 2024 19:48:22 +0800 Subject: [PATCH 4/7] update: hide message-red-num --- CHANGELOG.md | 1 + src/rules/common.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dd2408e2..8f889256 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - 新增:UP主昵称关键词黑名单 - 新增:播放页隐藏接下来播放 - 更新:净化分享适配新版标题 +- 优化:一些页面净化功能细节 ## 3.2.1 diff --git a/src/rules/common.ts b/src/rules/common.ts index 0b020f57..9f6d93ed 100644 --- a/src/rules/common.ts +++ b/src/rules/common.ts @@ -691,7 +691,7 @@ if (!isPageLiveHome()) { itemID: 'common-hide-nav-message-red-num', description: '隐藏 消息小红点', itemCSS: ` - .right-entry .v-popover-wrap:has([href*="//message.bilibili.com"], [data-idx="message"]) .red-num--message { + .right-entry .v-popover-wrap:has([href*="//message.bilibili.com"], [data-idx="message"]) :is(.red-num--message, .red-point--message) { display: none !important; } /* 旧版header */ From 059c49199942a4548ce8d28a805eab661b020d7f Mon Sep 17 00:00:00 2001 From: festoney8 Date: Thu, 28 Mar 2024 00:08:36 +0800 Subject: [PATCH 5/7] fix: contextmenu bug, update playlist support --- CHANGELOG.md | 4 +- src/components/contextmenu.ts | 6 +-- src/filters/commentFilter/pages/video.ts | 16 ++++---- src/filters/videoFilter/pages/channel.ts | 18 +++++---- src/filters/videoFilter/pages/homepage.ts | 18 +++++---- src/filters/videoFilter/pages/popular.ts | 18 +++++---- src/filters/videoFilter/pages/search.ts | 18 +++++---- src/filters/videoFilter/pages/video.ts | 46 +++++++++++------------ src/main.ts | 9 +++-- src/utils/page-type.ts | 2 +- 10 files changed, 81 insertions(+), 74 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f889256..48af23d1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,11 +2,13 @@ ## 3.3.0 -- 新增:支持UP主昵称关键词过滤(首页、热门页、播放页、频道页、搜索页) +- 新增:UP主昵称关键词过滤(首页、热门页、播放页、频道页、搜索页) - 新增:UP主昵称关键词黑名单 - 新增:播放页隐藏接下来播放 - 更新:净化分享适配新版标题 - 优化:一些页面净化功能细节 +- 优化:对播放列表页的支持 +- 修复:一些bug ## 3.2.1 diff --git a/src/components/contextmenu.ts b/src/components/contextmenu.ts index 575d526b..ef744994 100644 --- a/src/components/contextmenu.ts +++ b/src/components/contextmenu.ts @@ -4,7 +4,7 @@ type Menu = { name: string onclick: () => void } -class ContextMenu { +export class ContextMenu { private nodeHTML = `
    @@ -108,7 +108,3 @@ class ContextMenu { this.isShowing = false } } - -// 单例 -const contextMenuInstance = new ContextMenu() -export default contextMenuInstance diff --git a/src/filters/commentFilter/pages/video.ts b/src/filters/commentFilter/pages/video.ts index a04499fa..eb1a4525 100644 --- a/src/filters/commentFilter/pages/video.ts +++ b/src/filters/commentFilter/pages/video.ts @@ -2,12 +2,12 @@ import { GM_getValue } from '$' import { Group } from '../../../components/group' import { CheckboxItem, ButtonItem } from '../../../components/item' import { debugCommentFilter as debug, error } from '../../../utils/logger' -import { isPageBangumi, isPageVideo } from '../../../utils/page-type' +import { isPageBangumi, isPagePlaylist, isPageVideo } from '../../../utils/page-type' import { showEle, waitForEle } from '../../../utils/tool' import { ContentAction, UsernameAction } from './actions/action' -import contextMenuInstance from '../../../components/contextmenu' import coreCommentFilterInstance, { CommentSelectorFunc } from '../filters/core' import settings from '../../../settings' +import { ContextMenu } from '../../../components/contextmenu' const videoPageCommentFilterGroupList: Group[] = [] @@ -23,7 +23,7 @@ let isPinnedCommentWhitelistEnable: boolean = GM_getValue('BILICLEANER_video-com let isNoteCommentWhitelistEnable: boolean = GM_getValue('BILICLEANER_video-comment-note-whitelist-status', true) let isLinkCommentWhitelistEnable: boolean = GM_getValue('BILICLEANER_video-comment-link-whitelist-status', true) -if (isPageVideo() || isPageBangumi()) { +if (isPageVideo() || isPageBangumi() || isPagePlaylist()) { let commentListContainer: HTMLElement // 一级评论 const rootCommentSelectorFunc: CommentSelectorFunc = { @@ -177,7 +177,9 @@ if (isPageVideo() || isPageBangumi()) { return } isContextMenuFuncRunning = true + const menu = new ContextMenu() document.addEventListener('contextmenu', (e) => { + menu.hide() if (e.target instanceof HTMLElement) { const target = e.target if ( @@ -188,19 +190,19 @@ if (isPageVideo() || isPageBangumi()) { const username = target.textContent?.trim() if (username) { e.preventDefault() - contextMenuInstance.registerMenu(`屏蔽用户:${username}`, () => { + menu.registerMenu(`屏蔽用户:${username}`, () => { usernameAction.add(username) }) - contextMenuInstance.show(e.clientX, e.clientY) + menu.show(e.clientX, e.clientY) } } else { - contextMenuInstance.hide() + menu.hide() } } }) // 关闭右键菜单 document.addEventListener('click', () => { - contextMenuInstance.hide() + menu.hide() }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/channel.ts b/src/filters/videoFilter/pages/channel.ts index e14f1921..f18ef239 100644 --- a/src/filters/videoFilter/pages/channel.ts +++ b/src/filters/videoFilter/pages/channel.ts @@ -4,7 +4,6 @@ import { Group } from '../../../components/group' import coreFilterInstance, { VideoSelectorFunc } from '../filters/core' import settings from '../../../settings' import { isPageChannel } from '../../../utils/page-type' -import contextMenuInstance from '../../../components/contextmenu' import { matchBvid, waitForEle } from '../../../utils/tool' import { BvidAction, @@ -15,6 +14,7 @@ import { UploaderKeywordAction, UploaderWhitelistAction, } from './actions/action' +import { ContextMenu } from '../../../components/contextmenu' const channelPageVideoFilterGroupList: Group[] = [] @@ -155,8 +155,10 @@ if (isPageChannel()) { return } isContextMenuFuncRunning = true + const menu = new ContextMenu() // 监听右键单击 document.addEventListener('contextmenu', (e) => { + menu.hide() if (e.target instanceof HTMLElement) { // debug(e.target.classList) if ( @@ -175,9 +177,9 @@ if (isPageChannel()) { const onclickWhite = () => { channelUploaderWhitelistAction.add(uploader) } - contextMenuInstance.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) - contextMenuInstance.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) + menu.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) + menu.show(e.clientX, e.clientY) } } else if ( isContextMenuBvidEnable && @@ -193,18 +195,18 @@ if (isPageChannel()) { const onclick = () => { channelBvidAction.add(bvid) } - contextMenuInstance.registerMenu(`屏蔽视频:${bvid}`, onclick) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`屏蔽视频:${bvid}`, onclick) + menu.show(e.clientX, e.clientY) } } } else { - contextMenuInstance.hide() + menu.hide() } } }) // 监听左键单击,关闭右键菜单 document.addEventListener('click', () => { - contextMenuInstance.hide() + menu.hide() }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/homepage.ts b/src/filters/videoFilter/pages/homepage.ts index f406e412..66bc0d6d 100644 --- a/src/filters/videoFilter/pages/homepage.ts +++ b/src/filters/videoFilter/pages/homepage.ts @@ -4,7 +4,7 @@ import { Group } from '../../../components/group' import coreFilterInstance, { VideoSelectorFunc } from '../filters/core' import settings from '../../../settings' import { isPageHomepage } from '../../../utils/page-type' -import contextMenuInstance from '../../../components/contextmenu' +import { ContextMenu } from '../../../components/contextmenu' import { matchBvid, showEle, waitForEle } from '../../../utils/tool' import { BvidAction, @@ -189,8 +189,10 @@ if (isPageHomepage()) { return } isContextMenuFuncRunning = true + const menu = new ContextMenu() // 监听右键单击 document.addEventListener('contextmenu', (e) => { + menu.hide() if (e.target instanceof HTMLElement) { // debug(e.target.classList) if ( @@ -209,9 +211,9 @@ if (isPageHomepage()) { const onclickWhite = () => { homepageUploaderWhitelistAction.add(uploader) } - contextMenuInstance.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) - contextMenuInstance.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) + menu.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) + menu.show(e.clientX, e.clientY) } } else if ( isContextMenuBvidEnable && @@ -227,18 +229,18 @@ if (isPageHomepage()) { const onclick = () => { homepageBvidAction.add(bvid) } - contextMenuInstance.registerMenu(`屏蔽视频:${bvid}`, onclick) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`屏蔽视频:${bvid}`, onclick) + menu.show(e.clientX, e.clientY) } } } else { - contextMenuInstance.hide() + menu.hide() } } }) // 监听左键单击,关闭右键菜单 document.addEventListener('click', () => { - contextMenuInstance.hide() + menu.hide() }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/popular.ts b/src/filters/videoFilter/pages/popular.ts index cd1c74aa..b3864023 100644 --- a/src/filters/videoFilter/pages/popular.ts +++ b/src/filters/videoFilter/pages/popular.ts @@ -4,7 +4,7 @@ import { ButtonItem, CheckboxItem } from '../../../components/item' import { Group } from '../../../components/group' import settings from '../../../settings' import { isPagePopular } from '../../../utils/page-type' -import contextMenuInstance from '../../../components/contextmenu' +import { ContextMenu } from '../../../components/contextmenu' import { matchBvid, waitForEle } from '../../../utils/tool' import { BvidAction, @@ -160,8 +160,10 @@ if (isPagePopular()) { return } isContextMenuFuncRunning = true + const menu = new ContextMenu() // 监听右键单击 document.addEventListener('contextmenu', (e) => { + menu.hide() if (e.target instanceof HTMLElement) { const target = e.target if ( @@ -178,9 +180,9 @@ if (isPagePopular()) { const onclickWhite = () => { popularUploaderWhitelistAction.add(uploader) } - contextMenuInstance.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) - contextMenuInstance.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) + menu.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) + menu.show(e.clientX, e.clientY) } } else if ( isContextMenuBvidEnable && @@ -203,18 +205,18 @@ if (isPagePopular()) { const onclick = () => { popularBvidAction.add(bvid) } - contextMenuInstance.registerMenu(`屏蔽视频:${bvid}`, onclick) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`屏蔽视频:${bvid}`, onclick) + menu.show(e.clientX, e.clientY) } } } else { - contextMenuInstance.hide() + menu.hide() } } }) // 监听左键单击,关闭右键菜单 document.addEventListener('click', () => { - contextMenuInstance.hide() + menu.hide() }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/search.ts b/src/filters/videoFilter/pages/search.ts index 3f034b58..5cd78a8a 100644 --- a/src/filters/videoFilter/pages/search.ts +++ b/src/filters/videoFilter/pages/search.ts @@ -3,7 +3,7 @@ import { ButtonItem, CheckboxItem, NumberItem } from '../../../components/item' import { Group } from '../../../components/group' import coreFilterInstance, { VideoSelectorFunc } from '../filters/core' import { isPageSearch } from '../../../utils/page-type' -import contextMenuInstance from '../../../components/contextmenu' +import { ContextMenu } from '../../../components/contextmenu' import { matchBvid, showEle, waitForEle } from '../../../utils/tool' import { BvidAction, @@ -157,8 +157,10 @@ if (isPageSearch()) { return } isContextMenuFuncRunning = true + const menu = new ContextMenu() // 监听右键单击 document.addEventListener('contextmenu', (e) => { + menu.hide() if (e.target instanceof HTMLElement) { debug(e.target.classList) if ( @@ -177,9 +179,9 @@ if (isPageSearch()) { const onclickWhite = () => { searchUploaderWhitelistAction.add(uploader) } - contextMenuInstance.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) - contextMenuInstance.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) + menu.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) + menu.show(e.clientX, e.clientY) } } else if ( isContextMenuBvidEnable && @@ -197,18 +199,18 @@ if (isPageSearch()) { const onclick = () => { searchBvidAction.add(bvid) } - contextMenuInstance.registerMenu(`屏蔽视频:${bvid}`, onclick) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`屏蔽视频:${bvid}`, onclick) + menu.show(e.clientX, e.clientY) } } } else { - contextMenuInstance.hide() + menu.hide() } } }) // 监听左键单击,关闭右键菜单 document.addEventListener('click', () => { - contextMenuInstance.hide() + menu.hide() }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/video.ts b/src/filters/videoFilter/pages/video.ts index e2b3eec8..7b8c4770 100644 --- a/src/filters/videoFilter/pages/video.ts +++ b/src/filters/videoFilter/pages/video.ts @@ -2,8 +2,7 @@ import { debugVideoFilter as debug, error } from '../../../utils/logger' import coreFilterInstance, { VideoSelectorFunc } from '../filters/core' import { ButtonItem, CheckboxItem, NumberItem } from '../../../components/item' import { Group } from '../../../components/group' -import { isPageVideo } from '../../../utils/page-type' -import contextMenuInstance from '../../../components/contextmenu' +import { isPagePlaylist, isPageVideo } from '../../../utils/page-type' import { matchBvid, showEle, waitForEle } from '../../../utils/tool' import { BvidAction, @@ -15,6 +14,7 @@ import { UploaderWhitelistAction, } from './actions/action' import { GM_getValue } from '$' +import { ContextMenu } from '../../../components/contextmenu' const videoPageVideoFilterGroupList: Group[] = [] @@ -25,7 +25,7 @@ let isContextMenuBvidEnable = false // 接下来播放是否免过滤 let isNextPlayWhitelistEnable: boolean = GM_getValue('BILICLEANER_video-next-play-whitelist-filter-status', true) -if (isPageVideo()) { +if (isPageVideo() || isPagePlaylist()) { let videoListContainer: HTMLElement // 构建SelectorFunc const rcmdSelectorFunc: VideoSelectorFunc = { @@ -49,7 +49,7 @@ if (isPageVideo()) { return null }, uploader: (video: Element): string | null => { - const uploader = video.querySelector('.info > .upname a')?.textContent + const uploader = video.querySelector('.info > .upname .name')?.textContent?.trim() return uploader ? uploader : null }, } @@ -67,7 +67,7 @@ if (isPageVideo()) { ) // 推荐列表 const rcmdVideos = videoListContainer.querySelectorAll( - `.rec-list .video-page-card-small, .rec-list .video-page-operator-card-small`, + `.rec-list .video-page-card-small, .rec-list .video-page-operator-card-small, .recommend-video-card`, ) // 判断是否筛选接下来播放 @@ -103,8 +103,12 @@ if (isPageVideo()) { try { // 监听视频列表出现 - waitForEle(document, '#reco_list', (node: Node): boolean => { - return node instanceof HTMLElement && (node as HTMLElement).id === 'reco_list' + waitForEle(document, '#reco_list, .recommend-list-container', (node: Node): boolean => { + return ( + node instanceof HTMLElement && + ((node as HTMLElement).id === 'reco_list' || + (node as HTMLElement).className === 'recommend-list-container') + ) }).then((ele) => { if (ele) { videoListContainer = ele @@ -158,16 +162,14 @@ if (isPageVideo()) { return } isContextMenuFuncRunning = true + const menu = new ContextMenu() // 监听右键单击 document.addEventListener('contextmenu', (e) => { + menu.hide() if (e.target instanceof HTMLElement) { // debug(e.target.classList) const target = e.target - if ( - isContextMenuUploaderEnable && - target.classList.contains('name') - // target.closest('.upname span.name') === target - ) { + if (isContextMenuUploaderEnable && target.classList.contains('name')) { // 命中UP主 const uploader = target.textContent if (uploader) { @@ -178,15 +180,11 @@ if (isPageVideo()) { const onclickWhite = () => { videoUploaderWhitelistAction.add(uploader) } - contextMenuInstance.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) - contextMenuInstance.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`◎ 屏蔽UP主:${uploader}`, onclickBlack) + menu.registerMenu(`◎ 将UP主加入白名单`, onclickWhite) + menu.show(e.clientX, e.clientY) } - } else if ( - isContextMenuBvidEnable && - target.classList.contains('title') - // target.closest('.info > a > p') === target - ) { + } else if (isContextMenuBvidEnable && target.classList.contains('title')) { // 命中视频标题, 提取bvid const href = target.parentElement?.getAttribute('href') if (href) { @@ -196,18 +194,18 @@ if (isPageVideo()) { const onclick = () => { videoBvidAction.add(bvid) } - contextMenuInstance.registerMenu(`屏蔽视频:${bvid}`, onclick) - contextMenuInstance.show(e.clientX, e.clientY) + menu.registerMenu(`屏蔽视频:${bvid}`, onclick) + menu.show(e.clientX, e.clientY) } } } else { - contextMenuInstance.hide() + menu.hide() } } }) // 监听左键单击,关闭右键菜单 document.addEventListener('click', () => { - contextMenuInstance.hide() + menu.hide() }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/main.ts b/src/main.ts index d28ac1f8..0e22e322 100644 --- a/src/main.ts +++ b/src/main.ts @@ -15,6 +15,7 @@ import { isPageBangumi, isPageChannel, isPageHomepage, + isPagePlaylist, isPagePopular, isPageSearch, isPageVideo, @@ -133,19 +134,19 @@ const main = async () => { createPanelWithMode('rule', RULE_GROUPS) }) // 视频过滤设置 - if (isPageHomepage() || isPageVideo() || isPagePopular() || isPageSearch() || isPageChannel()) { + if (isPageHomepage() || isPageVideo() || isPagePopular() || isPageSearch() || isPageChannel() || isPagePlaylist()) { GM_registerMenuCommand('✅视频过滤设置', () => { createPanelWithMode('videoFilter', VIDEO_FILTER_GROUPS) }) } // 评论过滤设置 - if (isPageVideo() || isPageBangumi()) { + if (isPageVideo() || isPageBangumi() || isPagePlaylist()) { GM_registerMenuCommand('✅评论过滤设置', () => { createPanelWithMode('commentFilter', COMMENT_FILTER_GROUPS) }) } // 视频过滤 快捷按钮 - if (isPageHomepage() || isPageVideo() || isPagePopular() || isPageSearch() || isPageChannel()) { + if (isPageHomepage() || isPageVideo() || isPagePopular() || isPageSearch() || isPageChannel() || isPagePlaylist()) { const videoFilterSideBtnID = 'video-filter-side-btn' const sideBtn = new SideBtn( videoFilterSideBtnID, @@ -169,7 +170,7 @@ const main = async () => { } } // 评论过滤 快捷按钮 - if (isPageVideo() || isPageBangumi()) { + if (isPageVideo() || isPageBangumi() || isPagePlaylist()) { const commentFilterSideBtnID = 'comment-filter-side-btn' const sideBtn = new SideBtn( commentFilterSideBtnID, diff --git a/src/utils/page-type.ts b/src/utils/page-type.ts index 63af2213..83a93106 100644 --- a/src/utils/page-type.ts +++ b/src/utils/page-type.ts @@ -33,7 +33,7 @@ const currPage = (): string => { if (href.includes('bilibili.com/bangumi/play/')) { return 'bangumi' } - if (href.includes('bilibili.com/list/watchlater') || href.includes('bilibili.com/list/ml')) { + if (href.includes('bilibili.com/list/')) { return 'playlist' } // 频道子分类 From 6e70d53322fa65c1a4122f1c83c0d0bea1d7fabe Mon Sep 17 00:00:00 2001 From: festoney8 Date: Thu, 28 Mar 2024 00:51:59 +0800 Subject: [PATCH 6/7] update: contextmenu --- src/filters/commentFilter/pages/video.ts | 3 +++ src/filters/videoFilter/pages/channel.ts | 5 ++++- src/filters/videoFilter/pages/homepage.ts | 5 ++++- src/filters/videoFilter/pages/popular.ts | 5 ++++- src/filters/videoFilter/pages/search.ts | 5 ++++- src/filters/videoFilter/pages/video.ts | 5 ++++- 6 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/filters/commentFilter/pages/video.ts b/src/filters/commentFilter/pages/video.ts index eb1a4525..590b0679 100644 --- a/src/filters/commentFilter/pages/video.ts +++ b/src/filters/commentFilter/pages/video.ts @@ -204,6 +204,9 @@ if (isPageVideo() || isPageBangumi() || isPagePlaylist()) { document.addEventListener('click', () => { menu.hide() }) + document.addEventListener('wheel', () => { + menu.hide() + }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/channel.ts b/src/filters/videoFilter/pages/channel.ts index f18ef239..377c46c8 100644 --- a/src/filters/videoFilter/pages/channel.ts +++ b/src/filters/videoFilter/pages/channel.ts @@ -204,10 +204,13 @@ if (isPageChannel()) { } } }) - // 监听左键单击,关闭右键菜单 + // 关闭右键菜单 document.addEventListener('click', () => { menu.hide() }) + document.addEventListener('wheel', () => { + menu.hide() + }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/homepage.ts b/src/filters/videoFilter/pages/homepage.ts index 66bc0d6d..5b390832 100644 --- a/src/filters/videoFilter/pages/homepage.ts +++ b/src/filters/videoFilter/pages/homepage.ts @@ -238,10 +238,13 @@ if (isPageHomepage()) { } } }) - // 监听左键单击,关闭右键菜单 + // 关闭右键菜单 document.addEventListener('click', () => { menu.hide() }) + document.addEventListener('wheel', () => { + menu.hide() + }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/popular.ts b/src/filters/videoFilter/pages/popular.ts index b3864023..c8ddc5d4 100644 --- a/src/filters/videoFilter/pages/popular.ts +++ b/src/filters/videoFilter/pages/popular.ts @@ -214,10 +214,13 @@ if (isPagePopular()) { } } }) - // 监听左键单击,关闭右键菜单 + // 关闭右键菜单 document.addEventListener('click', () => { menu.hide() }) + document.addEventListener('wheel', () => { + menu.hide() + }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/search.ts b/src/filters/videoFilter/pages/search.ts index 5cd78a8a..b6d15612 100644 --- a/src/filters/videoFilter/pages/search.ts +++ b/src/filters/videoFilter/pages/search.ts @@ -208,10 +208,13 @@ if (isPageSearch()) { } } }) - // 监听左键单击,关闭右键菜单 + // 关闭右键菜单 document.addEventListener('click', () => { menu.hide() }) + document.addEventListener('wheel', () => { + menu.hide() + }) debug('contextMenuFunc listen contextmenu') } diff --git a/src/filters/videoFilter/pages/video.ts b/src/filters/videoFilter/pages/video.ts index 7b8c4770..304d7e0f 100644 --- a/src/filters/videoFilter/pages/video.ts +++ b/src/filters/videoFilter/pages/video.ts @@ -203,10 +203,13 @@ if (isPageVideo() || isPagePlaylist()) { } } }) - // 监听左键单击,关闭右键菜单 + // 关闭右键菜单 document.addEventListener('click', () => { menu.hide() }) + document.addEventListener('wheel', () => { + menu.hide() + }) debug('contextMenuFunc listen contextmenu') } From 6df9d2729da868daf5032c3379a3fd776f049338 Mon Sep 17 00:00:00 2001 From: festoney8 Date: Thu, 28 Mar 2024 01:11:22 +0800 Subject: [PATCH 7/7] update: limit wordlist draggable bar --- src/components/wordlist.ts | 14 ++++++++++++++ src/filters/videoFilter/pages/actions/action.ts | 2 +- src/filters/videoFilter/pages/channel.ts | 8 ++++---- src/filters/videoFilter/pages/homepage.ts | 8 ++++---- src/filters/videoFilter/pages/popular.ts | 8 ++++---- src/filters/videoFilter/pages/search.ts | 8 ++++---- src/filters/videoFilter/pages/video.ts | 8 ++++---- 7 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/components/wordlist.ts b/src/components/wordlist.ts index 72f6f76a..a5465204 100644 --- a/src/components/wordlist.ts +++ b/src/components/wordlist.ts @@ -198,6 +198,20 @@ export class WordList { const diffY = e.clientY - initY wordlist.style.left = `${initLeft + diffX}px` wordlist.style.top = `${initTop + diffY}px` + // 限制bar不超出视口 + const rect = bar.getBoundingClientRect() + if (rect.left < 0) { + wordlist.style.left = `${initLeft + diffX - rect.left}px` + } + if (rect.top < 0) { + wordlist.style.top = `${initTop + diffY - rect.top}px` + } + if (rect.right > window.innerWidth) { + wordlist.style.left = `${initLeft + diffX - (rect.right - window.innerWidth)}px` + } + if (rect.bottom > window.innerHeight) { + wordlist.style.top = `${initTop + diffY - (rect.bottom - window.innerHeight)}px` + } } }) document.addEventListener('mouseup', () => { diff --git a/src/filters/videoFilter/pages/actions/action.ts b/src/filters/videoFilter/pages/actions/action.ts index 92dbd4a5..2c973f3f 100644 --- a/src/filters/videoFilter/pages/actions/action.ts +++ b/src/filters/videoFilter/pages/actions/action.ts @@ -262,7 +262,7 @@ export class UploaderKeywordAction implements VideoFilterAction { // 初始化黑名单, callback触发edit this.blacklist = new WordList( this.valueKey, - '昵称关键词 黑名单', + 'UP主昵称关键词 黑名单', `每行一个关键词,支持正则(iv),语法:/abc|\\d+/`, (values: string[]) => { this.edit(values) diff --git a/src/filters/videoFilter/pages/channel.ts b/src/filters/videoFilter/pages/channel.ts index 377c46c8..2b4c0cf0 100644 --- a/src/filters/videoFilter/pages/channel.ts +++ b/src/filters/videoFilter/pages/channel.ts @@ -286,10 +286,10 @@ if (isPageChannel()) { channelUploaderAction.blacklist.show() }, }), - // 启用 昵称关键词过滤 + // 启用 UP主昵称关键词过滤 new CheckboxItem({ itemID: channelUploaderKeywordAction.statusKey, - description: '启用 昵称关键词过滤', + description: '启用 UP主昵称关键词过滤', itemFunc: () => { channelUploaderKeywordAction.enable() }, @@ -297,10 +297,10 @@ if (isPageChannel()) { channelUploaderKeywordAction.disable() }, }), - // 编辑 昵称关键词黑名单 + // 编辑 UP主昵称关键词黑名单 new ButtonItem({ itemID: 'channel-uploader-keyword-edit-button', - description: '编辑 昵称关键词黑名单', + description: '编辑 UP主昵称关键词黑名单', name: '编辑', itemFunc: () => { channelUploaderKeywordAction.blacklist.show() diff --git a/src/filters/videoFilter/pages/homepage.ts b/src/filters/videoFilter/pages/homepage.ts index 5b390832..2b207b1c 100644 --- a/src/filters/videoFilter/pages/homepage.ts +++ b/src/filters/videoFilter/pages/homepage.ts @@ -320,10 +320,10 @@ if (isPageHomepage()) { homepageUploaderAction.blacklist.show() }, }), - // 启用 昵称关键词过滤 + // 启用 UP主昵称关键词过滤 new CheckboxItem({ itemID: homepageUploaderKeywordAction.statusKey, - description: '启用 昵称关键词过滤', + description: '启用 UP主昵称关键词过滤', itemFunc: () => { homepageUploaderKeywordAction.enable() }, @@ -331,10 +331,10 @@ if (isPageHomepage()) { homepageUploaderKeywordAction.disable() }, }), - // 编辑 昵称关键词黑名单 + // 编辑 UP主昵称关键词黑名单 new ButtonItem({ itemID: 'homepage-uploader-keyword-edit-button', - description: '编辑 昵称关键词黑名单', + description: '编辑 UP主昵称关键词黑名单', name: '编辑', itemFunc: () => { homepageUploaderKeywordAction.blacklist.show() diff --git a/src/filters/videoFilter/pages/popular.ts b/src/filters/videoFilter/pages/popular.ts index c8ddc5d4..a309bf8f 100644 --- a/src/filters/videoFilter/pages/popular.ts +++ b/src/filters/videoFilter/pages/popular.ts @@ -255,10 +255,10 @@ if (isPagePopular()) { popularUploaderAction.blacklist.show() }, }), - // 启用 昵称关键词过滤 + // 启用 UP主昵称关键词过滤 new CheckboxItem({ itemID: popularUploaderKeywordAction.statusKey, - description: '启用 昵称关键词过滤', + description: '启用 UP主昵称关键词过滤', itemFunc: () => { popularUploaderKeywordAction.enable() }, @@ -266,10 +266,10 @@ if (isPagePopular()) { popularUploaderKeywordAction.disable() }, }), - // 编辑 昵称关键词黑名单 + // 编辑 UP主昵称关键词黑名单 new ButtonItem({ itemID: 'popular-uploader-keyword-edit-button', - description: '编辑 昵称关键词黑名单', + description: '编辑 UP主昵称关键词黑名单', name: '编辑', itemFunc: () => { popularUploaderKeywordAction.blacklist.show() diff --git a/src/filters/videoFilter/pages/search.ts b/src/filters/videoFilter/pages/search.ts index b6d15612..17f691f5 100644 --- a/src/filters/videoFilter/pages/search.ts +++ b/src/filters/videoFilter/pages/search.ts @@ -275,10 +275,10 @@ if (isPageSearch()) { searchUploaderAction.blacklist.show() }, }), - // 启用 昵称关键词过滤 + // 启用 UP主昵称关键词过滤 new CheckboxItem({ itemID: searchUploaderKeywordAction.statusKey, - description: '启用 昵称关键词过滤', + description: '启用 UP主昵称关键词过滤', itemFunc: () => { searchUploaderKeywordAction.enable() }, @@ -286,10 +286,10 @@ if (isPageSearch()) { searchUploaderKeywordAction.disable() }, }), - // 编辑 昵称关键词黑名单 + // 编辑 UP主昵称关键词黑名单 new ButtonItem({ itemID: 'search-uploader-keyword-edit-button', - description: '编辑 昵称关键词黑名单', + description: '编辑 UP主昵称关键词黑名单', name: '编辑', itemFunc: () => { searchUploaderKeywordAction.blacklist.show() diff --git a/src/filters/videoFilter/pages/video.ts b/src/filters/videoFilter/pages/video.ts index 304d7e0f..eac57f39 100644 --- a/src/filters/videoFilter/pages/video.ts +++ b/src/filters/videoFilter/pages/video.ts @@ -273,10 +273,10 @@ if (isPageVideo() || isPagePlaylist()) { videoUploaderAction.blacklist.show() }, }), - // 启用 昵称关键词过滤 + // 启用 UP主昵称关键词过滤 new CheckboxItem({ itemID: videoUploaderKeywordAction.statusKey, - description: '启用 昵称关键词过滤', + description: '启用 UP主昵称关键词过滤', itemFunc: () => { videoUploaderKeywordAction.enable() }, @@ -284,10 +284,10 @@ if (isPageVideo() || isPagePlaylist()) { videoUploaderKeywordAction.disable() }, }), - // 编辑 昵称关键词黑名单 + // 编辑 UP主昵称关键词黑名单 new ButtonItem({ itemID: 'video-uploader-keyword-edit-button', - description: '编辑 昵称关键词黑名单', + description: '编辑 UP主昵称关键词黑名单', name: '编辑', itemFunc: () => { videoUploaderKeywordAction.blacklist.show()