mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge pull request #3805 from LonelySteve/speed-fixes
fix(extend-speed): 修复3.x播放器1.5x倍速可能无法点击的问题
This commit is contained in:
commit
79d619467d
@ -45,7 +45,10 @@ export class EntrySpeedComponent<O = Record<string, unknown>> implements EntryCo
|
||||
decreaseVideoSpeed: 'decrease',
|
||||
}
|
||||
|
||||
constructor(protected readonly entryContext: EntryContext) {
|
||||
constructor(
|
||||
protected readonly entryContext: EntryContext,
|
||||
protected readonly enabled$: Subject<boolean>,
|
||||
) {
|
||||
lodash.assign(this, entryContext, {
|
||||
options: entryContext.settings.options,
|
||||
})
|
||||
@ -169,7 +172,9 @@ EntrySpeedComponent.create = function create(metadata) {
|
||||
return {
|
||||
...metadata,
|
||||
entry: (entryContext: EntryContext) => {
|
||||
const component: EntrySpeedComponent | Error = lodash.attempt(() => new this(entryContext))
|
||||
const component: EntrySpeedComponent | Error = lodash.attempt(
|
||||
() => new this(entryContext, enabled$),
|
||||
)
|
||||
|
||||
if (component instanceof Error) {
|
||||
logError(component)
|
||||
@ -182,7 +187,7 @@ EntrySpeedComponent.create = function create(metadata) {
|
||||
shareBuildArgument$.next(component)
|
||||
})
|
||||
|
||||
shareBuildArgument$.next(component)
|
||||
enabled$.next(true)
|
||||
|
||||
getHook(`speed.component.${metadata.name}`).after(component)
|
||||
|
||||
|
||||
@ -4,12 +4,13 @@ import { Toast } from '@/core/toast'
|
||||
import { dea, des } from '@/core/utils'
|
||||
import { logError } from '@/core/utils/log'
|
||||
import { ascendingSort } from '@/core/utils/sort'
|
||||
import { fromEvent, PublishContext, TeardownLogic } from '../common/mini-rxjs'
|
||||
import { fromEvent, PublishContext, Subject, TeardownLogic } from '../common/mini-rxjs'
|
||||
import { debounceTime } from '../common/mini-rxjs/operators/debounceTime'
|
||||
import { filter } from '../common/mini-rxjs/operators/filter'
|
||||
import { asapScheduler, observeOn } from '../common/mini-rxjs/operators/observeOn'
|
||||
import { loadStyle } from '../common/mini-rxjs/utils/loadStyle'
|
||||
import {
|
||||
EntryContext,
|
||||
EntrySpeedComponent,
|
||||
MAX_BROWSER_SPEED_VALUE,
|
||||
MIN_BROWSER_SPEED_VALUE,
|
||||
@ -123,6 +124,17 @@ export class ExtendSpeedComponent extends EntrySpeedComponent<Options> {
|
||||
return trimLeadingDot(PLAYER_AGENT.custom.speedMenuItem.selector)
|
||||
}
|
||||
|
||||
constructor(entryContext: EntryContext, enabled$: Subject<boolean>) {
|
||||
super(entryContext, enabled$)
|
||||
|
||||
this.enabled$.subscribe(
|
||||
loadStyle({
|
||||
name: 'fix-after-element',
|
||||
style: enabled => enabled && '.bpx-player-ctrl-playbackrate-menu:after { display: none; }',
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
addSpeedValue(value: number) {
|
||||
this.options.extendSpeedList = lodash.sortedUniq(
|
||||
this.options.extendSpeedList.concat(value).sort(ascendingSort()),
|
||||
@ -337,7 +349,6 @@ export class ExtendSpeedComponent extends EntrySpeedComponent<Options> {
|
||||
${PLAYER_AGENT.custom.speedMenuList.selector} {
|
||||
display: flex !important; /* 防止3.X样式覆盖 */
|
||||
flex-direction: column;
|
||||
justify-content: center; /* 添加倍速那一项,当鼠标在上半部分会有莫名其妙的'mouseleave', 用这个修复 */
|
||||
overflow-y: auto;
|
||||
max-height: ${maxMenuHeight}px;
|
||||
visibility: hidden;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user