feat: add video card open mode config && open video in drawer (#984)

* feat: video card open mode

* update

* update

* fix: non-homepage show the bewly homepage

* fix(video-card): click the more icon will trigger opening drawer effect

* feat(video-drawer): improve ui and functionally

* feat(i18n): add i18n support for video card link opening behavior setting

* chore: reorder settings
This commit is contained in:
Hakadao
2024-09-08 13:36:42 +08:00
committed by GitHub
parent 35bd528524
commit bb3c6b5e2c
13 changed files with 313 additions and 43 deletions

View File

@@ -146,15 +146,14 @@ export function delay(ms: number) {
/**
* Check if the current page is the home page
* @param url the url to check
* @returns true if the current page is the home page
*/
export function isHomePage(): boolean {
export function isHomePage(url: string = location.href): boolean {
if (
/https?:\/\/(?:www\.)?bilibili.com\/?(?:#\/?)?$/.test(location.href)
// https://github.com/hakadao/BewlyBewly/issues/525 #525
|| /https?:\/\/(?:www\.)?bilibili.com\/?(?:\?.*)?$/.test(location.href)
|| /https?:\/\/(?:www\.)?bilibili.com\/index\.html$/.test(location.href)
|| /https?:\/\/(?:www\.)?bilibili.com\/\?spm_id_from=.*/.test(location.href)
/https?:\/\/(?:www\.)?bilibili.com\/?(?:#\/?)?$/.test(url)
|| /https?:\/\/(?:www\.)?bilibili.com\/index\.html$/.test(url)
|| /https?:\/\/(?:www\.)?bilibili.com\/\?spm_id_from=.*/.test(url)
) {
return true
}