mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
fix: resolve 网页链接打开无法跳转到视频页,并且主题失效 #166
This commit is contained in:
@@ -32,6 +32,8 @@ function isSupportedPages() {
|
||||
|| /https?:\/\/www.bilibili.com\/index.html$/.test(currentUrl)
|
||||
|| /https?:\/\/bilibili.com\/\?spm_id_from=.*/.test(currentUrl)
|
||||
|| /https?:\/\/www.bilibili.com\/\?spm_id_from=(.)*/.test(currentUrl)
|
||||
// fix #166 https://github.com/hakadao/BewlyBewly/issues/166
|
||||
|| /https?:\/\/www.bilibili.com\/\?bvid=.*$/.test(currentUrl)
|
||||
|
||||
// video page
|
||||
|| /https?:\/\/(www.)?bilibili.com\/video\/.*/.test(currentUrl)
|
||||
|
||||
@@ -12,7 +12,7 @@ import WatchLater from './WatchLater/WatchLater.vue'
|
||||
import Favorites from './Favorites/Favorites.vue'
|
||||
import { accessKey, settings } from '~/logic'
|
||||
import { AppPage, LanguageType } from '~/enums/appEnums'
|
||||
import { getUserID, hexToRGBA, isHomePage, smoothScrollToTop } from '~/utils/main'
|
||||
import { getUserID, hexToRGBA, isHomePage, openLinkToNewTab, smoothScrollToTop } from '~/utils/main'
|
||||
import emitter from '~/utils/mitt'
|
||||
|
||||
const activatedPage = ref<AppPage>(settings.value.dockItemVisibilityList.find(e => e.visible === true)?.page ?? AppPage.Home)
|
||||
@@ -91,6 +91,8 @@ watch(() => settings.value.adaptToOtherPageStyles, () => {
|
||||
})
|
||||
|
||||
onMounted(() => {
|
||||
openVideoPageIfBvidExists()
|
||||
|
||||
if (isHomePage()) {
|
||||
// Force overwrite Bilibili Evolved body tag & html tag background color
|
||||
document.body.style.setProperty('background-color', 'unset', 'important')
|
||||
@@ -237,6 +239,20 @@ function handleOsScroll() {
|
||||
topBarRef.value?.handleScroll()
|
||||
}
|
||||
|
||||
// fix #166 https://github.com/hakadao/BewlyBewly/issues/166
|
||||
function openVideoPageIfBvidExists() {
|
||||
// Assume the URL is https://www.bilibili.com/?bvid=BV1be41127ft&spm_id_from=333.788.seo.out
|
||||
|
||||
// Get the current URL's query string
|
||||
const queryString = window.location.search
|
||||
// Create a URLSearchParams instance
|
||||
const urlParams = new URLSearchParams(queryString)
|
||||
const bvid = urlParams.get('bvid')
|
||||
|
||||
if (bvid)
|
||||
window.open(`https://www.bilibili.com/video/${bvid}`, '_self')
|
||||
}
|
||||
|
||||
provide('handleBackToTop', handleBackToTop)
|
||||
provide('handleRefresh', handleRefresh)
|
||||
provide('activatedPage', activatedPage)
|
||||
|
||||
Reference in New Issue
Block a user