Skip to content

Commit

Permalink
Merge pull request #15 from festoney8/dev
Browse files Browse the repository at this point in the history
merge dev to main, v2.3.0
  • Loading branch information
festoney8 authored Jan 8, 2024
2 parents c6256e5 + 87e33b8 commit 05f2f17
Show file tree
Hide file tree
Showing 13 changed files with 470 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: mkdir
run: mkdir output
- name: move and rename file
run: mv dist/bilibili-cleaner.user.js output/bilibili-cleaner.user.min.js
run: mv dist/bilibili-cleaner.user.js output/bilibili-cleaner.min.user.js
- name: build default
run: pnpm run build
- name: copy file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: mkdir
run: mkdir output
- name: move and rename file
run: mv dist/bilibili-cleaner.user.js output/bilibili-cleaner.user.min.js
run: mv dist/bilibili-cleaner.user.js output/bilibili-cleaner.min.user.js
- name: build default
run: pnpm run build
- name: copy file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: mkdir
run: mkdir build-release
- name: move and rename file
run: mv dist/bilibili-cleaner.user.js build-release/bilibili-cleaner.user.min.js
run: mv dist/bilibili-cleaner.user.js build-release/bilibili-cleaner.min.user.js
- name: build default
run: pnpm run build
- name: copy file
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# CHANGELOG

## 2.3.0

- 新增:页面适配 热门视频/排行榜页
- 新增:热门视频/排行榜页 支持四列布局
- 新增:播放页 隐藏 打卡弹窗
- 新增:首页 增大视频信息文字字号
- 优化:动态页 评论区选项,动态规则适配动态详情页

## 2.2.3

- 修复:版权视频播放页规则丢失bug,移除补丁
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

## 使用

- **注意「首页、播放页、版权作品播放页、直播间、搜索页、动态页」这 6 个页面,菜单各不相同**
- **注意「首页、播放页、版权作品播放页、直播间、搜索页、动态页、热门视频/排行榜页」这 7 个页面,菜单各不相同**

- 「通用」项目对所有页面生效

Expand All @@ -48,7 +48,7 @@
## 功能介绍

- 适用于 **净化新版 bilibili 网页**,不做老版本页面适配
- 目前支持 **「首页、播放页、版权作品播放页、直播间、搜索页、动态页」**6 个页面,可在每个页面下开启插件菜单,查看功能列表
- 目前支持 **「首页、播放页、版权作品播放页、直播间、搜索页、动态页、热门视频/排行榜页**7 个页面,可在每个页面下开启插件菜单,查看功能列表
- 「通用」功能主要用于净化顶栏,对全站所有页面生效
- 脚本默认用户已登录,大会员下(开发环境)体验最佳
- 脚本默认开启少数基础功能,其余功能由用户自行设定
Expand All @@ -66,6 +66,7 @@
- **「版权视频播放页」大部分功能与「播放页」一致且互相同步,小部分独有功能已用 "★" 重点标出**
- 「动态页」评论区相关功能与「播放页」一致且互相同步
- 「直播页」顶栏与普通顶栏不同,通用功能对其不生效(仅搜索栏少数功能与通用同步)
- 「首页」默认 10 个推荐位,在显示 5 列的情况下,若同时隐藏广告和分区视频,会产生一个待载入空位(骨架),可调节骨架相关选项改善观感

## 浏览器适配

Expand Down Expand Up @@ -170,6 +171,8 @@

- **隐藏首页banner**

- 使用「Evolved 夜间模式」时,开启 Evolved 的「隐藏顶部横幅」,关闭本脚本的「隐藏 banner」

- 使用「Evolved 顶栏」时,开启 Evolved 的「隐藏顶部横幅」,关闭本脚本的「隐藏 banner」
- 不使用「Evolved 顶栏」时,关闭 Evolved 的「隐藏顶部横幅」,开启本脚本的「隐藏 banner」

Expand Down
8 changes: 4 additions & 4 deletions src/core/item.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class NormalItem implements IItem {
error(err)
}
}
/** 启用CSS片段, 向document.head插入style */
/** 启用CSS片段, 向<html>插入style */
insertItemCSS() {
if (!this.itemCSS) {
return
Expand All @@ -85,7 +85,7 @@ export class NormalItem implements IItem {
return
}
const style = document.createElement('style')
// 简单压缩, 若使用innerText, 多行CSS插入head后会产生<br>标签
// 简单压缩, 若使用innerText, 多行CSS插入后会产生<br>标签
style.innerHTML = this.itemCSS.replace(/\n\s*/g, '').trim()
// 指定CSS片段ID,用于实时启用停用
style.setAttribute('bili-cleaner-css', this.itemID)
Expand All @@ -98,7 +98,7 @@ export class NormalItem implements IItem {
error(err)
}
}
/** 停用CSS片段, 从document.head移除style */
/** 停用CSS片段, 从<html>移除style */
removeItemCSS() {
if (this.itemCSS) {
const style = document.querySelector(`html>style[bili-cleaner-css=${this.itemID}]`) as HTMLStyleElement
Expand Down Expand Up @@ -132,7 +132,7 @@ export class NormalItem implements IItem {
}
}
/**
* 执行item功能, 在页面head添加CSS, 执行func
* 执行item功能, 添加CSS, 执行func
* @param enableFunc 是否执行func, 默认true
*/
enableItem(enableFunc = true) {
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { bangumiGroupList } from './pages/bangumi'
import { searchGroupList } from './pages/search'
import { liveGroupList } from './pages/live'
import { dynamicGroupList } from './pages/dynamic'
import { popularGroupList } from './pages/popular'

log('script start')

Expand All @@ -26,6 +27,7 @@ const main = async () => {
// 载入规则
const GROUPS: Group[] = [
...homepageGroupList,
...popularGroupList,
...videoGroupList,
...bangumiGroupList,
...searchGroupList,
Expand Down
24 changes: 23 additions & 1 deletion src/pages/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,22 @@ if (host === 't.bilibili.com') {
.single-card.floor-card {
border: none !important;
}`
} else if (href.includes('bilibili.com/v/popular/')) {
borderRadiusCSS = `
#nav-searchform,
.nav-search-content,
.v-popover-content,
.van-popover,
.v-popover,
.bili-header .search-panel,
.bili-header .header-upload-entry,
.upinfo-btn-panel *,
.rank-list .rank-item > .content > .img,
.card-list .video-card .video-card__content, .video-list .video-card .video-card__content,
.fixed-sidenav-storage div,
.fixed-sidenav-storage a {
border-radius: 3px !important;
}`
}
}

Expand Down Expand Up @@ -551,7 +567,7 @@ if (location.host != 'live.bilibili.com') {
headerLeftItems.push(
new NormalItem(
'common-hide-nav-blackboard',
'隐藏 所有官方活动(blackboard)',
'隐藏 所有官方活动(强制)',
false,
undefined,
false,
Expand All @@ -561,6 +577,12 @@ if (location.host != 'live.bilibili.com') {
div.bili-header__bar .left-entry li:has(>div>a[href*="bilibili.com/blackboard"]) {
display: none !important;
}
div.bili-header__bar .left-entry li:has(>a[href*="bilibili.com/video/"]) {
display: none !important;
}
div.bili-header__bar .left-entry li:has(>div>a[href*="bilibili.com/video/"]) {
display: none !important;
}
/* 旧版header */
#internationalHeader li.nav-link-item:has(.loc-mc-box, span>a[href*="bilibili.com/blackboard"]) {
display: none !important;
Expand Down
16 changes: 14 additions & 2 deletions src/pages/dynamic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ const dynamicGroupList: Group[] = []
/**
* 动态页面规则
* 动态评论区的规则尽可能使用与video page相同的itemID, 同步开关状态
* 评论区规则适配2种动态详情页(t.bilibili.com/12121212和bilibili.com/opus/12121212)
*/
if (location.host === 't.bilibili.com') {
if (location.host === 't.bilibili.com' || location.href.includes('bilibili.com/opus/')) {
// 基本功能part, basicItems
{
// 顶栏 不再吸附顶部
Expand Down Expand Up @@ -184,7 +185,18 @@ if (location.host === 't.bilibili.com') {
false,
undefined,
false,
`.comment-container .main-reply-box, .fixed-reply-box {display: none !important;}`,
`.comment-container .main-reply-box, .comment-container .fixed-reply-box {display: none !important;}`,
),
)
// 隐藏 页面底部 吸附评论框, 默认开启
commentItems.push(
new NormalItem(
'video-page-hide-fixed-reply-box',
'隐藏 页面底部 吸附评论框',
true,
undefined,
false,
`.comment-container .fixed-reply-box {display: none !important;}`,
),
)
// 隐藏 评论编辑器内占位文字, 默认开启
Expand Down
24 changes: 24 additions & 0 deletions src/pages/homepage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,30 @@ if (location.href.startsWith('https://www.bilibili.com/') && ['/index.html', '/'
}`,
),
)
// 增大 视频信息字号
basicItems.push(
new NormalItem(
'homepage-increase-rcmd-list-font-size',
'增大 视频信息字号',
false,
undefined,
false,
`.bili-video-card .bili-video-card__info--tit,
.bili-live-card .bili-live-card__info--tit,
.single-card.floor-card .title {
font-size: 16px !important;
}
.bili-video-card .bili-video-card__info--bottom,
.floor-card .sub-title.sub-title {
font-size: 14px !important;
}
.bili-video-card__stats,
.bili-video-card__stats .bili-video-card__stats--left,
.bili-video-card__stats .bili-video-card__stats--right {
font-size: 14px !important;
}`,
),
)
}
homepageGroupList.push(new Group('homepage-basic', '首页 基本功能', basicItems))

Expand Down
Loading

0 comments on commit 05f2f17

Please sign in to comment.