diff --git a/.vscode/settings.json b/.vscode/settings.json index ee156447b..7e00b2430 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,6 +16,7 @@ "cSpell.words": [ "afterbegin", "afterend", + "BALH", "Bangumi", "bevo", "bili", diff --git a/registry/lib/components/style/hide/user-card/index.ts b/registry/lib/components/style/hide/user-card/index.ts new file mode 100644 index 000000000..8c568d0f6 --- /dev/null +++ b/registry/lib/components/style/hide/user-card/index.ts @@ -0,0 +1,17 @@ +import { defineComponentMetadata } from '@/components/define' +import { toggleStyle } from '@/components/styled-component' + +const name = 'hideUserCard' + +export const component = defineComponentMetadata({ + displayName: '隐藏用户信息卡片', + description: { + 'zh-CN': '隐藏鼠标指向用户名或用户头像时弹出的浮动用户信息卡片', + }, + author: { + name: 'WakelessSloth56', + link: 'https://github.com/WakelessSloth56', + }, + tags: [componentsTags.style], + ...toggleStyle(name, () => import('./user-card.scss')), +}) diff --git a/registry/lib/components/style/hide/user-card/user-card.scss b/registry/lib/components/style/hide/user-card/user-card.scss new file mode 100644 index 000000000..86eb0ce16 --- /dev/null +++ b/registry/lib/components/style/hide/user-card/user-card.scss @@ -0,0 +1,5 @@ +.user-card, +.user-card-m-exp, +.bili-user-profile { + display: none !important; +} diff --git a/src/client/init.ts b/src/client/init.ts index 645d70178..023d06360 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -34,12 +34,16 @@ export const init = async () => { compatibilityPatch() }) - if (unsafeWindow.bangumi_area_limit_hack) { + const { coreApis, externalApis } = await import('@/core/core-apis') + if ( + unsafeWindow.bangumi_area_limit_hack && + coreApis.settings.getComponentSettings<{ disableOnBalh: boolean }>('compatibilities').options + .disableOnBalh + ) { console.log('BALH detected, Bilibili Evolved is disabled.') return } - const { coreApis, externalApis } = await import('@/core/core-apis') unsafeWindow.bilibiliEvolved = externalApis /** sand-boxed window, safe to use original name */ window.coreApis = coreApis diff --git a/src/components/built-in-components.ts b/src/components/built-in-components.ts index 1dd47ed85..b4f5748d5 100644 --- a/src/components/built-in-components.ts +++ b/src/components/built-in-components.ts @@ -5,6 +5,7 @@ import { component as I18n } from './i18n' import { component as AutoUpdate } from './auto-update' import { component as NotifyNewVersion } from './notify-new-version' import { component as Bisector } from './bisector' +import { component as Compatibilities } from './compatibilities' export const getBuiltInComponents = (): ComponentMetadata[] => [ SettingsPanel, @@ -13,6 +14,7 @@ export const getBuiltInComponents = (): ComponentMetadata[] => [ AutoUpdate, NotifyNewVersion, Bisector, + Compatibilities, ] export const isBuiltInComponent = (name: string) => diff --git a/src/components/compatibilities/index.md b/src/components/compatibilities/index.md new file mode 100644 index 000000000..d89b384cd --- /dev/null +++ b/src/components/compatibilities/index.md @@ -0,0 +1 @@ +- `与 "解除 B 站区域限制" 互斥`: 若打开此选项, 在检测到 "解除 B 站区域限制" 脚本时, 将停止此脚本的加载以避免布局错乱. diff --git a/src/components/compatibilities/index.ts b/src/components/compatibilities/index.ts new file mode 100644 index 000000000..cca9ad2b5 --- /dev/null +++ b/src/components/compatibilities/index.ts @@ -0,0 +1,18 @@ +// import { addComponentListener } from '@/core/settings' +import { componentsTags } from '@/components/types' +import { none } from '@/core/utils' +import { defineComponentMetadata } from '../define' + +export const component = defineComponentMetadata({ + name: 'compatibilities', + displayName: '兼容性选项', + configurable: false, + tags: [componentsTags.general], + options: { + disableOnBalh: { + defaultValue: false, + displayName: '与 "解除 B 站区域限制" 互斥', + }, + }, + entry: none, +})