mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge branch 'preview-fixes' into preview-features
This commit is contained in:
commit
a3f6043e21
@ -405,7 +405,9 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
&-header {
|
&-header {
|
||||||
@include h-center();
|
@include h-center();
|
||||||
padding: 6px;
|
border-bottom: 1px solid #8882;
|
||||||
|
padding: 6px 0;
|
||||||
|
margin: 0 6px;
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@ -421,7 +423,7 @@ export default Vue.extend({
|
|||||||
@include no-scrollbar();
|
@include no-scrollbar();
|
||||||
@include v-stretch();
|
@include v-stretch();
|
||||||
flex: 1 0 0;
|
flex: 1 0 0;
|
||||||
padding: 6px;
|
padding: 12px 6px;
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
> :not(:first-child) {
|
> :not(:first-child) {
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
@ -445,7 +447,9 @@ export default Vue.extend({
|
|||||||
}
|
}
|
||||||
&-footer {
|
&-footer {
|
||||||
@include h-center();
|
@include h-center();
|
||||||
padding: 6px;
|
border-top: 1px solid #8882;
|
||||||
|
padding: 6px 0;
|
||||||
|
margin: 0 6px;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
.run-download {
|
.run-download {
|
||||||
|
|||||||
@ -181,10 +181,10 @@ const downloadDash = async (
|
|||||||
videoCodec: codec,
|
videoCodec: codec,
|
||||||
})
|
})
|
||||||
const qualities = (data.accept_quality as number[])
|
const qualities = (data.accept_quality as number[])
|
||||||
.filter(qn => (
|
// .filter(qn => (
|
||||||
// 去掉当前编码不匹配的 quality
|
// // 去掉当前编码不匹配的 quality
|
||||||
(video as any[]).some(d => d.id === qn && parseVideoCodec(d.codecid) === codec)
|
// (video as any[]).some(d => d.id === qn && parseVideoCodec(d.codecid) === codec)
|
||||||
))
|
// ))
|
||||||
.map(qn => allQualities.find(q => q.value === qn))
|
.map(qn => allQualities.find(q => q.value === qn))
|
||||||
.filter(q => q !== undefined)
|
.filter(q => q !== undefined)
|
||||||
const info = new DownloadVideoInfo({
|
const info = new DownloadVideoInfo({
|
||||||
@ -200,19 +200,19 @@ const downloadDash = async (
|
|||||||
export const videoDashAvc: DownloadVideoApi = {
|
export const videoDashAvc: DownloadVideoApi = {
|
||||||
name: 'video.dash.avc',
|
name: 'video.dash.avc',
|
||||||
displayName: 'dash (AVC/H.264)',
|
displayName: 'dash (AVC/H.264)',
|
||||||
description: '音画分离的 mp4 格式, 编码为 H.264, 体积较大, 兼容性较好. 下载后可以合并为单个 mp4 文件.',
|
description: '音画分离的 mp4 格式, 编码为 H.264, 体积较大, 兼容性较好. 下载后可以合并为单个 mp4 文件. 如果视频源没有此编码, 则会自动选择其他同清晰度的编码格式.',
|
||||||
downloadVideoInfo: async input => downloadDash(input, { codec: DashCodec.Avc }),
|
downloadVideoInfo: async input => downloadDash(input, { codec: DashCodec.Avc }),
|
||||||
}
|
}
|
||||||
export const videoDashHevc: DownloadVideoApi = {
|
export const videoDashHevc: DownloadVideoApi = {
|
||||||
name: 'video.dash.hevc',
|
name: 'video.dash.hevc',
|
||||||
displayName: 'dash (HEVC/H.265)',
|
displayName: 'dash (HEVC/H.265)',
|
||||||
description: '音画分离的 mp4 格式, 编码为 H.265, 体积中等, 兼容性较差. 下载后可以合并为单个 mp4 文件.',
|
description: '音画分离的 mp4 格式, 编码为 H.265, 体积中等, 兼容性较差. 下载后可以合并为单个 mp4 文件. 如果视频源没有此编码, 则会自动选择其他同清晰度的编码格式.',
|
||||||
downloadVideoInfo: async input => downloadDash(input, { codec: DashCodec.Hevc }),
|
downloadVideoInfo: async input => downloadDash(input, { codec: DashCodec.Hevc }),
|
||||||
}
|
}
|
||||||
export const videoDashAv1: DownloadVideoApi = {
|
export const videoDashAv1: DownloadVideoApi = {
|
||||||
name: 'video.dash.av1',
|
name: 'video.dash.av1',
|
||||||
displayName: 'dash (AV1)',
|
displayName: 'dash (AV1)',
|
||||||
description: '音画分离的 mp4 格式, 编码为 AV1, 体积较小, 兼容性中等. 下载后可以合并为单个 mp4 文件.',
|
description: '音画分离的 mp4 格式, 编码为 AV1, 体积较小, 兼容性中等. 下载后可以合并为单个 mp4 文件. 如果视频源没有此编码, 则会自动选择其他同清晰度的编码格式.',
|
||||||
downloadVideoInfo: async input => downloadDash(input, { codec: DashCodec.Av1 }),
|
downloadVideoInfo: async input => downloadDash(input, { codec: DashCodec.Av1 }),
|
||||||
}
|
}
|
||||||
export const videoAudioDash: DownloadVideoApi = {
|
export const videoAudioDash: DownloadVideoApi = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { VueConstructor } from 'vue'
|
import { Component, VueConstructor } from 'vue'
|
||||||
|
|
||||||
export type Executable<ReturnType = void> = () => ReturnType | Promise<ReturnType>
|
export type Executable<ReturnType = void> = () => ReturnType | Promise<ReturnType>
|
||||||
export type ExecutableWithParameter<Parameters extends any[] = never[], ReturnType = void> = (
|
export type ExecutableWithParameter<Parameters extends any[] = never[], ReturnType = void> = (
|
||||||
@ -7,7 +7,11 @@ export type ExecutableWithParameter<Parameters extends any[] = never[], ReturnTy
|
|||||||
|
|
||||||
export type TestPattern = (string | RegExp)[]
|
export type TestPattern = (string | RegExp)[]
|
||||||
export type ArrayContent<T> = T extends Array<infer R> ? R : T
|
export type ArrayContent<T> = T extends Array<infer R> ? R : T
|
||||||
export type VueModule = VueConstructor | { default: VueConstructor }
|
export type VueModule =
|
||||||
|
Component
|
||||||
|
| { default: Component }
|
||||||
|
| VueConstructor
|
||||||
|
| { default: VueConstructor }
|
||||||
export type I18nDescription = string | { 'zh-CN': string; [key: string]: string }
|
export type I18nDescription = string | { 'zh-CN': string; [key: string]: string }
|
||||||
export type WithName = {
|
export type WithName = {
|
||||||
name: string
|
name: string
|
||||||
|
|||||||
@ -177,10 +177,22 @@ export const matchUrlPattern = (pattern: string | RegExp) => (
|
|||||||
* @param module Vue组件模块对象
|
* @param module Vue组件模块对象
|
||||||
* @param target 组件的挂载目标元素, 省略时不挂载直接返回
|
* @param target 组件的挂载目标元素, 省略时不挂载直接返回
|
||||||
*/
|
*/
|
||||||
export const mountVueComponent = <T>(module: VueModule, target?: Element | string) => {
|
export const mountVueComponent = <T>(
|
||||||
const instance = new Vue('default' in module ? module.default : module)
|
module: VueModule,
|
||||||
// const instance = new Vue({ render: h => h('default' in module ? module.default : module) })
|
target?: Element | string,
|
||||||
return instance.$mount(target) as Vue & T
|
): Vue & T => {
|
||||||
|
const obj = 'default' in module ? module.default : module
|
||||||
|
const getInstance = (o: any) => {
|
||||||
|
if (o instanceof Function) {
|
||||||
|
// eslint-disable-next-line new-cap
|
||||||
|
return new o()
|
||||||
|
}
|
||||||
|
if (o.functional) {
|
||||||
|
return new (Vue.extend(o))()
|
||||||
|
}
|
||||||
|
return new Vue(o)
|
||||||
|
}
|
||||||
|
return getInstance(obj).$mount(target) as Vue & T
|
||||||
}
|
}
|
||||||
/** 是否处于其他网站的内嵌播放器中 */
|
/** 是否处于其他网站的内嵌播放器中 */
|
||||||
export const isEmbeddedPlayer = () => window.location.host === 'player.bilibili.com' || document.URL.startsWith('https://www.bilibili.com/html/player.html')
|
export const isEmbeddedPlayer = () => window.location.host === 'player.bilibili.com' || document.URL.startsWith('https://www.bilibili.com/html/player.html')
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user