Skip to content

Commit

Permalink
Merge branch 'preview-fixes' into master-cdn
Browse files Browse the repository at this point in the history
  • Loading branch information
the1812 committed Sep 15, 2024
2 parents 54cdb98 + 041856d commit 527e4f6
Show file tree
Hide file tree
Showing 43 changed files with 1,091 additions and 184 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
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"cntr",
"compositionend",
"compositionstart",
"contenteditable",
"csrf",
"ctnr",
"Danmaku",
Expand All @@ -43,6 +44,7 @@
"durl",
"epid",
"esbuild",
"ffmetadata",
"flac",
"Fullscreen",
"githubusercontent",
Expand Down
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,45 @@
<!-- spell-checker: disable -->
# 更新日志

## v2.9.3-preview
主要是各种修复, 见 [v2.9.3](https://github.com/the1812/Bilibili-Evolved/releases/tag/v2.9.3).

## v2.9.3

<details>
<summary>正式版用户将获得 v2.9.1-preview ~ v2.9.2-preview 的所有改动, 点击展开查看</summary>

✨新增
- `查看封面` 可以为 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))
- `弹幕转义` 支持对正斜杠的换行 (`/n`) 进行转义. (#4865)
- `自定义顶栏` 支持直接在功能中打开布局设置. (#2666)
- `高分辨率图片` 支持处理没有指定高度的图片, 支持在专栏页面中请求原图. (#2868)
- `直播间网页全屏自适应` 样式适配较低的宽度值. (#4895)

☕开发者相关
- 外部资源接入 Subresource Integrity. (#4896)

</details>

🐛修复
- 修复 `快速收起评论` 对旧版评论区的兼容性. (#4905)
- 修复 `快捷键扩展` 的发送评论在新版评论区失效. (#4843)
- 修复 `禁用评论区搜索词` 偶现样式失效. (#4843)

☕开发者相关
- `ShadowDomObserver` 在使用前无需再调用 `observe()`.
- 增加工具方法 `getActiveElement` 检测当前页面的聚焦元素.

## v2.9.2-preview
`2024-09-08`

Expand Down
18 changes: 17 additions & 1 deletion 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 @@ -699,7 +707,7 @@
"type": "component",
"name": "unescapeDanmaku",
"displayName": "弹幕转义",
"description": "将弹幕中的 `\\n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.\r\n",
"description": "将弹幕中的 `\\n` 或 `/n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.\r\n",
"fullRelativePath": "../../registry/dist/components/video/danmaku/unescape.js",
"fullAbsolutePath": "registry/dist/components/video/danmaku/unescape.js"
},
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
24 changes: 23 additions & 1 deletion 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 @@ -958,7 +969,7 @@ by [@kdxcxs](https://github.com/kdxcxs)

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

将弹幕中的 `\n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.
将弹幕中的 `\n` `/n` 替换为真实的换行, 注意这可能导致原先不重叠的弹幕发生重叠.

### [视频页默认定位](../../registry/dist/components/video/default-location.js)
`videoDefaultLocation`
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
3 changes: 3 additions & 0 deletions registry/lib/components/feeds/fold-comments/fold-comment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@
}
}
.bili-comment-container {
display: flex !important;
flex-direction: column !important;
&.bili-dyn-comment .reply-list {
padding-bottom: 8px !important;
}
.fold-comment {
order: 1;
font-size: 13px;
}
.at-panel,
Expand Down
5 changes: 1 addition & 4 deletions registry/lib/components/feeds/fold-comments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ const entry = async () => {
}
if (feedsCardsManager.managerType === 'v2') {
const getExistingComment = () => dq(card, commentSelector) as HTMLElement
const isCommentAreaReady = () => {
const existingComment = getExistingComment()
return existingComment !== null && dq(existingComment, 'bili-comments')
}
const isCommentAreaReady = () => getExistingComment() !== null
const handler = () => {
const button = dq(card, '.bili-dyn-action.comment') as HTMLElement
button?.click()
Expand Down
20 changes: 20 additions & 0 deletions registry/lib/components/live/chat-panel-fit/chat-panel-fit.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
.player-full-win:not(.hide-aside-area) {
.live-room-app {
.aside-area {
container-name: aside-area;
container-type: size;
width: var(--live-chat-panel-width, 302px) !important;
}
.player-section {
width: calc(100% - var(--live-chat-panel-width, 302px)) !important;
}
@container aside-area (max-width: 290px) {
.control-panel-icon-row-new .icon-left-part-new {
.super-chat,
.like-btn {
width: 32px;
&-icon {
margin-right: 0 !important;
}
&-text {
display: none !important;
}
}
}
.chat-input-ctnr-new .medal-section {
min-width: 0 !important;
max-width: 0 !important;
}
}
}
}
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': '为直播间的房间观众和大航海界面的用户列表添加可以点击的超链接',
},
})
3 changes: 3 additions & 0 deletions registry/lib/components/style/custom-navbar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ export const component = defineComponentMetadata({
// const { addImportantStyle } = await import('@/core/style')
// addImportantStyle(style, styleID)
},
widget: {
component: () => import('./settings/Widget.vue').then(m => m.default),
},
extraOptions: () => import('./settings/ExtraOptions.vue').then(m => m.default),
plugin: {
displayName: '自定义顶栏 - 功能扩展',
Expand Down
24 changes: 24 additions & 0 deletions registry/lib/components/style/custom-navbar/settings/Widget.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<template>
<DefaultWidget
name="顶栏布局设置"
icon="mdi-sort"
@mouseover="loadNavbarSettings()"
@click="toggleNavbarSettings()"
/>
</template>
<script lang="ts">
import { DefaultWidget } from '@/ui'
import { loadNavbarSettings, toggleNavbarSettings } from './vm'
export default Vue.extend({
components: {
DefaultWidget,
},
methods: {
async loadNavbarSettings() {
await loadNavbarSettings()
},
toggleNavbarSettings,
},
})
</script>
Loading

0 comments on commit 527e4f6

Please sign in to comment.