mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Merge pull request #4188 from ZiuChen/preview-fixes
fix: 修正播放器模式切换时 body类名响应问题
This commit is contained in:
commit
e3f53afa88
@ -5,11 +5,9 @@ let cancel: () => void
|
||||
const prevent = () => {
|
||||
cancel?.()
|
||||
cancel = preventEvent(unsafeWindow, 'mousewheel', () => {
|
||||
const isFullscreen = [
|
||||
'player-mode-webfullscreen',
|
||||
'player-fullscreen-fix',
|
||||
'player-full-win',
|
||||
].some(token => document.body.classList.contains(token))
|
||||
const isFullscreen = ['player-mode-full', 'player-fullscreen-fix', 'player-full-win'].some(
|
||||
token => document.body.classList.contains(token),
|
||||
)
|
||||
return isFullscreen
|
||||
})
|
||||
}
|
||||
|
||||
@ -11,11 +11,14 @@ const playerModePolyfill = async () => {
|
||||
}
|
||||
attributes(bpxContainer, () => {
|
||||
const dataScreen = bpxContainer.getAttribute('data-screen')
|
||||
document.body.classList.toggle(
|
||||
'player-mode-webfullscreen',
|
||||
dataScreen === 'full' || dataScreen === 'web',
|
||||
)
|
||||
dataScreen === 'wide' ? document.body.classList.add('player-mode-widescreen') : ''
|
||||
const prefix = 'player-mode-'
|
||||
const enumList = ['normal', 'wide', 'web', 'full'].map(it => `${prefix}${it}`)
|
||||
|
||||
// clear all class
|
||||
document.body.classList.remove(...enumList)
|
||||
|
||||
// add class
|
||||
document.body.classList.add(dataScreen !== 'normal' ? `${prefix}${dataScreen}` : '')
|
||||
})
|
||||
}
|
||||
const idPolyfill = async () => {
|
||||
|
||||
@ -145,8 +145,8 @@
|
||||
left: 50%;
|
||||
transform: translateX(-50%) translateY(-50%);
|
||||
}
|
||||
@mixin on-fullscreen($bodyClass: "*") {
|
||||
#{selector-unify("body.player-mode-webfullscreen", $bodyClass)} &,
|
||||
@mixin on-fullscreen($bodyClass: '*') {
|
||||
#{selector-unify("body.player-mode-full", $bodyClass)} &,
|
||||
#{selector-unify("body.player-fullscreen-fix", $bodyClass)} &,
|
||||
#{selector-unify("body.player-full-win", $bodyClass)} & {
|
||||
@content;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user