Merge pull request #2734 from FoundTheWOUT/upstream-preview

Fix default-mode
This commit is contained in:
Grant Howard 2021-12-18 10:00:04 +08:00 committed by GitHub
commit a391e46ba7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 9 deletions

View File

@ -108,5 +108,8 @@
"**/dev": true,
"**/dist": true,
"**/yarn.lock": true
}
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
}

View File

@ -41,16 +41,18 @@ const entry: ComponentEntry = async ({ settings: { options } }) => {
return
}
const action = actions.get(options.mode)
const onplay = () => {
const isNormalMode = !dq('body[class*=player-mode-]')
if (isNormalMode) {
action()
}
}
// https://github.com/the1812/Bilibili-Evolved/issues/2408
// 也许以前切P是会刷新页面但现在(2.7+)的播放器切P是不刷新页面的所以不需要判断
// const onplay = () => {
// const isNormalMode = !dq('body[class*=player-mode-]')
// if (isNormalMode) {
// action()
// }
// }
if (options.applyOnPlay && !playerAgent.isAutoPlay()) {
video.addEventListener('play', onplay, { once: true })
video.addEventListener('play', action, { once: true })
} else {
onplay()
action()
}
}
export const component: ComponentMetadata = {