Skip to content

Commit

Permalink
chore: update item name and bangumi page patch
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Dec 29, 2023
1 parent 662c5d9 commit a8a7a37
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@

### 注意事项

- **通用功能「URL参数净化」**,由于比较激进,会导致 **充电窗口载入失败 (报错NaN)**需充电时请关闭该功能,并刷新页面
- 给 UP 主充电时,若出现 **充电窗口载入失败 (报错NaN)**请关闭 **通用项「URL参数净化」**功能,刷新页面再充电
- **「版权视频播放页」大部分功能与「普通播放页」一致且互相同步,小部分功能为该页面独有,已用 "★" 重点标出**
- **已知Bug:** Chrome 内核浏览器在打开「版权作品播放页」时,小概率出现顶栏未净化的情况。已通过打补丁的方式暂时补救,副作用为打开页面数秒后顶栏净化规则才生效

Expand Down
8 changes: 3 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,11 @@ const main = async () => {
}
}, 500)

// chrome系浏览器补丁
// firefox可用观测head解决head null, chrome系观测到head构建后仍小可能出bug, 只出现在bangumi page
// 测试可知, 从document-start开始, chrome系的head永远非null, head内插入style均成功
// 在DOMContentLoaded时, style数量正确
// bangumi page规则丢失补丁, 在打开bangumipage新标签页时, 可能丢失规则, firefox和chrome均复现
// 测试可知, head内插入style均成功, 在DOMContentLoaded时, style数量正确
// 在readyState=complete后, style数量有概率会减少, 规则丢失, 原因不明
// 故在bangumi page监听load, 二次检查解决规则载入不全问题
if (location.pathname.startsWith('/bangumi/play') && navigator.userAgent.toLowerCase().includes('chrome')) {
if (location.pathname.startsWith('/bangumi/play')) {
window.addEventListener('load', () => {
debug('chrome patch, recheck start')
for (let i = GROUPS.length - 1; i >= 0; i--) {
Expand Down
9 changes: 6 additions & 3 deletions src/pages/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ const cleanURL = () => {

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

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

// 滚动条美化, 默认开启
commonItems.push(
Expand Down Expand Up @@ -216,7 +217,8 @@ if (host === 'search.bilibili.com') {
}`
}
if (href.startsWith('https://www.bilibili.com/video/')) {
borderRadiusCSS = `#nav-searchform,
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
.v-popover-content,
.van-popover,
Expand All @@ -234,6 +236,7 @@ if (href.startsWith('https://www.bilibili.com/video/')) {
.vcd *,
.upinfo-btn-panel *,
.fixed-sidenav-storage div,
.fixed-sidenav-storage a,
.reply-box-textarea,
.reply-box-send,
.reply-box-send:after {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ if (location.href.startsWith('https://www.bilibili.com/video/')) {
false,
`#bilibili-player .bpx-player-subtitle-panel-text {
background: unset !important;
background-color: rgba(0,0,0,0.75) !important;
background-color: rgba(0,0,0,0.7) !important;
text-shadow: none !important;
background-clip: text !important;
text-stroke: 3px transparent !important;
Expand Down

0 comments on commit a8a7a37

Please sign in to comment.