From b5e74659697c463d0221b21c6d19652a90308e7e Mon Sep 17 00:00:00 2001 From: starknt <1431880400@qq.com> Date: Sat, 27 Jan 2024 17:37:23 +0800 Subject: [PATCH 1/3] fix: handle top bar video part --- src/components/TopBar/components/HistoryPop.vue | 2 ++ src/components/TopBar/types.ts | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/components/TopBar/components/HistoryPop.vue b/src/components/TopBar/components/HistoryPop.vue index f196a27a..35f29a54 100644 --- a/src/components/TopBar/components/HistoryPop.vue +++ b/src/components/TopBar/components/HistoryPop.vue @@ -115,6 +115,8 @@ function getHistoryUrl(item: HistoryItem) { if (activatedTab.value === 0) { if (item.history.business === HistoryType.PGC) return item.uri + if (item.history.business === HistoryType.Archive && item?.videos && item.videos > 0) + return `//www.bilibili.com/video/${item.history.bvid}?p=${item.history.page}` return `//www.bilibili.com/video/${item.history.bvid}` } // Live diff --git a/src/components/TopBar/types.ts b/src/components/TopBar/types.ts index 07617036..27b6a6a8 100644 --- a/src/components/TopBar/types.ts +++ b/src/components/TopBar/types.ts @@ -93,9 +93,11 @@ export interface HistoryItem { epid?: number bvid?: string part?: string + page?: number oid: number cid: number } + videos?: number author_name: string author_face: string author_mid: string From c62f2c604c7043b22d03bbab0498d16ad20121b5 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sat, 27 Jan 2024 23:52:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20adjust=20text=20in=20`MomentsPop`=20?= =?UTF-8?q?[=E5=BB=BA=E8=AE=AE]=20=E5=A2=9E=E5=8A=A0=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=B7=AE=E5=88=86=20#226?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/_locales/cmn-CN.yml | 1 + src/_locales/cmn-TW.yml | 1 + src/_locales/en.yml | 1 + src/_locales/jyut.yml | 3 ++- src/components/TopBar/components/MomentsPop.vue | 9 +++++---- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/_locales/cmn-CN.yml b/src/_locales/cmn-CN.yml index 21fc6fef..115b30d8 100644 --- a/src/_locales/cmn-CN.yml +++ b/src/_locales/cmn-CN.yml @@ -214,6 +214,7 @@ topbar: live: 直播 articles: 专栏 uploaded: 上传了: + now_streaming: 正在直播: live_status: 直播中 upload_dropdown: article: 专栏 diff --git a/src/_locales/cmn-TW.yml b/src/_locales/cmn-TW.yml index e77cc172..5428ca1f 100644 --- a/src/_locales/cmn-TW.yml +++ b/src/_locales/cmn-TW.yml @@ -217,6 +217,7 @@ topbar: live: 直播 articles: 文章 uploaded: 上傳了: + now_streaming: 正在直播: live_status: 直播中 upload_dropdown: article: 上傳文章 diff --git a/src/_locales/en.yml b/src/_locales/en.yml index be456657..788823ff 100644 --- a/src/_locales/en.yml +++ b/src/_locales/en.yml @@ -215,6 +215,7 @@ topbar: live: Live articles: Articles uploaded: 'uploaded: ' + now_streaming: 'now streaming: ' live_status: LIVE upload_dropdown: article: Article diff --git a/src/_locales/jyut.yml b/src/_locales/jyut.yml index f1d91580..28cfce2d 100644 --- a/src/_locales/jyut.yml +++ b/src/_locales/jyut.yml @@ -217,7 +217,8 @@ topbar: live: 直播 articles: 文章 uploaded: po 咗: - live_status: 直播緊 + now_streaming: 開緊 live: + live_status: Live 緊 upload_dropdown: article: 寫文 music: 擺音樂 diff --git a/src/components/TopBar/components/MomentsPop.vue b/src/components/TopBar/components/MomentsPop.vue index 2ffbfeb7..42128575 100644 --- a/src/components/TopBar/components/MomentsPop.vue +++ b/src/components/TopBar/components/MomentsPop.vue @@ -325,7 +325,7 @@ function toggleWatchLater(aid: number) { /> - - +
- {{ `${moment.name} ${t('topbar.moments_dropdown.uploaded')}` }} + {{ `${moment.name} ${t('topbar.moments_dropdown.uploaded')}` }} + {{ `${moment.name} ${t('topbar.moments_dropdown.now_streaming')}` }}
{{ moment.title }}
@@ -446,7 +447,7 @@ function toggleWatchLater(aid: number) {
-
+ From e73ae0e3a6deb26f847952e804c8f6514881fa80 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 28 Jan 2024 01:54:54 +0800 Subject: [PATCH 3/3] fix: handle `History` video url location part #223 --- src/components/TopBar/components/HistoryPop.vue | 2 +- src/contentScripts/views/History/History.vue | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/TopBar/components/HistoryPop.vue b/src/components/TopBar/components/HistoryPop.vue index 35f29a54..d33f2c3b 100644 --- a/src/components/TopBar/components/HistoryPop.vue +++ b/src/components/TopBar/components/HistoryPop.vue @@ -114,7 +114,7 @@ function getHistoryUrl(item: HistoryItem) { // Video if (activatedTab.value === 0) { if (item.history.business === HistoryType.PGC) - return item.uri + return removeHttpFromUrl(item.uri) if (item.history.business === HistoryType.Archive && item?.videos && item.videos > 0) return `//www.bilibili.com/video/${item.history.bvid}?p=${item.history.page}` return `//www.bilibili.com/video/${item.history.bvid}` diff --git a/src/contentScripts/views/History/History.vue b/src/contentScripts/views/History/History.vue index fadd1747..15b25863 100644 --- a/src/contentScripts/views/History/History.vue +++ b/src/contentScripts/views/History/History.vue @@ -2,7 +2,6 @@ import { useDateFormat } from '@vueuse/core' import { useI18n } from 'vue-i18n' -// import type { HistoryItem } from './types' import { getCSRF, openLinkToNewTab, removeHttpFromUrl } from '~/utils/main' import { calcCurrentTime } from '~/utils/dataFormatter' import emitter from '~/utils/mitt' @@ -158,8 +157,10 @@ function getHistoryUrl(item: HistoryItem) { return removeHttpFromUrl(item.uri) } // video - else if (item.history.business === 'archive') { - return removeHttpFromUrl(item.history.bvid) + else if (item.history.business === Business.ARCHIVE) { + if (item?.videos && item.videos > 0) + return `//www.bilibili.com/video/${item.history.bvid}?p=${item.history.page}` + return item.history.bvid } else if (item.history.business === 'live') { return `//live.bilibili.com/${item.history.oid}`