From 06382e10e2049934f3b2cccacf4c39fe48874a3b Mon Sep 17 00:00:00 2001 From: Hakadao Date: Mon, 1 Jul 2024 01:05:18 +0800 Subject: [PATCH] feat: recommendation mode filter setting (#840) * feat: Add filter options for view count and duration in settings * chore: update styles && rename func.ts to useFilter.ts * feat: Add scrollbar check to determine if the viewport has a scrollbar * feat: app recommendation filters * chore: update * feat: i18n support --------- Co-authored-by: pengyunfei --- src/_locales/cmn-CN.yml | 7 ++ src/_locales/cmn-TW.yml | 7 ++ src/_locales/en.yml | 7 ++ src/_locales/jyut.yml | 7 ++ src/components/Input.vue | 23 +++-- src/components/Settings/components/Home.vue | 36 +++++++ src/composables/useAppProvider.ts | 1 + src/composables/useFilter.ts | 95 +++++++++++++++++++ src/contentScripts/views/App.vue | 12 +++ .../views/Home/components/ForYou.vue | 23 ++++- src/logic/storage.ts | 11 +++ 11 files changed, 218 insertions(+), 11 deletions(-) create mode 100644 src/composables/useFilter.ts diff --git a/src/_locales/cmn-CN.yml b/src/_locales/cmn-CN.yml index 4dfb8feb..45471ef3 100644 --- a/src/_locales/cmn-CN.yml +++ b/src/_locales/cmn-CN.yml @@ -49,6 +49,9 @@ settings: group_logo: LOGO group_search_bar: 搜索栏 group_recommendation_mode: 推荐模式 + group_recommendation_filters: 推荐过滤 + group_recommendation_filters_desc: | + 请勿将限制值设置得太大,不然可能会增加加载时间! group_search_page_mode: 搜索页模式 group_home_tabs: 首页标签栏 @@ -137,6 +140,10 @@ settings: 授权使用后能在首页推送 bilibili App 端算法的推荐视频,授权 key 有效期约为一个月,过后记得重新授权获取 access key。 authorize_app_more_info_access_key: 关于 access key scan_qrcode_desc: 使用 Bilibili 移动应用程序扫描此二维码,以授权获取 access key。 + filter_by_view_count: 按播放数筛选 + filter_by_view_count_unit: 次 + filter_by_duration: 按时长筛选 + filter_by_duration_unit: 秒 use_search_page_mode: 首页使用搜索页模式 settings_shared_with_the_search_page: 与搜索页共用的配置 settings_shared_with_the_search_page_desc: 这些设置都与搜索页共用 diff --git a/src/_locales/cmn-TW.yml b/src/_locales/cmn-TW.yml index 75703ce2..ee95978c 100644 --- a/src/_locales/cmn-TW.yml +++ b/src/_locales/cmn-TW.yml @@ -50,6 +50,9 @@ settings: group_search_bar: 搜尋欄 group_recommendation_mode: 推薦模式 group_search_page_mode: 搜尋頁模式 + group_recommendation_filters: 推薦過濾 + group_recommendation_filters_desc: | + 限制的數值不要設太大,不然載入時間可能會增加! group_home_tabs: 首頁標籤欄 # Settings buttons @@ -140,6 +143,10 @@ settings: key。 authorize_app_more_info_access_key: 關於 access key scan_qrcode_desc: 使用 Bilibili 手機應用程式掃描這個QR碼,以授權取得 access key。 + filter_by_view_count: 按觀看次數篩選 + filter_by_view_count_unit: 次 + filter_by_duration: 按影片長度篩選 + filter_by_duration_unit: 秒 use_search_page_mode: 首頁使用搜尋頁模式 settings_shared_with_the_search_page: 與搜尋頁共用的設定 settings_shared_with_the_search_page_desc: 這些設定都與搜尋頁共用 diff --git a/src/_locales/en.yml b/src/_locales/en.yml index f516f4c3..f4049739 100644 --- a/src/_locales/en.yml +++ b/src/_locales/en.yml @@ -49,6 +49,9 @@ settings: group_logo: LOGO group_search_bar: Search Bar group_recommendation_mode: Recommendation Mode + group_recommendation_filters: Recommendation Filters + group_recommendation_filters_desc: | + Do not set the restricted value too large, as this may increase loading time! group_search_page_mode: Search Page Mode group_home_tabs: Home Tabs @@ -138,6 +141,10 @@ settings: The access key is valid for about one month. After that, remember to re-authorize the BewlyBewly to use the access key. authorize_app_more_info_access_key: More information about the access key scan_qrcode_desc: Use the Bilibili mobile app to scan this QR code in order to authorize the access key. + filter_by_view_count: Filter by view count + filter_by_view_count_unit: views + filter_by_duration: Filter by duration + filter_by_duration_unit: sec use_search_page_mode: Use search page mode on homepage settings_shared_with_the_search_page: Settings shared with the search page settings_shared_with_the_search_page_desc: Those settings are used in common with the search page diff --git a/src/_locales/jyut.yml b/src/_locales/jyut.yml index 013fb35a..f7ea4b9e 100644 --- a/src/_locales/jyut.yml +++ b/src/_locales/jyut.yml @@ -49,6 +49,9 @@ settings: group_logo: LOGO group_search_bar: 搜尋欄 group_recommendation_mode: 推介模式 + group_recommendation_filters: 推介篩選 + group_recommendation_filters_desc: | + 限制嘅數值唔好設太大,唔係嘅話會影響載入時間! group_search_page_mode: 搵嘢頁模式 group_home_tabs: 主頁分頁欄 @@ -140,6 +143,10 @@ settings: access key。 authorize_app_more_info_access_key: 關於 access key scan_qrcode_desc: 用 Bilibili 流動應用程式去 scan 呢個 QR code 愛嚟授權取得 access key。 + filter_by_view_count: 根據觀看次數篩選 + filter_by_view_count_unit: 次 + filter_by_duration: 根據條片長度篩選 + filter_by_duration_unit: 秒 use_search_page_mode: 主頁使用搵嘢頁模式 settings_shared_with_the_search_page: 同搵嘢頁共用嘅設定 settings_shared_with_the_search_page_desc: 呢啲設定都同搵嘢頁共用 diff --git a/src/components/Input.vue b/src/components/Input.vue index e580f59a..cc6d6b6f 100644 --- a/src/components/Input.vue +++ b/src/components/Input.vue @@ -3,6 +3,9 @@ type Size = 'small' | 'medium' | 'large' interface Props { modelValue: string size?: Size + type?: 'text' | 'password' | 'email' | 'number' + min?: number + max?: number } const props = withDefaults(defineProps(), { size: 'medium' }) @@ -16,15 +19,21 @@ onMounted(() => {