Skip to content

Commit 1a30db5

Browse files
authored
v4.3.12 (#286)
2 parents 348fc21 + 6d274dc commit 1a30db5

11 files changed

Lines changed: 632 additions & 663 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# CHANGELOG
22

3+
## 4.3.12
4+
5+
- 优化:隐藏 banner
6+
- 优化:隐藏 顶栏左侧按钮
7+
- 优化:评论过滤 评论内容预处理
8+
- 修复:隐藏 分区栏
9+
- 新增:评论过滤 过滤只有站内表情的评论
10+
- 更新:部分功能细节
11+
312
## 4.3.11
413

514
- 修复:首页 夜间模式切换问题

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@
1414
"@heroicons/vue": "^2.2.0",
1515
"@vueuse/core": "^12.8.2",
1616
"@vueuse/integrations": "^13.9.0",
17+
"emoji-regex-xs": "^2.0.1",
1718
"p-limit": "^6.2.0",
1819
"pinia": "^2.3.1",
1920
"universal-cookie": "^7.2.2",
20-
"vue": "^3.5.23"
21+
"vue": "^3.5.24"
2122
},
2223
"devDependencies": {
2324
"@eslint/js": "^9.39.1",
2425
"@thedutchcoder/postcss-rem-to-px": "^0.0.2",
2526
"@vitejs/plugin-vue": "^5.2.4",
26-
"autoprefixer": "^10.4.21",
27+
"autoprefixer": "^10.4.22",
2728
"eslint": "^9.39.1",
2829
"eslint-config-prettier": "^9.1.2",
2930
"eslint-plugin-vue": "^9.33.0",
@@ -37,7 +38,7 @@
3738
"stylelint-config-standard-scss": "^14.0.0",
3839
"tailwindcss": "^3.4.18",
3940
"typescript": "^5.9.3",
40-
"typescript-eslint": "^8.46.3",
41+
"typescript-eslint": "^8.46.4",
4142
"vite": "^6.4.1",
4243
"vite-plugin-monkey": "^5.0.9",
4344
"vue-tsc": "^2.2.12"

pnpm-lock.yaml

Lines changed: 315 additions & 306 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/modules/filters/variety/comment/pages/common.ts

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { coreCheck } from '@/modules/filters/core/core'
22
import settings from '@/settings'
3+
import emojiRegex from 'emoji-regex-xs'
34
import { Group } from '@/types/collection'
45
import { ContextMenuTargetHandler, FilterContextMenu, IMainFilter, SelectorResult, SubFilterPair } from '@/types/filter'
56
import { debugFilter as debug, error } from '@/utils/logger'
@@ -17,6 +18,7 @@ import {
1718
CommentCallUserOnlyFilter,
1819
CommentCallUserOnlyNoReplyFilter,
1920
CommentContentFilter,
21+
CommentEmojiOnlyFilter,
2022
CommentLevelFilter,
2123
CommentNoFaceFilter,
2224
CommentUsernameFilter,
@@ -72,6 +74,9 @@ const GM_KEYS = {
7274
isAD: {
7375
statusKey: 'video-comment-ad-filter-status',
7476
},
77+
emojiOnly: {
78+
statusKey: 'video-comment-emoji-only-filter-status',
79+
},
7580
},
7681
white: {
7782
root: {
@@ -103,13 +108,17 @@ const GM_KEYS = {
103108
// https://b23.tv/av1705573085
104109
// https://b23.tv/av1350214762
105110
// https://b23.tv/av113195607985861
111+
const emojiPattern = emojiRegex()
106112
const selectorFns = {
107113
root: {
108114
username: (comment: HTMLElement): SelectorResult => {
109115
return (comment as any).__data?.member?.uname?.trim()
110116
},
111117
content: (comment: HTMLElement): SelectorResult => {
112-
return (comment as any).__data?.content?.message?.replace(/@[^@\s]+/g, ' ').trim()
118+
return (comment as any).__data?.content?.message
119+
?.replace(/@[^@\s]+/g, ' ')
120+
?.replace(/(\[[^[\]]+\])+/g, ' ')
121+
.trim()
113122
},
114123
noface: (comment: HTMLElement): SelectorResult => {
115124
return (
@@ -145,6 +154,15 @@ const selectorFns = {
145154
level: (comment: HTMLElement): SelectorResult => {
146155
return (comment as any).__data?.member?.level_info?.current_level
147156
},
157+
emojiOnly: (comment: HTMLElement): SelectorResult => {
158+
return (
159+
(comment as any).__data?.content?.message
160+
?.replace(/@[^@\s]+/g, ' ')
161+
?.replace(/(\[[^[\]]+\])+/g, ' ')
162+
?.replace(emojiPattern, ' ')
163+
.trim() === ''
164+
)
165+
},
148166
isUp: (comment: HTMLElement): SelectorResult => {
149167
const mid = (comment as any).__data?.mid
150168
const upMid = (comment as any).__upMid
@@ -191,6 +209,7 @@ const selectorFns = {
191209
?.trim()
192210
?.replace(/^\s?@[^@\s]+\s?:/, '')
193211
?.replace(/@[^@\s]+/g, ' ')
212+
?.replace(/(\[[^[\]]+\])+/g, ' ')
194213
.trim()
195214
},
196215
noface: (comment: HTMLElement): SelectorResult => {
@@ -239,6 +258,16 @@ const selectorFns = {
239258
level: (comment: HTMLElement): SelectorResult => {
240259
return (comment as any).__data?.member?.level_info?.current_level
241260
},
261+
emojiOnly: (comment: HTMLElement): SelectorResult => {
262+
return (
263+
(comment as any).__data?.content?.message
264+
?.replace(/^\s?@[^@\s]+\s?:/, '')
265+
?.replace(/@[^@\s]+/g, ' ')
266+
?.replace(/(\[[^[\]]+\])+/g, ' ')
267+
?.replace(emojiPattern, ' ')
268+
.trim() === ''
269+
)
270+
},
242271
isUp: (comment: HTMLElement): SelectorResult => {
243272
const mid = (comment as any).__data?.mid
244273
const upMid = (comment as any).__upMid
@@ -295,6 +324,7 @@ class CommentFilterCommon implements IMainFilter {
295324
commentCallUserNoReplyFilter = new CommentCallUserNoReplyFilter()
296325
commentCallUserOnlyFilter = new CommentCallUserOnlyFilter()
297326
commentCallUserOnlyNoReplyFilter = new CommentCallUserOnlyNoReplyFilter()
327+
commentEmojiOnlyFilter = new CommentEmojiOnlyFilter()
298328
// 白名单
299329
commentIsUpFilter = new CommentIsUpFilter()
300330
commentIsPinFilter = new CommentIsPinFilter()
@@ -333,7 +363,8 @@ class CommentFilterCommon implements IMainFilter {
333363
this.commentCallUserFilter.isEnable ||
334364
this.commentCallUserNoReplyFilter.isEnable ||
335365
this.commentCallUserOnlyFilter.isEnable ||
336-
this.commentCallUserOnlyNoReplyFilter.isEnable
366+
this.commentCallUserOnlyNoReplyFilter.isEnable ||
367+
this.commentEmojiOnlyFilter.isEnable
337368
)
338369
) {
339370
revertAll = true
@@ -370,6 +401,7 @@ class CommentFilterCommon implements IMainFilter {
370401
`isNote: ${selectorFns.root.isNote(v)}`,
371402
`isLink: ${selectorFns.root.isLink(v)}`,
372403
`isMe: ${selectorFns.root.isMe(v)}`,
404+
`emojiOnly: ${selectorFns.root.emojiOnly(v)}`,
373405
].join('\n'),
374406
)
375407
})
@@ -396,6 +428,8 @@ class CommentFilterCommon implements IMainFilter {
396428
blackPairs.push([this.commentCallUserOnlyFilter, selectorFns.root.callUserOnly])
397429
this.commentCallUserOnlyNoReplyFilter.isEnable &&
398430
blackPairs.push([this.commentCallUserOnlyNoReplyFilter, selectorFns.root.callUserOnlyNoReply])
431+
this.commentEmojiOnlyFilter.isEnable &&
432+
blackPairs.push([this.commentEmojiOnlyFilter, selectorFns.root.emojiOnly])
399433

400434
const whitePairs: SubFilterPair[] = []
401435
this.commentIsUpFilter.isEnable && whitePairs.push([this.commentIsUpFilter, selectorFns.root.isUp])
@@ -435,7 +469,8 @@ class CommentFilterCommon implements IMainFilter {
435469
this.commentCallUserFilter.isEnable ||
436470
this.commentCallUserNoReplyFilter.isEnable ||
437471
this.commentCallUserOnlyFilter.isEnable ||
438-
this.commentCallUserOnlyNoReplyFilter.isEnable
472+
this.commentCallUserOnlyNoReplyFilter.isEnable ||
473+
this.commentEmojiOnlyFilter.isEnable
439474
)
440475
) {
441476
revertAll = true
@@ -470,6 +505,7 @@ class CommentFilterCommon implements IMainFilter {
470505
`isUp: ${selectorFns.sub.isUp(v)}`,
471506
`isLink: ${selectorFns.sub.isLink(v)}`,
472507
`isMe: ${selectorFns.sub.isMe(v)}`,
508+
`emojiOnly: ${selectorFns.sub.emojiOnly(v)}`,
473509
].join('\n'),
474510
)
475511
})
@@ -496,6 +532,8 @@ class CommentFilterCommon implements IMainFilter {
496532
blackPairs.push([this.commentCallUserOnlyFilter, selectorFns.sub.callUserOnly])
497533
this.commentCallUserOnlyNoReplyFilter.isEnable &&
498534
blackPairs.push([this.commentCallUserOnlyNoReplyFilter, selectorFns.sub.callUserOnlyNoReply])
535+
this.commentEmojiOnlyFilter.isEnable &&
536+
blackPairs.push([this.commentEmojiOnlyFilter, selectorFns.sub.emojiOnly])
499537

500538
const whitePairs: SubFilterPair[] = []
501539
this.commentIsUpFilter.isEnable && whitePairs.push([this.commentIsUpFilter, selectorFns.sub.isUp])
@@ -693,7 +731,7 @@ export const commentFilterCommonGroups: Group[] = [
693731
{
694732
type: 'switch',
695733
id: GM_KEYS.black.isAD.statusKey,
696-
name: '过滤 带货评论 (实验功能)',
734+
name: '过滤 带货评论',
697735
noStyle: true,
698736
enableFn: () => {
699737
mainFilter.commentAdFilter.enable()
@@ -704,6 +742,20 @@ export const commentFilterCommonGroups: Group[] = [
704742
mainFilter.check('full')
705743
},
706744
},
745+
{
746+
type: 'switch',
747+
id: GM_KEYS.black.emojiOnly.statusKey,
748+
name: '过滤 只有表情的评论',
749+
noStyle: true,
750+
enableFn: () => {
751+
mainFilter.commentEmojiOnlyFilter.enable()
752+
mainFilter.check('full')
753+
},
754+
disableFn: () => {
755+
mainFilter.commentEmojiOnlyFilter.disable()
756+
mainFilter.check('full')
757+
},
758+
},
707759
{
708760
type: 'switch',
709761
id: GM_KEYS.black.noface.statusKey,

src/modules/filters/variety/comment/subFilters/black.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ export class CommentCallUserNoReplyFilter extends BooleanFilter {}
2626
export class CommentCallUserOnlyFilter extends BooleanFilter {}
2727

2828
export class CommentCallUserOnlyNoReplyFilter extends BooleanFilter {}
29+
30+
export class CommentEmojiOnlyFilter extends BooleanFilter {}

src/modules/rules/channel/groups/basic.scss

Lines changed: 67 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,83 @@
11
// 隐藏 横幅banner
22
html[homepage-hide-banner] {
3-
.bili-header__banner {
4-
min-height: unset !important;
5-
height: 64px !important;
6-
background: var(--bg1) !important;
7-
}
8-
.bili-header__banner > * {
9-
display: none !important;
10-
}
11-
.bili-header__bar {
12-
box-shadow: 0 2px 4px rgb(128 128 128 / 0.15) !important;
13-
}
14-
15-
// 背景色
16-
html {
17-
background-color: var(--bg1);
18-
}
19-
20-
// icon和文字颜色
21-
.bili-header .right-entry__outside .right-entry-icon {
22-
color: var(--text1, #18191c) !important;
23-
}
24-
.bili-header .left-entry .entry-title,
25-
.bili-header .left-entry .download-entry,
26-
.bili-header .left-entry .default-entry,
27-
.bili-header .left-entry .loc-entry {
28-
color: var(--text1, #18191c) !important;
29-
}
30-
.bili-header .left-entry .entry-title .zhuzhan-icon {
31-
color: #00aeec !important;
32-
}
33-
.bili-header .right-entry__outside .right-entry-text {
34-
color: var(--text2, #61666d) !important;
35-
}
36-
37-
// header高度
383
#biliMainHeader {
394
min-height: unset !important;
40-
}
41-
42-
// 分区菜单 第一排按钮的二级菜单下置
43-
.v-popover.is-top {
44-
padding-top: 5px;
45-
padding-bottom: unset !important;
46-
bottom: unset !important;
47-
}
48-
@media (width >= 2200px) {
49-
.v-popover.is-top {
50-
top: 32px;
51-
}
52-
}
53-
@media (width >= 1701px) and (width <= 2199.9px) {
54-
.v-popover.is-top {
55-
top: 32px;
56-
}
57-
}
58-
@media (width >= 1367px) and (width <= 1700.9px) {
59-
.v-popover.is-top {
60-
top: 28px;
61-
}
62-
}
63-
@media (width >= 1100px) and (width <= 1366.9px) {
64-
.v-popover.is-top {
65-
top: 28px;
5+
.bili-header {
6+
.bili-header__bar {
7+
// 兼容顶栏不吸附,不得使用 important
8+
position: fixed;
9+
transition: unset !important;
10+
background: var(--bg1, white) !important;
11+
box-shadow: 0 2px 4px rgb(128 128 128 / 0.15) !important;
12+
&.slide-down {
13+
animation: none !important;
14+
box-shadow: 0 2px 4px rgb(128 128 128 / 0.15) !important;
15+
}
16+
.left-entry {
17+
:is(.entry-title, .download-entry, .default-entry, .loc-entry) {
18+
color: var(--text1, #18191c) !important;
19+
}
20+
.zhuzhan-icon {
21+
color: #00aeec !important;
22+
}
23+
}
24+
.right-entry .right-entry__outside {
25+
.right-entry-icon {
26+
color: var(--text1, #18191c) !important;
27+
}
28+
.right-entry-text {
29+
color: var(--text2, #61666d) !important;
30+
}
31+
}
32+
}
33+
.bili-header__banner {
34+
min-height: unset !important;
35+
height: 64px !important;
36+
background: var(--bg1, white) !important;
37+
& > * {
38+
display: none !important;
39+
}
40+
}
6641
}
6742
}
68-
@media (width <= 1099.9px) {
69-
.v-popover.is-top {
70-
top: 24px;
43+
}
44+
45+
// 隐藏 滚动页面时 顶部吸附 顶栏
46+
html[channel-hide-sticky-header] {
47+
.bili-header {
48+
.bili-header__bar {
49+
position: absolute !important;
50+
background: transparent;
51+
transition: none !important;
52+
&.slide-down {
53+
box-shadow: none !important;
54+
animation: none !important;
55+
}
56+
.left-entry {
57+
:is(.entry-title, .download-entry, .default-entry, .loc-entry, .zhuzhan-icon) {
58+
color: white;
59+
}
60+
}
61+
.right-entry .right-entry__outside {
62+
.right-entry-icon,
63+
.right-entry-text {
64+
color: white;
65+
}
66+
}
7167
}
7268
}
7369
}
7470

75-
// 隐藏 全站分区栏
71+
// 隐藏 分区栏
7672
html[channel-hide-subarea] {
7773
#biliMainHeader {
78-
min-height: unset !important;
74+
height: fit-content !important;
75+
min-height: fit-content !important;
7976
margin-bottom: 20px !important;
80-
.bili-header__channel {
81-
display: none !important;
77+
.bili-header {
78+
.bili-header__channel {
79+
display: none !important;
80+
}
8281
}
8382
}
8483
}
@@ -94,13 +93,6 @@ html[channel-hide-carousel] {
9493
}
9594
}
9695

97-
// 隐藏 滚动页面时 顶部吸附 顶栏
98-
html[channel-hide-sticky-header] {
99-
.bili-header__bar.slide-down {
100-
display: none !important;
101-
}
102-
}
103-
10496
// 恢复 原始动态按钮
10597
html[homepage-revert-channel-dynamic-icon] {
10698
.bili-header__channel .channel-icons .icon-bg__dynamic {

0 commit comments

Comments
 (0)