mirror of
https://github.com/BewlyBewly/BewlyBewly.git
synced 2025-04-14 13:15:29 +00:00
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:
@@ -13,9 +13,10 @@ import { getUserID, isHomePage, scrollToTop } from '~/utils/main'
|
||||
import emitter from '~/utils/mitt'
|
||||
|
||||
const { isDark } = useDark()
|
||||
const activatedPage = ref<AppPage>(settings.value.dockItemVisibilityList.find(e => e.visible === true)?.page ?? AppPage.Home)
|
||||
const { locale } = useI18n()
|
||||
const [showSettings, toggleSettings] = useToggle(false)
|
||||
|
||||
const activatedPage = ref<AppPage>(settings.value.dockItemVisibilityList.find(e => e.visible === true)?.page ?? AppPage.Home)
|
||||
const pages = {
|
||||
[AppPage.Home]: defineAsyncComponent(() => import('./Home/Home.vue')),
|
||||
[AppPage.Search]: defineAsyncComponent(() => import('./Search/Search.vue')),
|
||||
@@ -34,6 +35,22 @@ const handleThrottledBackToTop = useThrottleFn(() => handleBackToTop(), 1000)
|
||||
const topBarRef = ref()
|
||||
const reachTop = ref<boolean>(true)
|
||||
|
||||
const iframeDrawerUrl = ref<string>('')
|
||||
const showIframeDrawer = ref<boolean>(false)
|
||||
|
||||
const inIframe = computed((): boolean => {
|
||||
return window.self !== window.top
|
||||
})
|
||||
|
||||
const showBewlyPage = computed((): boolean => {
|
||||
if (inIframe.value) {
|
||||
return false
|
||||
}
|
||||
else {
|
||||
return isHomePage() && !inIframe.value && !settings.value.useOriginalBilibiliHomepage
|
||||
}
|
||||
})
|
||||
|
||||
watch(
|
||||
() => activatedPage.value,
|
||||
() => {
|
||||
@@ -242,6 +259,11 @@ function handleReduceFrostedGlassBlur() {
|
||||
}
|
||||
}
|
||||
|
||||
function openIframeDrawer(url: string) {
|
||||
iframeDrawerUrl.value = url
|
||||
showIframeDrawer.value = true
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the current viewport has a scrollbar.
|
||||
* @returns {boolean} Returns true if the viewport has a scrollbar, false otherwise.
|
||||
@@ -261,6 +283,7 @@ provide<BewlyAppProvider>('BEWLY_APP', {
|
||||
handleBackToTop,
|
||||
handlePageRefresh,
|
||||
handleReachBottom,
|
||||
openIframeDrawer,
|
||||
haveScrollbar,
|
||||
})
|
||||
</script>
|
||||
@@ -274,7 +297,7 @@ provide<BewlyAppProvider>('BEWLY_APP', {
|
||||
text="$bew-text-1"
|
||||
>
|
||||
<!-- Background -->
|
||||
<template v-if="isHomePage() && !settings.useOriginalBilibiliHomepage">
|
||||
<template v-if="showBewlyPage">
|
||||
<AppBackground :activated-page="activatedPage" />
|
||||
</template>
|
||||
|
||||
@@ -284,9 +307,13 @@ provide<BewlyAppProvider>('BEWLY_APP', {
|
||||
</KeepAlive>
|
||||
|
||||
<!-- Dock & RightSideButtons -->
|
||||
<div pos="absolute top-0 left-0" w-full h-full overflow-hidden pointer-events-none>
|
||||
<div
|
||||
v-if="!inIframe"
|
||||
pos="absolute top-0 left-0" w-full h-full overflow-hidden
|
||||
pointer-events-none
|
||||
>
|
||||
<Dock
|
||||
v-if="isHomePage() && !settings.useOriginalBilibiliHomepage"
|
||||
v-if="showBewlyPage"
|
||||
pointer-events-auto
|
||||
:activated-page="activatedPage"
|
||||
@change-page="(page: AppPage) => changeActivatePage(page)"
|
||||
@@ -302,7 +329,7 @@ provide<BewlyAppProvider>('BEWLY_APP', {
|
||||
</div>
|
||||
|
||||
<!-- TopBar -->
|
||||
<div m-auto max-w="$bew-page-max-width">
|
||||
<div v-if="!inIframe" m-auto max-w="$bew-page-max-width">
|
||||
<OldTopBar
|
||||
v-if="settings.useOldTopBar"
|
||||
pos="top-0 left-0" z="99 hover:1001" w-full
|
||||
@@ -315,9 +342,9 @@ provide<BewlyAppProvider>('BEWLY_APP', {
|
||||
|
||||
<div
|
||||
pos="absolute top-0 left-0" w-full h-full
|
||||
:style="{ height: isHomePage() && !settings.useOriginalBilibiliHomepage ? '100dvh' : '0' }"
|
||||
:style="{ height: showBewlyPage ? '100dvh' : '0' }"
|
||||
>
|
||||
<template v-if="isHomePage() && !settings.useOriginalBilibiliHomepage">
|
||||
<template v-if="showBewlyPage">
|
||||
<OverlayScrollbarsComponent ref="scrollbarRef" element="div" h-inherit defer @os-scroll="handleOsScroll">
|
||||
<main m-auto max-w="$bew-page-max-width">
|
||||
<div
|
||||
@@ -339,6 +366,12 @@ provide<BewlyAppProvider>('BEWLY_APP', {
|
||||
</OverlayScrollbarsComponent>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<IframeDrawer
|
||||
v-if="settings.videoCardLinkOpenMode === 'drawer' && showIframeDrawer"
|
||||
:url="iframeDrawerUrl"
|
||||
@close="showIframeDrawer = false"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user