mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
feat(settings): search bar link opening behavior
This commit is contained in:
@@ -118,24 +118,26 @@ settings:
|
||||
Bilibili 默认会专门处理中文标点符号以实现左对齐。
|
||||
如果你正在使用自定义字体,建议移除缩进。
|
||||
|
||||
video_card_link_opening_behavior: 视频卡片和番剧卡片链接打开行为
|
||||
video_card_link_opening_behavior_opt:
|
||||
drawer: 抽屉打开
|
||||
new_tab: 新标签页
|
||||
enable_video_preview: 启用视频预览功能(如果可以的话)
|
||||
enable_video_ctrl_bar_on_video_card: 在视频卡片上显示视频控制栏
|
||||
hover_video_card_delayed: 将鼠标悬停在视频卡片上时延迟视频预览
|
||||
block_ads: 屏蔽广告
|
||||
disable_frosted_glass: 禁用毛玻璃效果
|
||||
reduce_frosted_glass_blur: 降低毛玻璃模糊强度
|
||||
|
||||
# Desktop & Dock
|
||||
use_old_top_bar: 使用旧版顶栏
|
||||
top_bar_link_opening_behavior: 顶栏链接打开行为
|
||||
top_bar_link_opening_behavior_opt:
|
||||
link_opening_behavior_opt:
|
||||
current_tab: 当前标签页
|
||||
current_tab_if_not_homepage: 不在首页则当前标签页打开,否则在新标签页
|
||||
new_tab: 新标签页
|
||||
drawer: 抽屉打开
|
||||
top_bar_link_opening_behavior: 顶栏链接打开行为
|
||||
video_card_link_opening_behavior: 视频卡片和番剧卡片链接打开行为
|
||||
search_bar_link_opening_behavior: 搜索栏链接打开行为
|
||||
|
||||
block_ads: 屏蔽广告
|
||||
|
||||
enable_video_preview: 启用视频预览功能(如果可以的话)
|
||||
enable_video_ctrl_bar_on_video_card: 在视频卡片上显示视频控制栏
|
||||
hover_video_card_delayed: 将鼠标悬停在视频卡片上时延迟视频预览
|
||||
|
||||
# Desktop & Dock
|
||||
use_old_top_bar: 使用旧版顶栏
|
||||
auto_hide_top_bar: 自动隐藏顶栏
|
||||
top_bar_icon_badges: 图标角标
|
||||
top_bar_icon_badges_opt:
|
||||
|
||||
@@ -118,24 +118,26 @@ settings:
|
||||
Bilibili 預設會特別處理中文標點符號以達到左對齊。
|
||||
如果你正在使用自訂字型,建議移除縮排。
|
||||
|
||||
video_card_link_opening_behavior: 影片和番劇卡片連結開啟行為
|
||||
video_card_link_opening_behavior_opt:
|
||||
drawer: 抽屜開啟
|
||||
new_tab: 新索引標籤
|
||||
enable_video_preview: 啟用影片預覽功能(如果可以的話)
|
||||
enable_video_ctrl_bar_on_video_card: 在影片卡片上顯示影片控制欄
|
||||
hover_video_card_delayed: 將滑鼠懸停在影片卡片上時延遲影片預覽
|
||||
block_ads: 封鎖廣告
|
||||
disable_frosted_glass: 停用毛玻璃效果
|
||||
reduce_frosted_glass_blur: 降低毛玻璃模糊強度
|
||||
|
||||
# Desktop and Dock
|
||||
use_old_top_bar: 使用舊版頂欄
|
||||
top_bar_link_opening_behavior: 頂欄連結開啟行為
|
||||
top_bar_link_opening_behavior_opt:
|
||||
link_opening_behavior_opt:
|
||||
current_tab: 目前索引標籤
|
||||
current_tab_if_not_homepage: 不在首頁則在目前索引標籤開啟,否則在新索引標籤
|
||||
new_tab: 新索引標籤
|
||||
drawer: 抽屜開啟
|
||||
top_bar_link_opening_behavior: 頂欄連結開啟行為
|
||||
video_card_link_opening_behavior: 影片和番劇卡片連結開啟行為
|
||||
search_bar_link_opening_behavior: 搜尋欄連結開啟行為
|
||||
|
||||
block_ads: 封鎖廣告
|
||||
|
||||
enable_video_preview: 啟用影片預覽功能(如果可以的話)
|
||||
enable_video_ctrl_bar_on_video_card: 在影片卡片上顯示影片控制欄
|
||||
hover_video_card_delayed: 將滑鼠懸停在影片卡片上時延遲影片預覽
|
||||
|
||||
# Desktop and Dock
|
||||
use_old_top_bar: 使用舊版頂欄
|
||||
auto_hide_top_bar: 自動隱藏頂欄
|
||||
top_bar_icon_badges: 圖示標記樣式
|
||||
top_bar_icon_badges_opt:
|
||||
|
||||
@@ -118,24 +118,26 @@ settings:
|
||||
By default, Bilibili will specifically handle Chinese punctuation to achieve left alignment.
|
||||
If you are using a custom font, it is recommended to remove the indent.
|
||||
|
||||
video_card_link_opening_behavior: Video card and bangumi card link opening behavior
|
||||
video_card_link_opening_behavior_opt:
|
||||
drawer: Open in drawer
|
||||
new_tab: New tab
|
||||
enable_video_preview: Enable video preview feature (if possible)
|
||||
enable_video_ctrl_bar_on_video_card: Display the video control bar on the video card
|
||||
hover_video_card_delayed: Delayed video preview on hover over the video card
|
||||
block_ads: Block ads
|
||||
disable_frosted_glass: Disable frosted glass effect
|
||||
reduce_frosted_glass_blur: Reduce the intensity of the frosted glass blur
|
||||
|
||||
# Desktop & Dock
|
||||
use_old_top_bar: Use the old top bar
|
||||
top_bar_link_opening_behavior: Top bar link opening behavior
|
||||
top_bar_link_opening_behavior_opt:
|
||||
link_opening_behavior_opt:
|
||||
current_tab: Current tab
|
||||
current_tab_if_not_homepage: Current tab if not the homepage, otherwise new tab
|
||||
new_tab: New tab
|
||||
drawer: Open in drawer
|
||||
top_bar_link_opening_behavior: Top bar link opening behavior
|
||||
video_card_link_opening_behavior: Video card and bangumi card link opening behavior
|
||||
search_bar_link_opening_behavior: Search bar link opening behavior
|
||||
|
||||
block_ads: Block ads
|
||||
|
||||
enable_video_preview: Enable video preview feature (if possible)
|
||||
enable_video_ctrl_bar_on_video_card: Display the video control bar on the video card
|
||||
hover_video_card_delayed: Delayed video preview on hover over the video card
|
||||
|
||||
# Desktop & Dock
|
||||
use_old_top_bar: Use the old top bar
|
||||
auto_hide_top_bar: Automatically hide the top bar
|
||||
top_bar_icon_badges: Icon badges
|
||||
top_bar_icon_badges_opt:
|
||||
|
||||
@@ -117,24 +117,26 @@ settings:
|
||||
remove_the_indent_from_chinese_punctuation_desc: >
|
||||
Bilibili 預設會專登執吓中文標點符號,令到佢可以左對齊。如果你係用緊自訂字字型,最好係移除縮排。
|
||||
|
||||
video_card_link_opening_behavior: 影片同番劇卡片連結開啓行爲
|
||||
video_card_link_opening_behavior_opt:
|
||||
drawer: 喺櫃桶度開啓
|
||||
new_tab: 新開分頁
|
||||
enable_video_preview: 使用影片預覽功能(若然得嘅話)
|
||||
enable_video_ctrl_bar_on_video_card: 喺影片卡片上顯示影片控制欄
|
||||
hover_video_card_delayed: 滑鼠停留喺影片卡片嗰陣遲啲進行影片預覽
|
||||
block_ads: 封鎖廣告
|
||||
disable_frosted_glass: 閂咗毛玻璃效果
|
||||
reduce_frosted_glass_blur: 降低毛玻璃模糊強度
|
||||
|
||||
# Desktop and Dock
|
||||
use_old_top_bar: 用返舊版頂部欄
|
||||
top_bar_link_opening_behavior: 頂部欄連結開啓行爲
|
||||
top_bar_link_opening_behavior_opt:
|
||||
link_opening_behavior_opt:
|
||||
current_tab: 目前分頁
|
||||
current_tab_if_not_homepage: 唔喺主頁就喺目前分頁度開啓,否則開新嘅分頁
|
||||
new_tab: 新開分頁
|
||||
drawer: 喺櫃桶度開啓
|
||||
top_bar_link_opening_behavior: 頂部欄連結開啓行爲
|
||||
video_card_link_opening_behavior: 影片同番劇卡片連結開啓行爲
|
||||
search_bar_link_opening_behavior: 搜尋欄連結開啓行爲
|
||||
|
||||
block_ads: 封鎖廣告
|
||||
|
||||
enable_video_preview: 使用影片預覽功能(若然得嘅話)
|
||||
enable_video_ctrl_bar_on_video_card: 喺影片卡片上顯示影片控制欄
|
||||
hover_video_card_delayed: 滑鼠停留喺影片卡片嗰陣遲啲進行影片預覽
|
||||
|
||||
# Desktop and Dock
|
||||
use_old_top_bar: 用返舊版頂部欄
|
||||
auto_hide_top_bar: 自動收埋頂部欄
|
||||
top_bar_icon_badges: 圖示邊位標記
|
||||
top_bar_icon_badges_opt:
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
import { onKeyStroke, useDebounceFn } from '@vueuse/core'
|
||||
import DOMPurify from 'dompurify'
|
||||
|
||||
import { settings } from '~/logic'
|
||||
import api from '~/utils/api'
|
||||
import { findLeafActiveElement } from '~/utils/element'
|
||||
import { isHomePage } from '~/utils/main'
|
||||
|
||||
import type { HistoryItem, SuggestionItem, SuggestionResponse } from './searchHistoryProvider'
|
||||
import {
|
||||
@@ -75,7 +77,15 @@ const handleInput = useDebounceFn(() => {
|
||||
|
||||
async function navigateToSearchResultPage(keyword: string) {
|
||||
if (keyword) {
|
||||
window.open(`//search.bilibili.com/all?keyword=${encodeURIComponent(keyword)}`, '_blank')
|
||||
let target = '_blank'
|
||||
if (settings.value.searchBarLinkOpenMode === 'currentTabIfNotHomepage')
|
||||
target = isHomePage() ? '_blank' : '_self'
|
||||
else if (settings.value.searchBarLinkOpenMode === 'currentTab')
|
||||
target = '_self'
|
||||
else if (settings.value.searchBarLinkOpenMode === 'newTab')
|
||||
target = '_blank'
|
||||
|
||||
window.open(`//search.bilibili.com/all?keyword=${encodeURIComponent(keyword)}`, target)
|
||||
const searchItem = {
|
||||
value: keyword,
|
||||
timestamp: Number(new Date()),
|
||||
@@ -382,7 +392,6 @@ async function handleClearSearchHistory() {
|
||||
|
||||
@mixin search-content-item {
|
||||
--uno: "px-4 py-2 w-full rounded-$bew-radius duration-300 cursor-pointer not-first:mt-1 tracking-wider hover:bg-$bew-fill-2";
|
||||
--uno: "hover:shadow-[var(--bew-shadow-1),var(--bew-shadow-edge-glow-1)]";
|
||||
}
|
||||
|
||||
#search-history {
|
||||
|
||||
@@ -29,18 +29,18 @@ const langOptions = computed(() => {
|
||||
]
|
||||
})
|
||||
|
||||
const topBarLinkOpenModeOptions = computed(() => {
|
||||
const openModeOptions = computed(() => {
|
||||
return [
|
||||
{
|
||||
label: t('settings.top_bar_link_opening_behavior_opt.current_tab'),
|
||||
label: t('settings.link_opening_behavior_opt.current_tab'),
|
||||
value: 'currentTab',
|
||||
},
|
||||
{
|
||||
label: t('settings.top_bar_link_opening_behavior_opt.current_tab_if_not_homepage'),
|
||||
label: t('settings.link_opening_behavior_opt.current_tab_if_not_homepage'),
|
||||
value: 'currentTabIfNotHomepage',
|
||||
},
|
||||
{
|
||||
label: t('settings.top_bar_link_opening_behavior_opt.new_tab'),
|
||||
label: t('settings.link_opening_behavior_opt.new_tab'),
|
||||
value: 'newTab',
|
||||
},
|
||||
]
|
||||
@@ -49,11 +49,11 @@ const topBarLinkOpenModeOptions = computed(() => {
|
||||
const videoCardOpenModeOptions = computed(() => {
|
||||
return [
|
||||
{
|
||||
label: t('settings.video_card_link_opening_behavior_opt.drawer'),
|
||||
label: t('settings.link_opening_behavior_opt.drawer'),
|
||||
value: 'drawer',
|
||||
},
|
||||
{
|
||||
label: t('settings.video_card_link_opening_behavior_opt.new_tab'),
|
||||
label: t('settings.link_opening_behavior_opt.new_tab'),
|
||||
value: 'newTab',
|
||||
},
|
||||
]
|
||||
@@ -114,7 +114,7 @@ watch(() => settings.value.language, (newValue) => {
|
||||
|
||||
<SettingsItemGroup :title="$t('settings.group_link_opening_behavior')">
|
||||
<SettingsItem :title="$t('settings.top_bar_link_opening_behavior')">
|
||||
<Select v-model="settings.topBarLinkOpenMode" :options="topBarLinkOpenModeOptions" w="full" />
|
||||
<Select v-model="settings.topBarLinkOpenMode" :options="openModeOptions" w="full" />
|
||||
</SettingsItem>
|
||||
<SettingsItem :title="$t('settings.video_card_link_opening_behavior')">
|
||||
<Select
|
||||
@@ -123,6 +123,13 @@ watch(() => settings.value.language, (newValue) => {
|
||||
w="full"
|
||||
/>
|
||||
</SettingsItem>
|
||||
<SettingsItem :title="$t('settings.search_bar_link_opening_behavior')">
|
||||
<Select
|
||||
v-model="settings.searchBarLinkOpenMode"
|
||||
:options="openModeOptions"
|
||||
w="full"
|
||||
/>
|
||||
</SettingsItem>
|
||||
</SettingsItemGroup>
|
||||
|
||||
<SettingsItemGroup>
|
||||
|
||||
@@ -18,16 +18,20 @@ export interface Settings {
|
||||
disableFrostedGlass: boolean
|
||||
reduceFrostedGlassBlur: boolean
|
||||
|
||||
enableVideoPreview: boolean
|
||||
|
||||
// Link Opening Behavior
|
||||
videoCardLinkOpenMode: 'drawer' | 'newTab'
|
||||
topBarLinkOpenMode: 'currentTab' | 'currentTabIfNotHomepage' | 'newTab'
|
||||
searchBarLinkOpenMode: 'currentTab' | 'currentTabIfNotHomepage' | 'newTab'
|
||||
|
||||
blockAds: boolean
|
||||
|
||||
videoCardLinkOpenMode: 'drawer' | 'newTab'
|
||||
enableVideoPreview: boolean
|
||||
enableVideoCtrlBarOnVideoCard: boolean
|
||||
hoverVideoCardDelayed: boolean
|
||||
|
||||
// Desktop & Dock
|
||||
useOldTopBar: boolean
|
||||
topBarLinkOpenMode: 'currentTab' | 'currentTabIfNotHomepage' | 'newTab'
|
||||
autoHideTopBar: boolean
|
||||
topBarIconBadges: 'number' | 'dot' | 'none'
|
||||
dockPosition: 'left' | 'right' | 'bottom'
|
||||
@@ -102,16 +106,19 @@ export const originalSettings: Settings = {
|
||||
disableFrostedGlass: true,
|
||||
reduceFrostedGlassBlur: false,
|
||||
|
||||
// Link Opening Behavior
|
||||
videoCardLinkOpenMode: 'newTab',
|
||||
topBarLinkOpenMode: 'currentTabIfNotHomepage',
|
||||
searchBarLinkOpenMode: 'currentTabIfNotHomepage',
|
||||
|
||||
blockAds: false,
|
||||
|
||||
videoCardLinkOpenMode: 'newTab',
|
||||
enableVideoPreview: true,
|
||||
enableVideoCtrlBarOnVideoCard: false,
|
||||
hoverVideoCardDelayed: false,
|
||||
|
||||
// Desktop & Dock
|
||||
useOldTopBar: false,
|
||||
topBarLinkOpenMode: 'currentTabIfNotHomepage',
|
||||
autoHideTopBar: false,
|
||||
topBarIconBadges: 'number',
|
||||
dockPosition: 'right',
|
||||
|
||||
Reference in New Issue
Block a user