fix(watch-later): prevent outer link navigation when clicking on video card title or author (#1103)

This commit is contained in:
MidnightCrowing
2024-11-02 12:40:16 +08:00
committed by GitHub
parent 55df22c066
commit e2b3d6dd96

View File

@@ -136,6 +136,18 @@ function handlePlayAll() {
openLinkToNewTab('https://www.bilibili.com/list/watchlater')
}
function handleLinkClick(url: string) {
if (settings.value.videoCardLinkOpenMode === 'drawer') {
openIframeDrawer(url) // 在抽屉打开
}
else if (settings.value.videoCardLinkOpenMode === 'currentTab') {
window.open(url, '_self') // 在当前标签页打开
}
else {
openLinkToNewTab(url) // 在新标签页打开
}
}
function jumpToLoginPage() {
location.href = 'https://passport.bilibili.com/login'
}
@@ -154,11 +166,10 @@ function jumpToLoginPage() {
<a
v-for="(item, index) in currentWatchLaterList"
:key="item.aid"
:href="settings.videoCardLinkOpenMode === 'drawer' ? undefined : `https://www.bilibili.com/list/watchlater?bvid=${item.bvid}`"
:target="settings.videoCardLinkOpenMode === 'currentTab' ? '_self' : '_blank'"
:href="`https://www.bilibili.com/list/watchlater?bvid=${item.bvid}`"
class="group"
flex cursor-pointer
@click="settings.videoCardLinkOpenMode === 'drawer' && openIframeDrawer(`https://www.bilibili.com/list/watchlater?bvid=${item.bvid}`)"
@click.prevent="handleLinkClick(`https://www.bilibili.com/list/watchlater?bvid=${item.bvid}`)"
>
<section
rounded="$bew-radius"
@@ -232,7 +243,7 @@ function jumpToLoginPage() {
class="keep-two-lines"
overflow="hidden"
un-text="lg overflow-ellipsis"
:href="removeHttpFromUrl(`https://www.bilibili.com/list/watchlater?bvid=${item.bvid}`)" target="_blank"
@click.stop.prevent="handleLinkClick(`https://www.bilibili.com/list/watchlater?bvid=${item.bvid}`)"
>
{{ item.title }}
</a>
@@ -249,6 +260,7 @@ function jumpToLoginPage() {
duration-300
pr-2
:href="`//space.bilibili.com/${item.owner.mid}`" target="_blank"
@click.stop
>
<img
:src="removeHttpFromUrl(`${item.owner.face}@40w_40h_1c`)"