Skip to content

Commit

Permalink
update: font patch support dyn page
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed May 27, 2024
1 parent 99ee29c commit 2981ef5
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 5 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.6.3

- 新增:修复字体支持动态详情页

## 3.6.2

- 新增:稍后再看列表页,双列布局
Expand Down
33 changes: 33 additions & 0 deletions src/rules/dynamic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Group } from '../components/group'
import { CheckboxItem } from '../components/item'
import { isPageDynamic } from '../utils/page-type'
import settings from '../settings'

// 自动展开 相同UP主被折叠的动态
const dynamicUnfold = () => {
Expand All @@ -24,6 +25,32 @@ const dynamicGroupList: Group[] = []
* 评论区规则适配2种动态详情页(t.bilibili.com/12121212和bilibili.com/opus/12121212)
*/
if (isPageDynamic()) {
let fontPatchCSS = ''
if (location.href.match(/www\.bilibili\.com\/opus\/\d+/)) {
fontPatchCSS = `
${settings.fontFaceRegular}
${settings.fontFaceMedium}
.reply-item .root-reply-container .content-warp .user-info .user-name {
font-family: PingFang SC,HarmonyOS_Medium,Helvetica Neue,Microsoft YaHei,sans-serif !important;
font-weight: 500 !important;
font-size: 14px !important;
}`
} else if (location.href.match(/t\.bilibili\.com\/\d+/)) {
fontPatchCSS = `
${settings.fontFaceRegular}
body {
font-family: PingFang SC, HarmonyOS_Regular, Helvetica Neue, Microsoft YaHei, sans-serif !important;
font-weight: 400;
}`
} else if (location.href.includes('www.bilibili.com/v/topic/detail/')) {
fontPatchCSS = `
${settings.fontFaceRegular}
body {
font-family: PingFang SC, HarmonyOS_Regular, Helvetica Neue, Microsoft YaHei, sans-serif !important;
font-weight: 400;
}`
}

// 基本功能
const basicItems = [
// 顶栏 不再吸附顶部
Expand All @@ -44,6 +71,12 @@ if (isPageDynamic()) {
aside.right {order: 1; margin-right: 12px !important;}
.bili-dyn-sidebar {order: 4;}`,
}),
// 修复字体
new CheckboxItem({
itemID: 'font-patch',
description: '修复字体 (实验功能)',
itemCSS: fontPatchCSS,
}),
]
dynamicGroupList.push(new Group('dynamic-basic', '动态页 基本功能', basicItems))

Expand Down
2 changes: 1 addition & 1 deletion src/rules/live.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if (isPageLiveRoom()) {
// 修复字体
new CheckboxItem({
itemID: 'font-patch',
description: '修复字体 (实验功能)\n直播/热门/空间/稍后再看页',
description: '修复字体 (实验功能)',
itemCSS: `
${settings.fontFaceRegular}
body,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/popular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ if (isPagePopular()) {
// 修复字体
new CheckboxItem({
itemID: 'font-patch',
description: '修复字体 (实验功能)\n直播/热门/空间/稍后再看页',
description: '修复字体 (实验功能)',
itemCSS: `
${settings.fontFaceRegular}
${settings.fontFaceMedium}
Expand Down
2 changes: 1 addition & 1 deletion src/rules/space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if (isPageSpace()) {
// 修复字体
new CheckboxItem({
itemID: 'font-patch',
description: '修复字体 (实验功能)\n直播/热门/空间/稍后再看页',
description: '修复字体 (实验功能)',
itemCSS: `
${settings.fontFaceRegular}
body,
Expand Down
2 changes: 1 addition & 1 deletion src/rules/watchlater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if (isPageWatchlater()) {
// 修复字体
new CheckboxItem({
itemID: 'font-patch',
description: '修复字体 (实验功能)\n直播/热门/空间/稍后再看页',
description: '修复字体 (实验功能)',
itemCSS: `
${settings.fontFaceRegular}
${settings.fontFaceMedium}
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.6.2',
version: '3.6.3',
description:
'净化 B站/哔哩哔哩 页面,支持「精简功能、播放器净化、过滤视频、过滤评论、全站黑白名单」,提供 300+ 功能,定制自己的 B 站',
author: 'festoney8',
Expand Down

0 comments on commit 2981ef5

Please sign in to comment.