Skip to content

Commit

Permalink
Merge branch 'preview-features' into preview
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed Aug 15, 2024
2 parents 01db576 + b7e4269 commit 49dab16
Show file tree
Hide file tree
Showing 20 changed files with 585 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
packages/
typings/
dist/
**/dist/
dev/
node_modules/
!.github-json/
Expand Down
56 changes: 56 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,62 @@
<!-- spell-checker: disable -->
# 更新日志

## v2.9.1-preview
`2024-08-15`

包含 [v2.9.1](https://github.com/the1812/Bilibili-Evolved/releases/tag/v2.9.1) 的所有更新内容.

✨新增
- `查看封面` 可以为 aria2 输出提供直接的封面下载. (PR #4798 by [Oxygenくん](https://github.com/oxygenkun))
- 新增组件 `保存视频元数据`. (PR #4840 by [WakelessSloth56](https://github.com/WakelessSloth56))
> - 保存视频元数据为 [FFMETADATA](https://ffmpeg.org/ffmpeg-formats.html#Metadata-2) 格式
> - 使用组件 `下载视频` 时指定 `WASM` 输出方式(插件 `下载视频 - WASM 混流输出`)可选择是否直接混流入输出文件。
> - 保存视频章节为 OGM 格式 (https://github.com/the1812/Bilibili-Evolved/discussions/2069#discussioncomment-10110916)
- `简化首页` 支持隐藏轮播图. (PR #4852 by [Lime](https://github.com/Liumingxun))
- 新增组件 `添加直播间用户超链接`. (PR #4856 by [Light_Quanta](https://github.com/LightQuanta))
> 网页版直播间右上角的房间观众和大航海界面的用户列表只可查看用户名,不可进行点击。该组件为用户头像和用户名称处添加点击效果,允许通过点击直接查看用户空间。
- 插件 `下载视频 - WASM 混流输出` 支持并行下载库和音视频流. (PR #4864 by [WakelessSloth56](https://github.com/WakelessSloth56))

## v2.9.1
`2024-08-15`

<details>
<summary>正式版用户将获得 v2.9.0-preview 的所有改动 (新功能以及一项废弃), 点击展开查看</summary>

✨新增
- `简化直播间` 支持屏蔽推荐直播间. (#4787)
- 新增功能 `删除直播马赛克遮罩` (#4634, PR #4814)
> 删除观看直播时某些分区的马赛克遮罩.
- `启用视频截图` 截出来的图支持直接复制. (此功能需要 Firefox 127 版本以上) (#4806)
- `图片批量导出`, `下载视频` 支持更多变量, 详情可在更新组件后查看设置中的说明: (#3852)
- 动态 ID, 用户 ID, 动态发布时间, 被转发动态相关数据
- 专栏 cv 号, 专栏发布时间
- (仅对批量视频下载 (分P / 合集) 有效) up 主名称, up 主 ID, 视频发布时间
- `自定义顶栏` 的稍后再看和历史面板现在始终显示 "已观看" 状态. (#4346)
- `自定义顶栏` 的稍后再看, 收藏和历史面板优化了分 P 数和观看进度的展示, 详见[此处](https://github.com/the1812/Bilibili-Evolved/discussions/1866#discussioncomment-10075203). (#1866)

🗑️废弃
- 删除 `下载视频` 的 Toast 输出方式.

</details>

🐛修复
- 部分修复 `简化评论区` 在新版评论区下失效. (#4843)
- 头像框目前还没找到比较好的方式隐藏, 暂不支持.
- 时间由于 Shadow DOM 限制, 无法再挪到右上角了, `装扮 & 时间` 只对装扮有效.
- 样式实现依赖 [:host-context](https://developer.mozilla.org/en-US/docs/Web/CSS/:host-context), 因此目前还不支持 Firefox.
- 修复 `删除视频弹窗``禁用特殊弹幕样式` 在新版播放器下失效. (#4843, #4823, PR #4839 by [festoney8](https://github.com/festoney8))
- 修复 `快捷键扩展` 的部分操作和 `启用弹幕空降` 在新版播放器下失效.

☕开发者相关
- 新增 Shadow DOM 系列 API (`src/core/shadow-dom.ts`), 用于处理 Shadow DOM 相关的逻辑.
- `ShadowDomObserver`: 持续观测页面上的所有 Shadow DOM.
- `ShadowDomStyles`: 支持将样式注入页面, 包含所有 Shadow DOM 内部.
- `MutationObserver` 相关的 API 支持使用 `Node` 类型作为目标.

## v2.9.0-preview
`2024-07-19`

Expand Down
4 changes: 4 additions & 0 deletions doc/donate.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@ https://afdian.net/@the1812?tab=sponsor
<!--'单号'在支付宝中为'收款单号'/'交易订单号'-->
<!-- 2020.10.16 17:16:05 | 匿名 (要求不列出) -->
<!-- 2021.12.27 14:01:51 | 匿名 (要求不列出) -->
<!-- 2024.07.27 10:36:54 | 匿名 (要求不列出) -->

| 时间 | 用户名 | 单号后4位 | 金额 |
| ------------------- | --------------------- | --------- | ------- |
| 2024.08.15 10:18:07 | *9 | 1653 | ¥10.00 |
| 2024.07.30 13:40:22 | Z*n | 2215 | ¥5.00 |
| 2024.07.24 09:38:46 | H*g | 7776 | ¥5.00 |
| 2024.07.16 20:57:01 | *h | 4344 | ¥20.00 |
| 2024.06.10 11:05:25 | *| 6240 | ¥5.00 |
| 2024.06.01 14:30:08 | R*0 | 8974 | ¥50.00 |
Expand Down
16 changes: 16 additions & 0 deletions doc/features/features.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,14 @@
"fullRelativePath": "../../registry/dist/components/live/home-mute.js",
"fullAbsolutePath": "registry/dist/components/live/home-mute.js"
},
{
"type": "component",
"name": "liveroomUsernameLink",
"displayName": "添加直播间用户超链接",
"description": "by [@Light_Quanta](https://github.com/LightQuanta)\n\n为直播间的房间观众和大航海界面的用户列表添加可以点击的超链接",
"fullRelativePath": "../../registry/dist/components/live/liveroom-username-link.js",
"fullAbsolutePath": "registry/dist/components/live/liveroom-username-link.js"
},
{
"type": "component",
"name": "originalLiveroom",
Expand Down Expand Up @@ -735,6 +743,14 @@
"fullRelativePath": "../../registry/dist/components/video/full-episode-title.js",
"fullAbsolutePath": "registry/dist/components/video/full-episode-title.js"
},
{
"type": "component",
"name": "saveVideoMetadata",
"displayName": "保存视频元数据",
"description": "by [@WakelessSloth56](https://github.com/WakelessSloth56),[@LainIO24](https://github.com/LainIO24)\n\n保存视频元数据(标题、描述、UP、章节等)",
"fullRelativePath": "../../registry/dist/components/video/metadata.js",
"fullAbsolutePath": "registry/dist/components/video/metadata.js"
},
{
"type": "component",
"name": "outerWatchlater",
Expand Down
22 changes: 22 additions & 0 deletions doc/features/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,17 @@ by [@TimmyOVO](https://github.com/TimmyOVO)

禁止直播首页的推荐直播间自动开始播放.

### [添加直播间用户超链接](../../registry/dist/components/live/liveroom-username-link.js)
`liveroomUsernameLink`

**jsDelivr:** [`Stable`](https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@master/registry/dist/components/live/liveroom-username-link.js) / [`Preview`](https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/registry/dist/components/live/liveroom-username-link.js)

**GitHub:** [`Stable`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/registry/dist/components/live/liveroom-username-link.js) / [`Preview`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/registry/dist/components/live/liveroom-username-link.js)

by [@Light_Quanta](https://github.com/LightQuanta)

为直播间的房间观众和大航海界面的用户列表添加可以点击的超链接

### [返回原版直播间](../../registry/dist/components/live/original.js)
`originalLiveroom`

Expand Down Expand Up @@ -1022,6 +1033,17 @@ by [@kdxcxs](https://github.com/kdxcxs)

打开 `展开选集列表` 时, 在选集区域的标题上按住 <kbd>Alt</kbd> 键点击可以临时切换展开/收起选集列表.

### [保存视频元数据](../../registry/dist/components/video/metadata.js)
`saveVideoMetadata`

**jsDelivr:** [`Stable`](https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@master/registry/dist/components/video/metadata.js) / [`Preview`](https://cdn.jsdelivr.net/gh/the1812/Bilibili-Evolved@preview/registry/dist/components/video/metadata.js)

**GitHub:** [`Stable`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/master/registry/dist/components/video/metadata.js) / [`Preview`](https://raw.githubusercontent.com/the1812/Bilibili-Evolved/preview/registry/dist/components/video/metadata.js)

by [@WakelessSloth56](https://github.com/WakelessSloth56),[@LainIO24](https://github.com/LainIO24)

保存视频元数据(标题、描述、UP、章节等)

### [外置稍后再看](../../registry/dist/components/video/outer-watchlater.js)
`outerWatchlater`

Expand Down
104 changes: 104 additions & 0 deletions registry/lib/components/live/liveroom-username-link/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { defineComponentMetadata } from '@/components/define'
import { select } from '@/core/spin-query'
import { delay } from '@/core/utils'

const processed = new WeakSet()

const entry = async () => {
const userInfoBar = await select('#rank-list-ctnr-box', {
queryInterval: 500,
})

const observer = new MutationObserver(async () => {
// 舰长列表
const guardNodes = [...document.querySelectorAll('webcomponent-userinfo')]
let subtreeLoaded = false

for (const node of guardNodes) {
if (processed.has(node)) {
continue
}

// eslint-disable-next-line no-underscore-dangle
const { uid } = (node as any).__vue__.source.uinfo

if (!subtreeLoaded) {
// 等待子节点创建
while (
node.shadowRoot.querySelector('a') === null ||
node.shadowRoot.querySelector('.faceBox') === null
) {
await delay(100)
}
subtreeLoaded = true
}

const aNode = node.shadowRoot.querySelector('a')
const avatarNode: HTMLDivElement = node.shadowRoot.querySelector('.faceBox')

aNode.href = `https://space.bilibili.com/${uid}`
aNode.style.textDecoration = 'none'

avatarNode.style.cursor = 'pointer'
avatarNode.addEventListener('click', () => {
window.open(`https://space.bilibili.com/${uid}`)
})
processed.add(node)

// const name = a.innerText
// console.log(`已为舰长${name}(UID: ${uid})添加超链接`)
}

// 观众列表
const spectorNodes = [...document.querySelectorAll('.gift-rank-list-item')]
for (const node of spectorNodes) {
if (processed.has(node)) {
continue
}

// 观众列表元素似乎会原地更新,不能直接预先获取UID并绑定,这里通过点击时获取父元素动态读取UID

// 名称
const nameNode: HTMLDivElement = node.querySelector('.common-nickname-wrapper .name')
nameNode.style.cursor = 'pointer'
nameNode.addEventListener('click', () => {
// eslint-disable-next-line no-underscore-dangle
const { uid } = (nameNode as any).parentNode.parentNode.parentNode.parentNode.__vue__.source
window.open(`https://space.bilibili.com/${uid}`)
})

// 头像
const avatarNode: HTMLDivElement = node.querySelector('.face')
avatarNode.style.cursor = 'pointer'
avatarNode.addEventListener('click', () => {
// eslint-disable-next-line no-underscore-dangle
const { uid } = (avatarNode as any).parentNode.parentNode.__vue__.source
window.open(`https://space.bilibili.com/${uid}`)
})
processed.add(node)

// const name = nameNode.innerText
// console.log(`已为观众${name}(UID: ${uid})添加超链接`)
}
})

observer.observe(userInfoBar, {
childList: true,
subtree: true,
})
}

export const component = defineComponentMetadata({
name: 'liveroomUsernameLink',
author: {
name: 'Light_Quanta',
link: 'https://github.com/LightQuanta',
},
displayName: '添加直播间用户超链接',
entry,
tags: [componentsTags.live],
urlInclude: [/^https:\/\/live\.bilibili\.com\/\d+/],
description: {
'zh-CN': '为直播间的房间观众和大航海界面的用户列表添加可以点击的超链接',
},
})
59 changes: 59 additions & 0 deletions registry/lib/components/style/simplify/comments/comments-v3.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
@import 'common';

$prefix: 'simplifyComments-switch';

:host-context(.comment-m-v1) {
&:host(bili-rich-text) {
#contents img, #contents a i {
max-width: 1.4em;
max-height: 1.4em;
}
}

&:host-context(body.#{$prefix}-replyEditor) {
&:host(bili-comment-box) {
#pub button {
font-size: 14px;
}
}
&:host(bili-checkbox) {
#label {
font-size: 15px;
}
}
&:host(bili-comment-textarea) {
#input {
font-size: 13px;
}
#input,
#input::placeholder {
line-height: normal;
}
}
}
&:host-context(body.#{$prefix}-userLevel):host(bili-comment-user-info) {
#user-level {
display: none;
}
}
&:host-context(body.#{$prefix}-decorateAndTime):host(bili-comment-renderer) {
bili-comment-user-sailing-card {
display: none;
}
}
&:host-context(body.#{$prefix}-fansMedal):host(bili-comment-user-info) {
bili-comment-user-medal {
display: none;
}
}
&:host-context(body.#{$prefix}-subReplyNewLine):host(bili-comment-reply-renderer) {
bili-comment-user-info {
display: block;
}
}
&:host-context(body.#{$prefix}-eventBanner):host(bili-comments-header-renderer) {
bili-comments-notice {
display: none;
}
}
}
9 changes: 7 additions & 2 deletions registry/lib/components/style/simplify/comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,19 @@ export const component = wrapSwitchOptions({
},
true,
)

const { ShadowDomStyles } = await import('@/core/shadow-dom')
const v3Styles = await import('./comments-v3.scss').then(m => m.default)
const shadowDom = new ShadowDomStyles()
shadowDom.addStyle(v3Styles)
},
instantStyles: [
{
name,
name: `${name}v1`,
style: () => import('./comments.scss'),
},
{
name,
name: `${name}v2`,
style: () => import('./comments-v2.scss'),
},
],
Expand Down
Loading

0 comments on commit 49dab16

Please sign in to comment.