Skip to content

Commit

Permalink
feat: header item about watchlater, url support watchlater
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Jan 2, 2024
1 parent 0be2d42 commit 985bec5
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@

## 2.2.2

- 新增:顶栏 稍后再看相关选项
- 新增:评论区规则适配稍后再看页面、收藏夹页面
- 优化:首页 隐藏下载桌面端弹窗 改为默认开启
- 优化:全屏下隐藏弹幕输入框,完整展示章节名
- 优化:用户开启开关时执行功能函数
- 修复:视频列表增加高度

## 2.2.1

Expand Down
63 changes: 59 additions & 4 deletions src/pages/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,12 @@ if (host === 't.bilibili.com') {
border-radius: 3px !important;
}`
} else {
if (href.startsWith('https://www.bilibili.com/video/')) {
// 普通播放页, 稍后再看播放页, 收藏夹播放页
if (
href.includes('bilibili.com/video/') ||
href.includes('bilibili.com/list/watchlater') ||
href.includes('bilibili.com/list/ml')
) {
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
Expand Down Expand Up @@ -207,7 +212,7 @@ if (host === 't.bilibili.com') {
.bpx-player-dm-btn-send .bui-button {
border-radius: 3px 0 0 3px !important;
}`
} else if (href.startsWith('https://www.bilibili.com/bangumi/play/')) {
} else if (href.includes('bilibili.com/bangumi/play/')) {
borderRadiusCSS = `
a[class^="mediainfo_mediaCover"],
a[class^="mediainfo_btnHome"],
Expand Down Expand Up @@ -698,11 +703,11 @@ if (location.host != 'live.bilibili.com') {
}`,
),
)
// 隐藏 收藏
// 隐藏 收藏, 隐藏 稍后再看
headerRightItems.push(
new NormalItem(
'common-hide-nav-favorite',
'隐藏 收藏/稍后再看',
'隐藏 收藏, 隐藏 稍后再看',
false,
undefined,
false,
Expand All @@ -715,6 +720,56 @@ if (location.host != 'live.bilibili.com') {
}`,
),
)
// 隐藏 收藏, 显示 稍后再看(实验性)
headerRightItems.push(
new NormalItem(
'common-hide-nav-favorite-keep-watchlater',
'隐藏 收藏, 保留 稍后再看(实验性)',
false,
undefined,
false,
`
/* 移除加入稍后再看时的上翻动画 */
.right-entry .v-popover-wrap .header-favorite-container-box {
animation: unset !important;
}
.right-entry .v-popover-wrap .header-favorite-container-box .header-favorite-container__up {
display: none !important;
}
.right-entry .v-popover-wrap .header-favorite-container-box .header-favorite-container__down {
margin-top: 4px !important;
}
@media (max-width: 1279.9px) {
.right-entry .v-popover-wrap .header-favorite-container-box .header-favorite-container__down {
top: 10px;
}
}`,
),
)
// 显示 收藏, 显示 稍后再看(实验性)
headerRightItems.push(
new NormalItem(
'common-nav-keep-watchlater',
'显示 收藏, 显示 稍后再看(实验性)',
false,
undefined,
false,
`
/* 移除加入稍后再看时的上翻动画 */
.right-entry .v-popover-wrap .header-favorite-container-box {
display: flex !important;
animation: unset !important;
}
.right-entry .v-popover-wrap .header-favorite-container-box .header-favorite-container__down {
margin-top: 0 !important;
}
@media (max-width: 1279.9px) {
.right-entry .v-popover-wrap .header-favorite-container-box .header-favorite-container__down {
top: 15px;
}
}`,
),
)
// 隐藏 历史
headerRightItems.push(
new NormalItem(
Expand Down
82 changes: 44 additions & 38 deletions src/pages/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function bv2av() {
}
}

/** 净化分享按钮功能 */
/** 净化分享按钮功能, 暂不支持从稍后再看列表、收藏夹列表分享 */
let isSimpleShareBtn = false
function simpleShare() {
if (isSimpleShareBtn) {
Expand Down Expand Up @@ -102,7 +102,13 @@ const sidebarItems: NormalItem[] = []
// GroupList
const videoGroupList: Group[] = []

if (location.href.startsWith('https://www.bilibili.com/video/')) {
// 普通播放页,稍后再看播放页,收藏夹播放页
const href = location.href
if (
href.includes('bilibili.com/video/') ||
href.includes('bilibili.com/list/watchlater') ||
href.includes('bilibili.com/list/ml')
) {
// 基本功能part, basicItems
{
// BV号转AV号, 在url变化时需重载
Expand Down Expand Up @@ -1085,7 +1091,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
true,
undefined,
false,
`#comment .reply-header .reply-notice {display: none !important;}`,
`.comment-container .reply-header .reply-notice {display: none !important;}`,
),
)
// 隐藏 整个评论框
Expand All @@ -1097,8 +1103,8 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
undefined,
false,
// 不可使用display: none, 会使底部吸附评论框宽度变化
`#comment .main-reply-box {height: 0 !important; visibility: hidden !important;}
#comment .reply-list {margin-top: -20px !important;}`,
`.comment-container .main-reply-box {height: 0 !important; visibility: hidden !important;}
.comment-container .reply-list {margin-top: -20px !important;}`,
),
)
// 隐藏 页面底部 吸附评论框, 默认开启
Expand All @@ -1109,7 +1115,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
true,
undefined,
false,
`#comment .fixed-reply-box {display: none !important;}`,
`.comment-container .fixed-reply-box {display: none !important;}`,
),
)
// 隐藏 评论编辑器内占位文字, 默认开启
Expand All @@ -1132,7 +1138,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-decorate {display: none !important;}`,
`.comment-container .reply-decorate {display: none !important;}`,
),
)
// 隐藏 ID后粉丝牌
Expand All @@ -1143,7 +1149,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .fan-badge {display: none !important;}`,
`.comment-container .fan-badge {display: none !important;}`,
),
)
// 隐藏 一级评论用户等级
Expand All @@ -1154,7 +1160,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .user-level {display: none !important;}`,
`.comment-container .user-level {display: none !important;}`,
),
)
// 隐藏 二级评论用户等级
Expand All @@ -1165,7 +1171,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .sub-user-level {display: none !important;}`,
`.comment-container .sub-user-level {display: none !important;}`,
),
)
// 隐藏 用户头像外圈饰品
Expand All @@ -1176,8 +1182,8 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .root-reply-avatar .bili-avatar-pendent-dom {display: none !important;}
#comment .root-reply-avatar .bili-avatar {width: 48px !important; height:48px !important;}`,
`.comment-container .root-reply-avatar .bili-avatar-pendent-dom {display: none !important;}
.comment-container .root-reply-avatar .bili-avatar {width: 48px !important; height:48px !important;}`,
),
)
// 隐藏 用户头像右下小icon
Expand All @@ -1188,8 +1194,8 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .bili-avatar-nft-icon {display: none !important;}
#comment .bili-avatar-icon {display: none !important;}`,
`.comment-container .bili-avatar-nft-icon {display: none !important;}
.comment-container .bili-avatar-icon {display: none !important;}`,
),
)
// 隐藏 评论内容下tag(UP觉得很赞)
Expand All @@ -1200,7 +1206,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-tag-list {display: none !important;}`,
`.comment-container .reply-tag-list {display: none !important;}`,
),
)
// 隐藏 笔记评论前的小Logo, 默认开启
Expand All @@ -1211,7 +1217,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
true,
undefined,
false,
`#comment .note-prefix {display: none !important;}`,
`.comment-container .note-prefix {display: none !important;}`,
),
)
// 隐藏 评论内容搜索关键词高亮, 默认开启
Expand All @@ -1222,9 +1228,9 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
true,
undefined,
false,
`#comment .reply-content .jump-link.search-word {color: inherit !important;}
#comment .reply-content .jump-link.search-word:hover {color: #008AC5 !important;}
#comment .reply-content .icon.search-word {display: none !important;}`,
`.comment-container .reply-content .jump-link.search-word {color: inherit !important;}
.comment-container .reply-content .jump-link.search-word:hover {color: #008AC5 !important;}
.comment-container .reply-content .icon.search-word {display: none !important;}`,
),
)
// 隐藏 二级评论中的@高亮
Expand All @@ -1235,8 +1241,8 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .sub-reply-container .reply-content .jump-link.user {color: inherit !important;}
#comment .sub-reply-container .reply-content .jump-link.user:hover {color: #40C5F1 !important;}`,
`.comment-container .sub-reply-container .reply-content .jump-link.user {color: inherit !important;}
.comment-container .sub-reply-container .reply-content .jump-link.user:hover {color: #40C5F1 !important;}`,
),
)
// 隐藏 召唤AI机器人的评论, 默认开启
Expand Down Expand Up @@ -1285,7 +1291,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-item:has(.root-reply .jump-link.user):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
`.comment-container .reply-item:has(.root-reply .jump-link.user):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
),
)
// 隐藏 包含@的 全部评论
Expand All @@ -1296,7 +1302,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-item:has(.root-reply .jump-link.user):not(:has(.sub-up-icon)) {display: none !important;}`,
`.comment-container .reply-item:has(.root-reply .jump-link.user):not(:has(.sub-up-icon)) {display: none !important;}`,
),
)
// 隐藏 LV1 无人点赞评论
Expand All @@ -1307,7 +1313,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-item:has(.st1.lv1):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
`.comment-container .reply-item:has(.st1.lv1):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
),
)
// 隐藏 LV2 无人点赞评论
Expand All @@ -1318,7 +1324,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-item:has(.st1.lv2):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
`.comment-container .reply-item:has(.st1.lv2):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
),
)
// 隐藏 LV3 无人点赞评论
Expand All @@ -1329,7 +1335,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-item:has(.st1.lv3):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
`.comment-container .reply-item:has(.st1.lv3):not(:has(.sub-up-icon, .reply-info .reply-like span)) {display: none !important;}`,
),
)
// 隐藏 一级评论 踩/回复/举报 hover时显示, 默认开启
Expand All @@ -1340,12 +1346,12 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
true,
undefined,
false,
`#comment .reply-info:not(:has(i.disliked)) .reply-btn,
#comment .reply-info:not(:has(i.disliked)) .reply-dislike {
`.comment-container .reply-info:not(:has(i.disliked)) .reply-btn,
.comment-container .reply-info:not(:has(i.disliked)) .reply-dislike {
visibility: hidden;
}
#comment .reply-item:hover .reply-btn,
#comment .reply-item:hover .reply-dislike {
.comment-container .reply-item:hover .reply-btn,
.comment-container .reply-item:hover .reply-dislike {
visibility: visible !important;
}`,
),
Expand All @@ -1358,12 +1364,12 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
true,
undefined,
false,
`#comment .sub-reply-item:not(:has(i.disliked)) .sub-reply-btn,
#comment .sub-reply-item:not(:has(i.disliked)) .sub-reply-dislike {
`.comment-container .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 .sub-reply-item:hover .sub-reply-btn,
#comment .sub-reply-item:hover .sub-reply-dislike {
.comment-container .sub-reply-item:hover .sub-reply-btn,
.comment-container .sub-reply-item:hover .sub-reply-dislike {
visibility: visible !important;
}`,
),
Expand All @@ -1376,7 +1382,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .emoji-large {display: none !important;}`,
`.comment-container .emoji-large {display: none !important;}`,
),
)
// 大表情变成小表情
Expand All @@ -1387,7 +1393,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .emoji-large {zoom: .5;}`,
`.comment-container .emoji-large {zoom: .5;}`,
),
)
// 用户名 全部大会员色
Expand All @@ -1398,7 +1404,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-item .user-name, #comment .reply-item .sub-user-name {color: #FB7299 !important;}}`,
`.comment-container .reply-item .user-name, .comment-container .reply-item .sub-user-name {color: #FB7299 !important;}}`,
),
)
// 用户名 全部恢复默认色
Expand All @@ -1409,7 +1415,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
undefined,
false,
`#comment .reply-item .user-name, #comment .reply-item .sub-user-name {color: #61666d !important;}}`,
`.comment-container .reply-item .user-name, .comment-container .reply-item .sub-user-name {color: #61666d !important;}}`,
),
)
// 笔记图片 查看大图优化, 默认开启
Expand Down

0 comments on commit 985bec5

Please sign in to comment.