Skip to content

Commit

Permalink
feat: live page hide search history and trending, update item order
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Dec 30, 2023
1 parent 1130672 commit 4c29550
Show file tree
Hide file tree
Showing 5 changed files with 239 additions and 205 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# CHANGELOG

## 2.2.0
## 2.1.1

- 新增:全局功能开关快捷键 `Alt+B``Ctrl+Alt+B`,Firefox 浏览器只支持 `Ctrl+Alt+B`
- 新增:直播页 隐藏搜索历史、热搜
- 新增:动态页 隐藏视频警告
- 优化:直播页 页面直角化
- 优化:部分CSS细节
- 优化:选项顺序

## 2.1.0

Expand Down
316 changes: 157 additions & 159 deletions src/pages/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,51 +74,6 @@ const cleanURL = () => {

const commonItems: (NormalItem | SeparatorItem)[] = []

// URL参数净化, 在urlchange时需重载, 默认开启
// 以前会出现URL缺少参数导致充电窗口载入失败报错NaN的bug, 现无法复现, 猜测已修复
commonItems.push(new NormalItem('url-cleaner', 'URL参数净化 (需刷新)', true, cleanURL, true, null))

// 滚动条美化, 默认开启
commonItems.push(
new NormalItem(
'beauty-scrollbar',
'美化页面滚动条',
true,
undefined,
false,
`
/* WebKit */
::-webkit-scrollbar {
width: 8px !important;
height: 8px !important;
background: transparent !important;
}
::-webkit-scrollbar:hover {
background: rgba(128, 128, 128, 0.4) !important;
}
::-webkit-scrollbar-thumb {
border: 1px solid rgba(255, 255, 255, 0.4) !important;
background-color: rgba(0, 0, 0, 0.4) !important;
z-index: 2147483647;
-webkit-border-radius: 8px !important;
background-clip: content-box !important;
}
::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.8) !important;
}
::-webkit-scrollbar-thumb:active {
background-color: rgba(0, 0, 0, 0.6) !important;
}
/* Firefox */
* {
scrollbar-color: rgba(0, 0, 0, 0.6) transparent !important;
scrollbar-width: thin !important;
}
`,
),
)

// 通用 页面直角化,去除圆角,根据URL选取CSS
let borderRadiusCSS: myCSS = ''
const host = location.host
Expand Down Expand Up @@ -159,8 +114,7 @@ if (host === 't.bilibili.com') {
.bili-dyn-card-video__body {
border-radius: 0 3px 3px 0 !important;
}`
}
if (host === 'live.bilibili.com') {
} else if (host === 'live.bilibili.com') {
borderRadiusCSS = `
#nav-searchform,
#player-ctnr,
Expand Down Expand Up @@ -198,8 +152,7 @@ if (host === 'live.bilibili.com') {
#rank-list-ctnr-box.bgStyle {
border-radius: 3px 0 0 3px !important;
}`
}
if (host === 'search.bilibili.com') {
} else if (host === 'search.bilibili.com') {
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
Expand All @@ -215,123 +168,168 @@ if (host === 'search.bilibili.com') {
.bili-video-card__cover {
border-radius: 3px !important;
}`
} else {
if (href.startsWith('https://www.bilibili.com/video/')) {
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
.v-popover-content,
.van-popover,
.v-popover,
.pic-box,
.card-box .pic-box .pic,
.bui-collapse-header,
.base-video-sections-v1,
.bili-header .search-panel,
.bili-header .header-upload-entry,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar,
.video-tag-container .tag-panel .tag-link,
.video-tag-container .tag-panel .show-more-btn,
.vcd .cover img,
.vcd *,
.upinfo-btn-panel *,
.fixed-sidenav-storage div,
.fixed-sidenav-storage a,
.reply-box-textarea,
.reply-box-send,
.reply-box-send:after {
border-radius: 3px !important;
}
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar .bpx-player-dm-btn-send,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar-wrap {
border-radius: 0 3px 3px 0 !important;
}
.bpx-player-dm-btn-send .bui-button {
border-radius: 3px 0 0 3px !important;
}`
} else if (href.startsWith('https://www.bilibili.com/bangumi/play/')) {
borderRadiusCSS = `
a[class^="mediainfo_mediaCover"],
a[class^="mediainfo_btnHome"],
[class^="follow_btnFollow"],
[class^="vipPaybar_textWrap__QARKv"],
[class^="eplist_ep_list_wrapper"],
[class^="RecommendItem_cover"],
[class^="imageListItem_wrap"] [class^="imageListItem_coverWrap"],
[class^="navTools_navMenu"] > *,
[class^="navTools_item"],
#nav-searchform,
.nav-search-content,
.v-popover-content,
.van-popover,
.v-popover,
.pic-box,
.card-box .pic-box .pic,
.bui-collapse-header,
.base-video-sections-v1,
.bili-header .search-panel,
.bili-header .header-upload-entry,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar,
.video-tag-container .tag-panel .tag-link,
.video-tag-container .tag-panel .show-more-btn,
.vcd .cover img,
.vcd *,
.upinfo-btn-panel *,
.fixed-sidenav-storage div,
.reply-box-textarea,
.reply-box-send,
.reply-box-send:after {
border-radius: 3px !important;
}
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar .bpx-player-dm-btn-send,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar-wrap {
border-radius: 0 3px 3px 0 !important;
}
.bpx-player-dm-btn-send .bui-button {
border-radius: 3px 0 0 3px !important;
}`
} else if (href.startsWith('https://www.bilibili.com/') && ['/index.html', '/'].includes(location.pathname)) {
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
.history-item,
.header-upload-entry,
.bili-header .search-panel,
.bili-header .header-upload-entry,
.bili-header__channel .channel-link,
.channel-entry-more__link,
.header-channel-fixed-right-item,
.recommended-swipe-body,
.bili-video-card .bili-video-card__cover,
.bili-video-card .bili-video-card__image,
.bili-video-card .bili-video-card__info--icon-text,
.bili-live-card,
.floor-card,
.floor-card .badge,
.single-card.floor-card .floor-card-inner,
.single-card.floor-card .cover-container,
.primary-btn,
.flexible-roll-btn,
.palette-button-wrap .flexible-roll-btn-inner,
.palette-button-wrap .storage-box,
.palette-button-wrap,
.v-popover-content {
border-radius: 3px !important;
}
.bili-video-card__stats {
border-bottom-left-radius: 3px !important;
border-bottom-right-radius: 3px !important;
}
.floor-card .layer {
display: none !important;
}
.single-card.floor-card {
border: none !important;
}`
}
}
if (href.startsWith('https://www.bilibili.com/video/')) {
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
.v-popover-content,
.van-popover,
.v-popover,
.pic-box,
.card-box .pic-box .pic,
.bui-collapse-header,
.base-video-sections-v1,
.bili-header .search-panel,
.bili-header .header-upload-entry,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar,
.video-tag-container .tag-panel .tag-link,
.video-tag-container .tag-panel .show-more-btn,
.vcd .cover img,
.vcd *,
.upinfo-btn-panel *,
.fixed-sidenav-storage div,
.fixed-sidenav-storage a,
.reply-box-textarea,
.reply-box-send,
.reply-box-send:after {
border-radius: 3px !important;
}
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar .bpx-player-dm-btn-send,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar-wrap {
border-radius: 0 3px 3px 0 !important;

commonItems.push(new NormalItem('border-radius', '页面直角化,去除圆角', true, undefined, false, borderRadiusCSS))

// 滚动条美化, 默认开启
commonItems.push(
new NormalItem(
'beauty-scrollbar',
'美化页面滚动条',
true,
undefined,
false,
`
/* WebKit */
::-webkit-scrollbar {
width: 8px !important;
height: 8px !important;
background: transparent !important;
}
.bpx-player-dm-btn-send .bui-button {
border-radius: 3px 0 0 3px !important;
}`
}
if (href.startsWith('https://www.bilibili.com/bangumi/play/')) {
borderRadiusCSS = `
a[class^="mediainfo_mediaCover"],
a[class^="mediainfo_btnHome"],
[class^="follow_btnFollow"],
[class^="vipPaybar_textWrap__QARKv"],
[class^="eplist_ep_list_wrapper"],
[class^="RecommendItem_cover"],
[class^="imageListItem_wrap"] [class^="imageListItem_coverWrap"],
[class^="navTools_navMenu"] > *,
[class^="navTools_item"],
#nav-searchform,
.nav-search-content,
.v-popover-content,
.van-popover,
.v-popover,
.pic-box,
.card-box .pic-box .pic,
.bui-collapse-header,
.base-video-sections-v1,
.bili-header .search-panel,
.bili-header .header-upload-entry,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar,
.video-tag-container .tag-panel .tag-link,
.video-tag-container .tag-panel .show-more-btn,
.vcd .cover img,
.vcd *,
.upinfo-btn-panel *,
.fixed-sidenav-storage div,
.reply-box-textarea,
.reply-box-send,
.reply-box-send:after {
border-radius: 3px !important;
::-webkit-scrollbar:hover {
background: rgba(128, 128, 128, 0.4) !important;
}
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar .bpx-player-dm-btn-send,
.bpx-player-container .bpx-player-sending-bar .bpx-player-video-inputbar-wrap {
border-radius: 0 3px 3px 0 !important;
::-webkit-scrollbar-thumb {
border: 1px solid rgba(255, 255, 255, 0.4) !important;
background-color: rgba(0, 0, 0, 0.4) !important;
z-index: 2147483647;
-webkit-border-radius: 8px !important;
background-clip: content-box !important;
}
.bpx-player-dm-btn-send .bui-button {
border-radius: 3px 0 0 3px !important;
}`
}
if (href.startsWith('https://www.bilibili.com/') && ['/index.html', '/'].includes(location.pathname)) {
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
.history-item,
.header-upload-entry,
.bili-header .search-panel,
.bili-header .header-upload-entry,
.bili-header__channel .channel-link,
.channel-entry-more__link,
.header-channel-fixed-right-item,
.recommended-swipe-body,
.bili-video-card .bili-video-card__cover,
.bili-video-card .bili-video-card__image,
.bili-video-card .bili-video-card__info--icon-text,
.bili-live-card,
.floor-card,
.floor-card .badge,
.single-card.floor-card .floor-card-inner,
.single-card.floor-card .cover-container,
.primary-btn,
.flexible-roll-btn,
.palette-button-wrap .flexible-roll-btn-inner,
.palette-button-wrap .storage-box,
.palette-button-wrap,
.v-popover-content {
border-radius: 3px !important;
::-webkit-scrollbar-thumb:hover {
background-color: rgba(0, 0, 0, 0.8) !important;
}
.bili-video-card__stats {
border-bottom-left-radius: 3px !important;
border-bottom-right-radius: 3px !important;
::-webkit-scrollbar-thumb:active {
background-color: rgba(0, 0, 0, 0.6) !important;
}
.floor-card .layer {
display: none !important;
/* Firefox */
* {
scrollbar-color: rgba(0, 0, 0, 0.6) transparent !important;
scrollbar-width: thin !important;
}
.single-card.floor-card {
border: none !important;
}`
}
commonItems.push(new NormalItem('border-radius', '页面直角化,去除圆角', true, undefined, false, borderRadiusCSS))
`,
),
)

// URL参数净化, 在urlchange时需重载, 默认开启
// 以前会出现URL缺少参数导致充电窗口载入失败报错NaN的bug, 现无法复现, 猜测已修复
commonItems.push(new NormalItem('url-cleaner', 'URL参数净化 (需刷新)', true, cleanURL, true, null))

// 通用header净化,直播页除外
if (location.host != 'live.bilibili.com') {
Expand Down
Loading

0 comments on commit 4c29550

Please sign in to comment.