Fix hyperlinks by opening a new tab in background using browser.tabs

pull/57/head
G1org1owo 2024-07-10 22:52:47 +02:00
parent 76a4c01577
commit 3300a1f01c
1 changed files with 13 additions and 6 deletions

View File

@ -384,6 +384,10 @@ function getUpdatedTagsText(count: number) {
return `Updated ${count} tag${count > 1 ? "s" : ""}`; return `Updated ${count} tag${count > 1 ? "s" : ""}`;
} }
async function openNewTab(url: string) {
browser.tabs.create({url, active:false});
}
function onResolutionLoaded(res: any) { function onResolutionLoaded(res: any) {
// This no longer checks for `!pop.selectedPost.resolution` because the resolution can change if the contentUrl is updated. // This no longer checks for `!pop.selectedPost.resolution` because the resolution can change if the contentUrl is updated.
if (pop.selectedPost) { if (pop.selectedPost) {
@ -416,9 +420,10 @@ useDark();
</div> </div>
<div v-if="instanceSpecificData?.reverseSearchResult?.exactPostId" class="bg-danger has-merge-button"> <div v-if="instanceSpecificData?.reverseSearchResult?.exactPostId" class="bg-danger has-merge-button">
<a :href="getActiveSitePostUrl(instanceSpecificData.reverseSearchResult?.exactPostId)"> <a href="#"
Post already uploaded ({{ instanceSpecificData.reverseSearchResult.exactPostId }}) @click.prevent="openNewTab(getActiveSitePostUrl(instanceSpecificData.reverseSearchResult?.exactPostId))"
</a> >Post already uploaded ({{ instanceSpecificData.reverseSearchResult.exactPostId }}) </a
>
<!-- TODO: Maybe a 5px gap here? --> <!-- TODO: Maybe a 5px gap here? -->
@ -460,8 +465,9 @@ useDark();
" "
class="bg-success" class="bg-success"
> >
<a :href="getActiveSitePostUrl(instanceSpecificData.uploadState.instancePostId)" <a href="#"
>Uploaded post {{ instanceSpecificData.uploadState.instancePostId }}</a @click="openNewTab(getActiveSitePostUrl(instanceSpecificData.uploadState.instancePostId))"
>Uploaded post {{ instanceSpecificData.uploadState.instancePostId }} </a
> >
</div> </div>
@ -515,7 +521,8 @@ useDark();
:key="similarPost.id" :key="similarPost.id"
class="has-merge-button" class="has-merge-button"
> >
<a :href="getActiveSitePostUrl(similarPost.id)" <a href="#"
@click.prevent="openNewTab(getActiveSitePostUrl(similarPost.id))"
>Post {{ similarPost.id }} looks {{ similarPost.percentage }}% similar</a >Post {{ similarPost.id }} looks {{ similarPost.percentage }}% similar</a
> >