mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix: top bar displayed on the unexpected pages (#1246,#1247,#1248)
closes #1246 #1247 #1248
This commit is contained in:
@@ -31,6 +31,8 @@ if (isFirefox) {
|
||||
const currentUrl = document.URL
|
||||
|
||||
function isSupportedPages(): boolean {
|
||||
if (isInIframe())
|
||||
return false
|
||||
if (
|
||||
// homepage
|
||||
isHomePage()
|
||||
@@ -83,10 +85,23 @@ function isSupportedPages(): boolean {
|
||||
}
|
||||
}
|
||||
|
||||
export function isBlockedPages(): boolean {
|
||||
// Only support dock record original bilibili page
|
||||
export function isSupportedIframePages(): boolean {
|
||||
if (
|
||||
// https://github.com/BewlyBewly/BewlyBewly/issues/1246
|
||||
/https?:\/\/(?:t\.)?bilibili\.com\/share\/card\/index.*/.test(currentUrl)
|
||||
isInIframe()
|
||||
&& (
|
||||
isHomePage()
|
||||
|| /https?:\/\/search\.bilibili\.com\/all.*/.test(currentUrl)
|
||||
|| /https?:\/\/www\.bilibili\.com\/anime.*/.test(currentUrl)
|
||||
|| /https?:\/\/space\.bilibili\.com\/\d+\/favlist.*/.test(currentUrl)
|
||||
|| /https?:\/\/www\.bilibili\.com\/history.*/.test(currentUrl)
|
||||
|| /https?:\/\/www\.bilibili\.com\/watchlater\/#\/list.*/.test(currentUrl)
|
||||
|| (
|
||||
/https?:\/\/t\.bilibili\.com.*/.test(currentUrl)
|
||||
// https://github.com/BewlyBewly/BewlyBewly/issues/1246
|
||||
&& !/https?:\/\/t\.bilibili\.com\/share\/card\/index.*/.test(currentUrl)
|
||||
)
|
||||
)
|
||||
) {
|
||||
return true
|
||||
}
|
||||
@@ -97,7 +112,7 @@ export function isBlockedPages(): boolean {
|
||||
|
||||
let beforeLoadedStyleEl: HTMLStyleElement | undefined
|
||||
|
||||
if (isSupportedPages() && !isBlockedPages()) {
|
||||
if (isSupportedPages() || isSupportedIframePages()) {
|
||||
if (settings.value.adaptToOtherPageStyles)
|
||||
useDark()
|
||||
|
||||
@@ -162,7 +177,7 @@ async function onDOMLoaded() {
|
||||
document.body.appendChild(originalTopBar)
|
||||
}
|
||||
|
||||
if (isSupportedPages() && !isBlockedPages()) {
|
||||
if (isSupportedPages() || isSupportedIframePages()) {
|
||||
// Then inject the app
|
||||
if (isHomePage()) {
|
||||
injectApp()
|
||||
|
||||
Reference in New Issue
Block a user