From aa3c4a7a4e2dfd0518f4e418646d2f3d7f561701 Mon Sep 17 00:00:00 2001 From: Hakadao Date: Thu, 25 Aug 2022 00:42:00 +0800 Subject: [PATCH] chore: --- src/background/apis/history.ts | 13 + src/components/BewSelect.vue | 2 +- src/components/Topbar/HistoryDropdown.vue | 386 ++++++++++++++++++++++ src/contentScripts/index.ts | 2 + 4 files changed, 402 insertions(+), 1 deletion(-) create mode 100644 src/background/apis/history.ts create mode 100644 src/components/Topbar/HistoryDropdown.vue diff --git a/src/background/apis/history.ts b/src/background/apis/history.ts new file mode 100644 index 00000000..d46fc7c7 --- /dev/null +++ b/src/background/apis/history.ts @@ -0,0 +1,13 @@ +import { API_URL } from '.' + +export const setupHistoryAPIs = () => { + browser.runtime.onMessage.addListener((message) => { + if (message.contentScriptQuery === 'getHistoryList') { + const url = `https://${API_URL}/x/web-interface/history/cursor` + return fetch(url) + .then(response => response.json()) + .then(data => (data)) + .catch(error => console.error(error)) + } + }) +} diff --git a/src/components/BewSelect.vue b/src/components/BewSelect.vue index c247ff7e..e0f669d4 100644 --- a/src/components/BewSelect.vue +++ b/src/components/BewSelect.vue @@ -103,7 +103,7 @@ export default defineComponent({ cursor="pointer" @click="onClickOption(option)" > - {{ option.label }} + diff --git a/src/components/Topbar/HistoryDropdown.vue b/src/components/Topbar/HistoryDropdown.vue new file mode 100644 index 00000000..067c0f3f --- /dev/null +++ b/src/components/Topbar/HistoryDropdown.vue @@ -0,0 +1,386 @@ + + + + + diff --git a/src/contentScripts/index.ts b/src/contentScripts/index.ts index 102a775f..abc87a9b 100644 --- a/src/contentScripts/index.ts +++ b/src/contentScripts/index.ts @@ -21,6 +21,8 @@ import { getCookie, i18n, setCookie, SVG_ICONS } from '~/utils' || /https?:\/\/www.bilibili.com\/?$/.test(currentUrl) || /https?:\/\/bilibili.com\/\?spm_id_from=.*/.test(currentUrl) || /https?:\/\/www.bilibili.com\/\?spm_id_from=(.)*/.test(currentUrl) + // || /https?:\/\/www.bilibili.com\/video\/.*/.test(currentUrl) + // || /https?:\/\/bilibili.com\/video\/.*/.test(currentUrl) ) { // if the current homepage is an old version, redirect to the new version // because they had some style errors in the old version