mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge pull request #1582 from LonelySteve/features/video-speed
倍数菜单修复与增强
This commit is contained in:
commit
4d67fbf9f2
@ -77,6 +77,7 @@ export const getExtraSpeedMenuItemElements = async () => {
|
|||||||
afterElement = afterElement.nextElementSibling as HTMLLIElement;
|
afterElement = afterElement.nextElementSibling as HTMLLIElement;
|
||||||
}
|
}
|
||||||
afterElement.before(createExtendedSpeedMenuItemElement(value))
|
afterElement.before(createExtendedSpeedMenuItemElement(value))
|
||||||
|
updateInput(input)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -140,6 +141,8 @@ export const getExtraSpeedMenuItemElements = async () => {
|
|||||||
.${VideoSpeedController.classNameMap.speedMenuList} {
|
.${VideoSpeedController.classNameMap.speedMenuList} {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
overflow-y: auto;
|
||||||
|
max-height: 360px;
|
||||||
}
|
}
|
||||||
`, "extend-video-speed-style")
|
`, "extend-video-speed-style")
|
||||||
|
|
||||||
|
|||||||
@ -118,7 +118,7 @@ export class VideoSpeedController {
|
|||||||
const { getExtraSpeedMenuItemElements } = await import("./extend-video-speed")
|
const { getExtraSpeedMenuItemElements } = await import("./extend-video-speed")
|
||||||
const { calcOrder } = await import("./video-speed-common")
|
const { calcOrder } = await import("./video-speed-common")
|
||||||
// 有必要传递之前的 nativeSpeedVal,跨分 P 时原生倍数将保持一样
|
// 有必要传递之前的 nativeSpeedVal,跨分 P 时原生倍数将保持一样
|
||||||
const controller = await VideoSpeedController.getInstance(sharedSpeed)
|
const controller = await VideoSpeedController.getInstance(sharedSpeed, sharedNativeSpeed)
|
||||||
containerElement = controller.containerElement
|
containerElement = controller.containerElement
|
||||||
if (containerElement.classList.contains("extended")) {
|
if (containerElement.classList.contains("extended")) {
|
||||||
return
|
return
|
||||||
@ -128,7 +128,7 @@ export class VideoSpeedController {
|
|||||||
// 为所有原生倍速菜单项设置 Order
|
// 为所有原生倍速菜单项设置 Order
|
||||||
controller._menuListElement.querySelectorAll(`.${VideoSpeedController.classNameMap.speedMenuItem}[data-value]:not(.extended)`).forEach(
|
controller._menuListElement.querySelectorAll(`.${VideoSpeedController.classNameMap.speedMenuItem}[data-value]:not(.extended)`).forEach(
|
||||||
(it: HTMLLIElement) => { it.style.order = calcOrder(parseFloat(it.getAttribute("data-value")!)) }
|
(it: HTMLLIElement) => { it.style.order = calcOrder(parseFloat(it.getAttribute("data-value")!)) }
|
||||||
);
|
)
|
||||||
// 如果开启了扩展倍数,存在一种场景使倍数设置会失效:
|
// 如果开启了扩展倍数,存在一种场景使倍数设置会失效:
|
||||||
// 1. 用户从原生支持的倍数切换到扩展倍数
|
// 1. 用户从原生支持的倍数切换到扩展倍数
|
||||||
// 2. 用户从扩展倍数切换到之前选中的原生倍数
|
// 2. 用户从扩展倍数切换到之前选中的原生倍数
|
||||||
@ -296,7 +296,7 @@ export class VideoSpeedController {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
VideoSpeedController.forgetSpeed()
|
VideoSpeedController.forgetSpeed()
|
||||||
this.setVideoSpeed(VideoSpeedController.fallbackVideoSpeed)
|
this.setVideoSpeed(fallbackVideoSpeed)
|
||||||
} else {
|
} else {
|
||||||
this.setVideoSpeed(1)
|
this.setVideoSpeed(1)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user