@@ -91,6 +102,8 @@ function getUnreadMessageCount() {
rounded="$bew-radius"
transition="all duration-300"
m="b-1 last:b-0"
+ :custom-click-event="!settings.useOldTopBar && settings.openNotificationsPageAsDrawer"
+ @click="(event: MouseEvent) => handleClick(event, item)"
>
diff --git a/src/contentScripts/index.ts b/src/contentScripts/index.ts
index 6e6ea7fa..4f2af4a6 100644
--- a/src/contentScripts/index.ts
+++ b/src/contentScripts/index.ts
@@ -9,7 +9,7 @@ import { settings } from '~/logic'
import { setupApp } from '~/logic/common-setup'
import RESET_BEWLY_CSS from '~/styles/reset.css?raw'
import { runWhenIdle } from '~/utils/lazyLoad'
-import { compareVersions, injectCSS, isHomePage, isInIframe } from '~/utils/main'
+import { compareVersions, injectCSS, isHomePage, isInIframe, isNotificationPage, isVideoOrBangumiPage } from '~/utils/main'
import { SVG_ICONS } from '~/utils/svgIcons'
import { version } from '../../package.json'
@@ -36,18 +36,10 @@ function isSupportedPages(): boolean {
if (
// homepage
isHomePage()
-
+ // video or bangumi page
+ || isVideoOrBangumiPage()
// popular page https://www.bilibili.com/v/popular/all
|| /https?:\/\/(?:www\.)?bilibili\.com\/v\/popular\/all.*/.test(currentUrl)
- // video page
- || /https?:\/\/(?:www\.)?bilibili\.com\/(?:video|list)\/.*/.test(currentUrl)
- // anime playback & movie page
- || /https?:\/\/(?:www\.)?bilibili\.com\/bangumi\/play\/.*/.test(currentUrl)
- // watch later playlist
- || /https?:\/\/(?:www\.)?bilibili\.com\/list\/watchlater.*/.test(currentUrl)
- || /https?:\/\/(?:www\.)?bilibili\.com\/watchlater\/list.*/.test(currentUrl)
- // favorite playlist
- || /https?:\/\/(?:www\.)?bilibili\.com\/list\/ml.*/.test(currentUrl)
// search page
|| /https?:\/\/search\.bilibili\.com\.*/.test(currentUrl)
// moments page
@@ -98,6 +90,8 @@ export function isSupportedIframePages(): boolean {
&& (
// supports Bilibili page URLs recorded in the dock
isHomePage()
+ // Since `Open in drawer` will open the video page within an iframe, so we need to support the following pages
+ || isVideoOrBangumiPage()
|| /https?:\/\/search\.bilibili\.com\/all.*/.test(currentUrl)
|| /https?:\/\/www\.bilibili\.com\/anime.*/.test(currentUrl)
|| /https?:\/\/space\.bilibili\.com\/\d+\/favlist.*/.test(currentUrl)
@@ -108,15 +102,8 @@ export function isSupportedIframePages(): boolean {
// https://github.com/BewlyBewly/BewlyBewly/issues/1256
// https://github.com/BewlyBewly/BewlyBewly/issues/1266
|| /https?:\/\/t\.bilibili\.com(?!\/vote|\/share).*/.test(currentUrl)
- // Since `Open in drawer` will open the video page within an iframe, so we need to support the following pages
- // video page
- || /https?:\/\/(?:www\.)?bilibili\.com\/(?:video|list)\/.*/.test(currentUrl)
- // anime playback & movie page
- || /https?:\/\/(?:www\.)?bilibili\.com\/bangumi\/play\/.*/.test(currentUrl)
- // watch later playlist
- || /https?:\/\/(?:www\.)?bilibili\.com\/list\/watchlater.*/.test(currentUrl)
- // favorite playlist
- || /https?:\/\/(?:www\.)?bilibili\.com\/list\/ml.*/.test(currentUrl)
+ // notifications page, for `Open the notifications page as a drawer`
+ || isNotificationPage()
)
) {
return true
diff --git a/src/contentScripts/views/App.vue b/src/contentScripts/views/App.vue
index 17c61a90..1c2e2019 100644
--- a/src/contentScripts/views/App.vue
+++ b/src/contentScripts/views/App.vue
@@ -4,12 +4,12 @@ import type { Ref } from 'vue'
import type { BewlyAppProvider } from '~/composables/useAppProvider'
import { useDark } from '~/composables/useDark'
-import { BEWLY_MOUNTED, DRAWER_VIDEO_ENTER_PAGE_FULL, DRAWER_VIDEO_EXIT_PAGE_FULL, IFRAME_PAGE_SWITCH_BEWLY, IFRAME_PAGE_SWITCH_BILI, OVERLAY_SCROLL_BAR_SCROLL } from '~/constants/globalEvents'
+import { BEWLY_MOUNTED, DRAWER_VIDEO_ENTER_PAGE_FULL, DRAWER_VIDEO_EXIT_PAGE_FULL, IFRAME_PAGE_ESC_KEY_DOWN, IFRAME_PAGE_SWITCH_BEWLY, IFRAME_PAGE_SWITCH_BILI, OVERLAY_SCROLL_BAR_SCROLL } from '~/constants/globalEvents'
import { AppPage } from '~/enums/appEnums'
import { settings } from '~/logic'
import { type DockItem, useMainStore } from '~/stores/mainStore'
import { useSettingsStore } from '~/stores/settingsStore'
-import { isHomePage, isInIframe, isVideoOrBangumiPage, openLinkToNewTab, queryDomUntilFound, scrollToTop } from '~/utils/main'
+import { isHomePage, isInIframe, isNotificationPage, isVideoOrBangumiPage, openLinkToNewTab, queryDomUntilFound, scrollToTop } from '~/utils/main'
import emitter from '~/utils/mitt'
import { setupNecessarySettingsWatchers } from './necessarySettingsWatchers'
@@ -98,6 +98,10 @@ const showTopBar = computed((): boolean => {
if (isVideoOrBangumiPage() && isInIframe())
return false
+ // when user open the notifications page as a drawer, don't show the top bar
+ if (isNotificationPage() && settings.value.openNotificationsPageAsDrawer && isInIframe())
+ return false
+
// When the user switches to the original Bilibili page, BewlyBewly will only show the top bar inside the iframe.
// This helps prevent the outside top bar from covering the contents.
// reference: https://github.com/BewlyBewly/BewlyBewly/issues/1235
diff --git a/src/logic/storage.ts b/src/logic/storage.ts
index 45844012..1fc88c2a 100644
--- a/src/logic/storage.ts
+++ b/src/logic/storage.ts
@@ -39,6 +39,8 @@ export interface Settings {
showBewlyOrBiliTopBarSwitcher: boolean
showBewlyOrBiliPageSwitcher: boolean
topBarIconBadges: 'number' | 'dot' | 'none'
+ openNotificationsPageAsDrawer: boolean
+
alwaysUseDock: boolean
autoHideDock: boolean
dockPosition: 'left' | 'right' | 'bottom'
@@ -137,6 +139,8 @@ export const originalSettings: Settings = {
showBewlyOrBiliTopBarSwitcher: true,
showBewlyOrBiliPageSwitcher: true,
topBarIconBadges: 'number',
+ openNotificationsPageAsDrawer: true,
+
alwaysUseDock: false,
autoHideDock: false,
dockPosition: 'right',
diff --git a/src/styles/adaptedStyles/index.ts b/src/styles/adaptedStyles/index.ts
index e062febe..0b144328 100644
--- a/src/styles/adaptedStyles/index.ts
+++ b/src/styles/adaptedStyles/index.ts
@@ -2,7 +2,8 @@ import './common'
import './shadowDom'
import './thirdParties'
-import { isHomePage } from '~/utils/main'
+import { settings } from '~/logic/storage'
+import { isHomePage, isInIframe } from '~/utils/main'
async function setupStyles() {
const currentUrl = document.URL
@@ -17,6 +18,10 @@ async function setupStyles() {
else if (/https?:\/\/message\.bilibili\.com\.*/.test(currentUrl)) {
await import('./pages/notificationsPage.scss')
document.documentElement.classList.add('notificationsPage')
+
+ if (isInIframe() && settings.value.openNotificationsPageAsDrawer) {
+ document.documentElement.classList.add('drawer')
+ }
}
// moments page, new articles page 动态页, 新版专栏页
diff --git a/src/styles/adaptedStyles/pages/notificationsPage.scss b/src/styles/adaptedStyles/pages/notificationsPage.scss
index 38e62b7a..abb4e6cb 100644
--- a/src/styles/adaptedStyles/pages/notificationsPage.scss
+++ b/src/styles/adaptedStyles/pages/notificationsPage.scss
@@ -2,6 +2,38 @@
#message-navbar {
display: none;
}
+
+ .side-bar {
+ font-weight: 400 !important;
+ }
+
+ &.drawer {
+ body {
+ background: unset;
+ background-color: var(--bew-homepage-bg) !important;
+ }
+
+ #message-navbar + .container,
+ #link-message-container .container {
+ width: 100vw !important;
+ max-width: unset !important;
+ margin: 0 !important;
+ }
+
+ #message-navbar + .container::after {
+ display: none;
+ }
+
+ .space-left,
+ .space-right {
+ backdrop-filter: none;
+ background-color: unset !important;
+ }
+
+ .space-left .title {
+ display: none;
+ }
+ }
}
html.bewly-design.notificationsPage {
@@ -27,6 +59,7 @@ html.bewly-design.notificationsPage {
background: url(https://s1.hdslb.com/bfs/static/blive/blfe-message-web/static/img/light_bg.8e46311e.png)
bottom/cover no-repeat fixed;
pointer-events: none;
+ opacity: 0.4;
}
}
}
diff --git a/src/utils/main.ts b/src/utils/main.ts
index 26f258e5..76edb9db 100644
--- a/src/utils/main.ts
+++ b/src/utils/main.ts
@@ -167,12 +167,14 @@ export function isHomePage(url: string = location.href): boolean {
* @returns true if the current page is a video or bangumi page
*/
export function isVideoOrBangumiPage(url: string = location.href): boolean {
- if ( // video page
+ if (
+ // video page
/https?:\/\/(?:www\.)?bilibili\.com\/(?:video|list)\/.*/.test(url)
// anime playback & movie page
|| /https?:\/\/(?:www\.)?bilibili\.com\/bangumi\/play\/.*/.test(url)
// watch later playlist
|| /https?:\/\/(?:www\.)?bilibili\.com\/list\/watchlater.*/.test(url)
+ || /https?:\/\/(?:www\.)?bilibili\.com\/watchlater\/list.*/.test(url)
// favorite playlist
|| /https?:\/\/(?:www\.)?bilibili\.com\/list\/ml.*/.test(url)) {
return true
@@ -180,6 +182,20 @@ export function isVideoOrBangumiPage(url: string = location.href): boolean {
return false
}
+/**
+ * Check if the current page is the notifications page
+ * @param url the url to check
+ * @returns true if the current page is the notifications page
+ */
+export function isNotificationPage(url: string = location.href): boolean {
+ if (
+ /https?:\/\/message\.bilibili\.com\.*/.test(url)
+ ) {
+ return true
+ }
+ return false
+}
+
/**
* Compresses and resizes an image file.
*