Skip to content

Commit

Permalink
feat: add items for mini player
Browse files Browse the repository at this point in the history
  • Loading branch information
festoney8 committed Apr 6, 2024
1 parent 8989d4d commit 6d5390a
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# CHANGELOG

## 3.4.1

- 新增:小窗播放器 隐藏底边进度
- 新增:小窗播放器 隐藏弹幕
- 新增:小窗播放器 缩放百分比调节

## 3.4.0

- 新增:视频过滤支持空间页(UP主主页、投稿列表、视频合集列表)
Expand Down
47 changes: 44 additions & 3 deletions src/rules/bangumi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Group } from '../components/group'
import { CheckboxItem } from '../components/item'
import { CheckboxItem, NumberItem } from '../components/item'
import { debugRules as debug } from '../utils/logger'
import { isPageBangumi } from '../utils/page-type'

Expand Down Expand Up @@ -254,6 +254,47 @@ if (isPageBangumi()) {
defaultStatus: true,
itemCSS: `.bpx-player-shadow-progress-area {display: none !important;}`,
}),
// 小窗播放器 隐藏底边进度
new CheckboxItem({
itemID: 'video-page-hide-bpx-player-mini-mode-process',
description: '小窗播放器 隐藏底边进度',
defaultStatus: true,
itemCSS: `.bpx-player-container[data-screen=mini]:not(:hover) .bpx-player-mini-progress {display: none;}`,
}),
// 小窗播放器 隐藏弹幕
new CheckboxItem({
itemID: 'video-page-hide-bpx-player-mini-mode-danmaku',
description: '小窗播放器 隐藏弹幕',
itemCSS: `.bpx-player-container[data-screen=mini] .bpx-player-row-dm-wrap {visibility: hidden !important;}`,
}),
// 小窗播放器 缩放百分比
new NumberItem({
itemID: 'video-page-bpx-player-mini-mode-zoom',
description: '小窗播放器 缩放百分比 (100=禁用)',
defaultValue: 100,
minValue: 0,
maxValue: 500,
disableValue: 100,
unit: '%',
itemCSS: `
.bpx-player-container[data-screen=mini] {
height: calc(225px * ??? / 100);
width: calc(400px * ??? / 100);
}
.bpx-player-container[data-revision="1"][data-screen=mini],
.bpx-player-container[data-revision="2"][data-screen=mini] {
height: calc(180px * ??? / 100);
width: calc(320px * ??? / 100);
}
@media screen and (min-width:1681px) {
.bpx-player-container[data-revision="1"][data-screen=mini],
.bpx-player-container[data-revision="2"][data-screen=mini] {
height: calc(203px * ??? / 100);
width: calc(360px * ??? / 100);
}
}`,
itemCSSPlaceholder: '???',
}),
]
bangumiGroupList.push(new Group('bangumi-player-control', '播放控制', playerControlItems))

Expand Down Expand Up @@ -748,10 +789,10 @@ if (isPageBangumi()) {
defaultStatus: true,
itemCSS: `[class*='navTools_navMenu'] [title='新版反馈'] {display: none !important;}`,
}),
// 隐藏 小窗播放器
// 隐藏 小窗播放开关
new CheckboxItem({
itemID: 'video-page-hide-sidenav-mini',
description: '隐藏 小窗播放器',
description: '隐藏 小窗播放开关',
itemCSS: `[class*='navTools_navMenu'] [title*='迷你播放器'] {display: none !important;}`,
}),
// 隐藏 客服, 默认开启
Expand Down
48 changes: 45 additions & 3 deletions src/rules/video.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Group } from '../components/group'
import { CheckboxItem } from '../components/item'
import { CheckboxItem, NumberItem } from '../components/item'
import { debugRules as debug } from '../utils/logger'
import { matchAvidBvid, matchBvid } from '../utils/tool'
import { isPageBnj, isPagePlaylist, isPageVideo } from '../utils/page-type'
Expand Down Expand Up @@ -449,6 +449,48 @@ if (isPageVideo() || isPagePlaylist() || isPageBnj()) {
-ms-text-stroke: 3px transparent;
}`,
}),
// 小窗播放器 隐藏底边进度
new CheckboxItem({
itemID: 'video-page-hide-bpx-player-mini-mode-process',
description: '小窗播放器 隐藏底边进度',
defaultStatus: true,
itemCSS: `.bpx-player-container[data-screen=mini]:not(:hover) .bpx-player-mini-progress {display: none;}`,
}),
// 小窗播放器 隐藏弹幕
new CheckboxItem({
itemID: 'video-page-hide-bpx-player-mini-mode-danmaku',
description: '小窗播放器 隐藏弹幕',
defaultStatus: true,
itemCSS: `.bpx-player-container[data-screen=mini] .bpx-player-row-dm-wrap {visibility: hidden !important;}`,
}),
// 小窗播放器 缩放百分比
new NumberItem({
itemID: 'video-page-bpx-player-mini-mode-zoom',
description: '小窗播放器 缩放百分比 (100=禁用)',
defaultValue: 100,
minValue: 0,
maxValue: 500,
disableValue: 100,
unit: '%',
itemCSS: `
.bpx-player-container[data-screen=mini] {
height: calc(225px * ??? / 100);
width: calc(400px * ??? / 100);
}
.bpx-player-container[data-revision="1"][data-screen=mini],
.bpx-player-container[data-revision="2"][data-screen=mini] {
height: calc(180px * ??? / 100);
width: calc(320px * ??? / 100);
}
@media screen and (min-width:1681px) {
.bpx-player-container[data-revision="1"][data-screen=mini],
.bpx-player-container[data-revision="2"][data-screen=mini] {
height: calc(203px * ??? / 100);
width: calc(360px * ??? / 100);
}
}`,
itemCSSPlaceholder: '???',
}),
]
videoGroupList.push(new Group('video-player', '播放器', playerItems))

Expand Down Expand Up @@ -1264,10 +1306,10 @@ if (isPageVideo() || isPagePlaylist()) {

// 右下角
const sidebarItems = [
// 隐藏 小窗播放器
// 隐藏 小窗播放开关
new CheckboxItem({
itemID: 'video-page-hide-sidenav-right-container-live',
description: '隐藏 小窗播放器',
description: '隐藏 小窗播放开关',
itemCSS: `.fixed-sidenav-storage .mini-player-window {display: none !important;}
/* 适配watchlater, favlist */
.float-nav-exp .nav-menu .item.mini {display: none !important;}`,
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.4.0',
version: '3.4.1',
description:
'净化 B站/哔哩哔哩 网页元素,去广告,BV号转AV号,播放器净化,过滤视频,过滤评论,提供300+项功能,定制自己的B站页面',
author: 'festoney8',
Expand Down

0 comments on commit 6d5390a

Please sign in to comment.