Skip to content

Commit

Permalink
update: hide reply dislike btn after delay #95
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Jul 1, 2024
1 parent 53bb63c commit 0ad81a7
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 60 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 3.7.5

- 优化:评论区 踩/回复只在hover时显示,增加延迟减少跳变

## 3.7.4

- 修复:动态页 隐藏动态右侧饰品
Expand Down
21 changes: 0 additions & 21 deletions src/components/wordlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ export class WordList {
GM_setValue(`BILICLEANER_${this.listID}`, this.wordArr)
}
private getValue() {
debug(`key`, `BILICLEANER_${this.listID}`)
this.wordArr = GM_getValue(`BILICLEANER_${this.listID}`, [])
debug(`list ${this.listID} getValue ${this.wordArr.length} lines`)
this.wordSet = new Set(this.wordArr)
}

Expand All @@ -60,25 +58,6 @@ export class WordList {
}
}

// /** 添加多个值到列表 */
// addValues(values: string[]) {
// try {
// this.getValue()
// values.forEach((value) => {
// value = value.trim()
// if (value && !this.wordSet.has(value)) {
// this.wordArr.push(value)
// this.wordSet.add(value)
// }
// })
// this.setValue()
// debug(`list ${this.listID} add ${values.length} lines, OK`)
// } catch (err) {
// error(err)
// error(`list ${this.listID} add ${values.length} lines, ERROR`)
// }
// }

/**
* 编辑整个列表
* @param values 编辑框内输入的列表
Expand Down
36 changes: 24 additions & 12 deletions src/rules/bangumi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1010,27 +1010,39 @@ if (isPageBangumi()) {
itemID: 'video-page-hide-root-reply-dislike-reply-btn',
description: '一级评论 踩/回复 只在hover时显示',
defaultStatus: true,
itemCSS: `.reply-info:not(:has(i.disliked)) .reply-btn,
.reply-info:not(:has(i.disliked)) .reply-dislike {
visibility: hidden;
itemCSS: `
.reply-item:not(:has(i.disliked)) :is(.reply-btn, .reply-dislike) {
opacity: 0;
}
@keyframes appear {
0% {opacity: 0;}
100% {opacity: 1;}
}
.reply-item:hover .reply-info .reply-btn,
.reply-item:hover .reply-info .reply-dislike {
visibility: visible !important;
.reply-item:hover :is(.reply-btn, .reply-dislike) {
animation: appear;
animation-duration: 0.2s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}`,
}),
// 二级评论 踩/回复 只在hover时显示, 默认开启
new CheckboxItem({
itemID: 'video-page-hide-sub-reply-dislike-reply-btn',
description: '二级评论 踩/回复 只在hover时显示',
defaultStatus: true,
itemCSS: `.sub-reply-container .sub-reply-item:not(:has(i.disliked)) .sub-reply-btn,
.sub-reply-container .sub-reply-item:not(:has(i.disliked)) .sub-reply-dislike {
visibility: hidden;
itemCSS: `
.sub-reply-item:not(:has(i.disliked)) :is(.sub-reply-btn, .sub-reply-dislike) {
opacity: 0;
}
@keyframes appear {
0% {opacity: 0;}
100% {opacity: 1;}
}
.sub-reply-container .sub-reply-item:hover .sub-reply-btn,
.sub-reply-container .sub-reply-item:hover .sub-reply-dislike {
visibility: visible !important;
.sub-reply-item:hover :is(.sub-reply-btn, .sub-reply-dislike) {
animation: appear;
animation-duration: 0.2s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}`,
}),
// 隐藏 大表情
Expand Down
36 changes: 24 additions & 12 deletions src/rules/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,27 +624,39 @@ if (isPageDynamic()) {
itemID: 'video-page-hide-root-reply-dislike-reply-btn',
description: '一级评论 踩/回复 只在hover时显示',
defaultStatus: true,
itemCSS: `.reply-info:not(:has(i.disliked)) .reply-btn,
.comment-container .reply-info:not(:has(i.disliked)) .reply-dislike {
visibility: hidden;
itemCSS: `
.reply-item:not(:has(i.disliked)) :is(.reply-btn, .reply-dislike) {
opacity: 0;
}
@keyframes appear {
0% {opacity: 0;}
100% {opacity: 1;}
}
.comment-container .reply-item:hover .reply-btn,
.comment-container .reply-item:hover .reply-dislike {
visibility: visible !important;
.reply-item:hover :is(.reply-btn, .reply-dislike) {
animation: appear;
animation-duration: 0.2s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}`,
}),
// 二级评论 踩/回复 只在hover时显示, 默认开启
new CheckboxItem({
itemID: 'video-page-hide-sub-reply-dislike-reply-btn',
description: '二级评论 踩/回复 只在hover时显示',
defaultStatus: true,
itemCSS: `.sub-reply-item:not(:has(i.disliked)) .sub-reply-btn,
.comment-container .sub-reply-item:not(:has(i.disliked)) .sub-reply-dislike {
visibility: hidden;
itemCSS: `
.sub-reply-item:not(:has(i.disliked)) :is(.sub-reply-btn, .sub-reply-dislike) {
opacity: 0;
}
@keyframes appear {
0% {opacity: 0;}
100% {opacity: 1;}
}
.comment-container .sub-reply-item:hover .sub-reply-btn,
.comment-container .sub-reply-item:hover .sub-reply-dislike {
visibility: visible !important;
.sub-reply-item:hover :is(.sub-reply-btn, .sub-reply-dislike) {
animation: appear;
animation-duration: 0.2s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}`,
}),
// 隐藏 大表情
Expand Down
40 changes: 26 additions & 14 deletions src/rules/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1830,27 +1830,39 @@ if (isPageVideo() || isPagePlaylist()) {
itemID: 'video-page-hide-root-reply-dislike-reply-btn',
description: '一级评论 踩/回复 只在hover时显示',
defaultStatus: true,
itemCSS: `.reply-info:not(:has(i.disliked)) .reply-btn,
.comment-container .reply-info:not(:has(i.disliked)) .reply-dislike {
visibility: hidden;
}
.comment-container .reply-item:hover .reply-btn,
.comment-container .reply-item:hover .reply-dislike {
visibility: visible !important;
itemCSS: `
.reply-item:not(:has(i.disliked)) :is(.reply-btn, .reply-dislike) {
opacity: 0;
}
@keyframes appear {
0% {opacity: 0;}
100% {opacity: 1;}
}
.reply-item:hover :is(.reply-btn, .reply-dislike) {
animation: appear;
animation-duration: 0.2s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}`,
}),
// 二级评论 踩/回复 只在hover时显示, 默认开启
new CheckboxItem({
itemID: 'video-page-hide-sub-reply-dislike-reply-btn',
description: '二级评论 踩/回复 只在hover时显示',
defaultStatus: true,
itemCSS: `.sub-reply-item:not(:has(i.disliked)) .sub-reply-btn,
.comment-container .sub-reply-item:not(:has(i.disliked)) .sub-reply-dislike {
visibility: hidden;
}
.comment-container .sub-reply-item:hover .sub-reply-btn,
.comment-container .sub-reply-item:hover .sub-reply-dislike {
visibility: visible !important;
itemCSS: `
.sub-reply-item:not(:has(i.disliked)) :is(.sub-reply-btn, .sub-reply-dislike) {
opacity: 0;
}
@keyframes appear {
0% {opacity: 0;}
100% {opacity: 1;}
}
.sub-reply-item:hover :is(.sub-reply-btn, .sub-reply-dislike) {
animation: appear;
animation-duration: 0.2s;
animation-delay: 0.3s;
animation-fill-mode: forwards;
}`,
}),
// 隐藏 大表情
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default defineConfig({
userscript: {
name: 'bilibili 页面净化大师',
namespace: 'http://tampermonkey.net/',
version: '3.7.4',
version: '3.7.5',
description:
'净化 B站/哔哩哔哩 页面,支持「精简功能、播放器净化、过滤视频、过滤评论、全站黑白名单」,提供 300+ 功能,定制自己的 B 站',
author: 'festoney8',
Expand Down

0 comments on commit 0ad81a7

Please sign in to comment.