fix: fix current Url variable undefined issue

This commit is contained in:
Hakadao
2023-09-19 17:05:43 +08:00
parent c442f88064
commit 798a7354e3

View File

@@ -28,25 +28,28 @@ if (isFirefox) {
injectApp()
isFirstScriptExecute = false
})
// Handling for video page to prevent the issue of video being played but the page remaining empty
if (
// video page
/https?:\/\/(www.)?bilibili.com\/video\/.*/.test(currentUrl)
// watch later playlist
|| /https?:\/\/(www.)?bilibili.com\/list\/watchlater.*/.test(currentUrl)
// favorite playlist
|| /https?:\/\/(www.)?bilibili.com\/list\/ml.*/.test(currentUrl)
) {
setTimeout(() => {
document.documentElement.removeChild(beforeLoadedStyleEl)
}, 800)
}
else {
window.onload = () => {
document.documentElement.removeChild(beforeLoadedStyleEl)
const currentUrl = document.URL
// Handling for video page to prevent the issue of video being played but the page remaining empty
if (
// video page
/https?:\/\/(www.)?bilibili.com\/video\/.*/.test(currentUrl)
// watch later playlist
|| /https?:\/\/(www.)?bilibili.com\/list\/watchlater.*/.test(currentUrl)
// favorite playlist
|| /https?:\/\/(www.)?bilibili.com\/list\/ml.*/.test(currentUrl)
) {
setTimeout(() => {
document.documentElement.removeChild(beforeLoadedStyleEl)
}, 800)
}
}
else {
window.onload = () => {
document.documentElement.removeChild(beforeLoadedStyleEl)
}
}
})
}
else {
document.addEventListener('DOMContentLoaded', () => {