mirror of
https://github.com/the1812/Bilibili-Evolved.git
synced 2025-11-04 21:22:45 +08:00
Force enumMember to be PascalCase
This commit is contained in:
parent
1ea8b6afd5
commit
efc6b6d6aa
@ -38,6 +38,12 @@ module.exports = {
|
|||||||
'@typescript-eslint/no-explicit-any': 'off',
|
'@typescript-eslint/no-explicit-any': 'off',
|
||||||
'@typescript-eslint/no-use-before-define': ['error'],
|
'@typescript-eslint/no-use-before-define': ['error'],
|
||||||
'@typescript-eslint/no-redeclare': 'error',
|
'@typescript-eslint/no-redeclare': 'error',
|
||||||
|
'@typescript-eslint/naming-convention': ['error',
|
||||||
|
{
|
||||||
|
selector: 'enumMember',
|
||||||
|
format: ['PascalCase'],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
'vue/max-attributes-per-line': 'off',
|
'vue/max-attributes-per-line': 'off',
|
||||||
'vue/html-self-closing': 'off',
|
'vue/html-self-closing': 'off',
|
||||||
@ -97,4 +103,4 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
}
|
||||||
|
|||||||
@ -14,7 +14,9 @@
|
|||||||
:href="!item.active && !item.touch && item.href"
|
:href="!item.active && !item.touch && item.href"
|
||||||
@mouseover.self="requestPopup()"
|
@mouseover.self="requestPopup()"
|
||||||
>
|
>
|
||||||
<template v-if="typeof item.content === 'string'">{{ item.content }}</template>
|
<template v-if="typeof item.content === 'string'">
|
||||||
|
{{ item.content }}
|
||||||
|
</template>
|
||||||
<component :is="item.content" v-else :item="item"></component>
|
<component :is="item.content" v-else :item="item"></component>
|
||||||
</CustomNavbarLink>
|
</CustomNavbarLink>
|
||||||
<div
|
<div
|
||||||
|
|||||||
@ -4,10 +4,10 @@ import { formatDuration } from '@/core/utils/formatters'
|
|||||||
|
|
||||||
/** 历史项目类型, 值为 API 中的 `history.business` */
|
/** 历史项目类型, 值为 API 中的 `history.business` */
|
||||||
export enum HistoryType {
|
export enum HistoryType {
|
||||||
video = 'archive',
|
Video = 'archive',
|
||||||
live = 'live',
|
Live = 'live',
|
||||||
article = 'article',
|
Article = 'article',
|
||||||
bangumi = 'pgc',
|
Bangumi = 'pgc',
|
||||||
}
|
}
|
||||||
export interface HistoryItem {
|
export interface HistoryItem {
|
||||||
id: string | number
|
id: string | number
|
||||||
@ -52,25 +52,25 @@ export interface TypeFilter {
|
|||||||
/** 所有的历史记录类型 */
|
/** 所有的历史记录类型 */
|
||||||
export const types = [
|
export const types = [
|
||||||
{
|
{
|
||||||
name: HistoryType.video,
|
name: HistoryType.Video,
|
||||||
displayName: '视频',
|
displayName: '视频',
|
||||||
icon: 'mdi-play-circle-outline',
|
icon: 'mdi-play-circle-outline',
|
||||||
checked: true,
|
checked: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: HistoryType.bangumi,
|
name: HistoryType.Bangumi,
|
||||||
displayName: '番剧',
|
displayName: '番剧',
|
||||||
icon: 'mdi-television-classic',
|
icon: 'mdi-television-classic',
|
||||||
checked: true,
|
checked: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: HistoryType.live,
|
name: HistoryType.Live,
|
||||||
displayName: '直播',
|
displayName: '直播',
|
||||||
icon: 'mdi-video-wireless-outline',
|
icon: 'mdi-video-wireless-outline',
|
||||||
checked: true,
|
checked: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: HistoryType.article,
|
name: HistoryType.Article,
|
||||||
displayName: '专栏',
|
displayName: '专栏',
|
||||||
icon: 'mdi-newspaper-variant-outline',
|
icon: 'mdi-newspaper-variant-outline',
|
||||||
checked: true,
|
checked: true,
|
||||||
@ -135,7 +135,7 @@ const parseHistoryItem = (item: any): HistoryItem => {
|
|||||||
url: `https://www.bilibili.com/bangumi/play/ep${epid}?${progressParam}`,
|
url: `https://www.bilibili.com/bangumi/play/ep${epid}?${progressParam}`,
|
||||||
title: item.show_title || item.title,
|
title: item.show_title || item.title,
|
||||||
upName: item.title,
|
upName: item.title,
|
||||||
type: HistoryType.bangumi,
|
type: HistoryType.Bangumi,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bvid) {
|
if (bvid) {
|
||||||
@ -143,7 +143,7 @@ const parseHistoryItem = (item: any): HistoryItem => {
|
|||||||
...commonInfo,
|
...commonInfo,
|
||||||
id: bvid,
|
id: bvid,
|
||||||
url: `https://www.bilibili.com/video/${bvid}?p=${item.history.page}&${progressParam}`,
|
url: `https://www.bilibili.com/video/${bvid}?p=${item.history.page}&${progressParam}`,
|
||||||
type: HistoryType.video,
|
type: HistoryType.Video,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cid) {
|
if (cid) {
|
||||||
@ -151,7 +151,7 @@ const parseHistoryItem = (item: any): HistoryItem => {
|
|||||||
...commonInfo,
|
...commonInfo,
|
||||||
id: cid,
|
id: cid,
|
||||||
url: `https://www.bilibili.com/read/cv${cid}`,
|
url: `https://www.bilibili.com/read/cv${cid}`,
|
||||||
type: HistoryType.article,
|
type: HistoryType.Article,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oid) {
|
if (oid) {
|
||||||
@ -160,7 +160,7 @@ const parseHistoryItem = (item: any): HistoryItem => {
|
|||||||
id: oid,
|
id: oid,
|
||||||
url: `https://live.bilibili.com/${oid}`,
|
url: `https://live.bilibili.com/${oid}`,
|
||||||
liveStatus: item.live_status,
|
liveStatus: item.live_status,
|
||||||
type: HistoryType.live,
|
type: HistoryType.Live,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.error('unknown history item type', item)
|
console.error('unknown history item type', item)
|
||||||
|
|||||||
@ -21,13 +21,13 @@ export default Vue.extend({
|
|||||||
moreLink: (tab: TabMapping) => `https://space.bilibili.com/${uid}/${tab.name}`,
|
moreLink: (tab: TabMapping) => `https://space.bilibili.com/${uid}/${tab.name}`,
|
||||||
tabs: [
|
tabs: [
|
||||||
{
|
{
|
||||||
name: SubscriptionTypes.bangumi,
|
name: SubscriptionTypes.Bangumi,
|
||||||
displayName: '追番',
|
displayName: '追番',
|
||||||
activeLink: `https://space.bilibili.com/${uid}/bangumi`,
|
activeLink: `https://space.bilibili.com/${uid}/bangumi`,
|
||||||
component: () => import('./BangumiSubscriptions.vue').then(m => m.default),
|
component: () => import('./BangumiSubscriptions.vue').then(m => m.default),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: SubscriptionTypes.cinema,
|
name: SubscriptionTypes.Cinema,
|
||||||
displayName: '追剧',
|
displayName: '追剧',
|
||||||
activeLink: `https://space.bilibili.com/${uid}/cinema`,
|
activeLink: `https://space.bilibili.com/${uid}/cinema`,
|
||||||
component: () => import('./CinemaSubscriptions.vue').then(m => m.default),
|
component: () => import('./CinemaSubscriptions.vue').then(m => m.default),
|
||||||
|
|||||||
@ -63,18 +63,18 @@ import { getJsonWithCredentials } from '@/core/ajax'
|
|||||||
import { SubscriptionTypes } from './subscriptions'
|
import { SubscriptionTypes } from './subscriptions'
|
||||||
|
|
||||||
enum SubscriptionStatus {
|
enum SubscriptionStatus {
|
||||||
toView = 1,
|
ToView = 1,
|
||||||
viewing,
|
Viewing,
|
||||||
viewed,
|
Viewed,
|
||||||
}
|
}
|
||||||
const getStatusText = (status: SubscriptionStatus) => {
|
const getStatusText = (status: SubscriptionStatus) => {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SubscriptionStatus.toView:
|
case SubscriptionStatus.ToView:
|
||||||
return '想看'
|
return '想看'
|
||||||
case SubscriptionStatus.viewing:
|
case SubscriptionStatus.Viewing:
|
||||||
default:
|
default:
|
||||||
return '在看'
|
return '在看'
|
||||||
case SubscriptionStatus.viewed:
|
case SubscriptionStatus.Viewed:
|
||||||
return '看过'
|
return '看过'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -83,12 +83,12 @@ const subscriptionSorter = (
|
|||||||
b: { status: SubscriptionStatus },
|
b: { status: SubscriptionStatus },
|
||||||
) => {
|
) => {
|
||||||
let statusA = a.status
|
let statusA = a.status
|
||||||
if (statusA !== SubscriptionStatus.viewed) {
|
if (statusA !== SubscriptionStatus.Viewed) {
|
||||||
statusA = SubscriptionStatus.viewed - statusA
|
statusA = SubscriptionStatus.Viewed - statusA
|
||||||
}
|
}
|
||||||
let statusB = b.status
|
let statusB = b.status
|
||||||
if (statusB !== SubscriptionStatus.viewed) {
|
if (statusB !== SubscriptionStatus.Viewed) {
|
||||||
statusB = SubscriptionStatus.viewed - statusB
|
statusB = SubscriptionStatus.Viewed - statusB
|
||||||
}
|
}
|
||||||
return statusA - statusB
|
return statusA - statusB
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ export default Vue.extend({
|
|||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
default: SubscriptionTypes.bangumi,
|
default: SubscriptionTypes.Bangumi,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@ -122,7 +122,7 @@ export default Vue.extend({
|
|||||||
try {
|
try {
|
||||||
const json = await getJsonWithCredentials(
|
const json = await getJsonWithCredentials(
|
||||||
`https://api.bilibili.com/x/space/bangumi/follow/list?type=${
|
`https://api.bilibili.com/x/space/bangumi/follow/list?type=${
|
||||||
this.type !== SubscriptionTypes.bangumi ? '2' : '1'
|
this.type !== SubscriptionTypes.Bangumi ? '2' : '1'
|
||||||
}&pn=${this.page}&ps=16&vmid=${getUID()}`,
|
}&pn=${this.page}&ps=16&vmid=${getUID()}`,
|
||||||
)
|
)
|
||||||
if (json.code !== 0) {
|
if (json.code !== 0) {
|
||||||
|
|||||||
@ -2,8 +2,8 @@ import { getUID } from '@/core/utils'
|
|||||||
import { CustomNavbarItemInit } from '../custom-navbar-item'
|
import { CustomNavbarItemInit } from '../custom-navbar-item'
|
||||||
|
|
||||||
export enum SubscriptionTypes {
|
export enum SubscriptionTypes {
|
||||||
bangumi = 'bangumi',
|
Bangumi = 'bangumi',
|
||||||
cinema = 'cinema',
|
Cinema = 'cinema',
|
||||||
}
|
}
|
||||||
const uid = getUID()
|
const uid = getUID()
|
||||||
export const subscriptions: CustomNavbarItemInit = {
|
export const subscriptions: CustomNavbarItemInit = {
|
||||||
|
|||||||
@ -129,7 +129,7 @@ export default Vue.extend({
|
|||||||
* - `NaN`: 取消时间调整
|
* - `NaN`: 取消时间调整
|
||||||
*/
|
*/
|
||||||
progress: null,
|
progress: null,
|
||||||
seekMode: ProgressSeekMode.fast,
|
seekMode: ProgressSeekMode.Fast,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
/** 进度调整模式(灵敏度) */
|
/** 进度调整模式(灵敏度) */
|
||||||
export enum ProgressSeekMode {
|
export enum ProgressSeekMode {
|
||||||
fast = '高速',
|
Fast = '高速',
|
||||||
medium = '中速',
|
Medium = '中速',
|
||||||
slow = '低速',
|
Slow = '低速',
|
||||||
}
|
}
|
||||||
/** 手势操作预览参数 */
|
/** 手势操作预览参数 */
|
||||||
export interface GesturePreviewParams {
|
export interface GesturePreviewParams {
|
||||||
|
|||||||
@ -100,9 +100,9 @@ export class SwipeAction extends EventTarget {
|
|||||||
speedFactor = 1
|
speedFactor = 1
|
||||||
}
|
}
|
||||||
const modeMap = {
|
const modeMap = {
|
||||||
0.05: ProgressSeekMode.slow,
|
0.05: ProgressSeekMode.Slow,
|
||||||
0.2: ProgressSeekMode.medium,
|
0.2: ProgressSeekMode.Medium,
|
||||||
1: ProgressSeekMode.fast,
|
1: ProgressSeekMode.Fast,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (distance > 0) {
|
if (distance > 0) {
|
||||||
|
|||||||
@ -5,10 +5,10 @@ import { isEmbeddedPlayer, playerReady } from '@/core/utils'
|
|||||||
import { allVideoUrls } from '@/core/utils/urls'
|
import { allVideoUrls } from '@/core/utils/urls'
|
||||||
|
|
||||||
export enum PlayerModes {
|
export enum PlayerModes {
|
||||||
normal = '常规',
|
Normal = '常规',
|
||||||
wide = '宽屏',
|
Wide = '宽屏',
|
||||||
webFullscreen = '网页全屏',
|
WebFullscreen = '网页全屏',
|
||||||
fullscreen = '全屏',
|
Fullscreen = '全屏',
|
||||||
}
|
}
|
||||||
const entry: ComponentEntry = async ({ settings: { options } }) => {
|
const entry: ComponentEntry = async ({ settings: { options } }) => {
|
||||||
if (isEmbeddedPlayer()) {
|
if (isEmbeddedPlayer()) {
|
||||||
@ -16,14 +16,14 @@ const entry: ComponentEntry = async ({ settings: { options } }) => {
|
|||||||
}
|
}
|
||||||
await playerReady()
|
await playerReady()
|
||||||
const actions: Map<PlayerModes, () => void | Promise<void>> = new Map([
|
const actions: Map<PlayerModes, () => void | Promise<void>> = new Map([
|
||||||
[PlayerModes.normal, none],
|
[PlayerModes.Normal, none],
|
||||||
[PlayerModes.wide, () => {
|
[PlayerModes.Wide, () => {
|
||||||
playerAgent.widescreen()
|
playerAgent.widescreen()
|
||||||
}],
|
}],
|
||||||
[PlayerModes.webFullscreen, () => {
|
[PlayerModes.WebFullscreen, () => {
|
||||||
playerAgent.webFullscreen()
|
playerAgent.webFullscreen()
|
||||||
}],
|
}],
|
||||||
[PlayerModes.fullscreen, async () => {
|
[PlayerModes.Fullscreen, async () => {
|
||||||
const video = await sq(
|
const video = await sq(
|
||||||
() => dq(playerAgent.query.video.element.selector),
|
() => dq(playerAgent.query.video.element.selector),
|
||||||
(it: HTMLVideoElement) => it !== null && it.readyState === 4
|
(it: HTMLVideoElement) => it !== null && it.readyState === 4
|
||||||
@ -70,7 +70,7 @@ export const component: ComponentMetadata = {
|
|||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
mode: {
|
mode: {
|
||||||
defaultValue: PlayerModes.normal,
|
defaultValue: PlayerModes.Normal,
|
||||||
displayName: '模式选择',
|
displayName: '模式选择',
|
||||||
dropdownEnum: PlayerModes,
|
dropdownEnum: PlayerModes,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -3,11 +3,11 @@ import { delay } from '@/core/utils'
|
|||||||
import { liveUrls } from '@/core/utils/urls'
|
import { liveUrls } from '@/core/utils/urls'
|
||||||
|
|
||||||
export enum LiveQuality {
|
export enum LiveQuality {
|
||||||
original = '原画',
|
Original = '原画',
|
||||||
blueRay = '蓝光',
|
BlueRay = '蓝光',
|
||||||
high = '超清',
|
High = '超清',
|
||||||
medium = '高清',
|
Medium = '高清',
|
||||||
low = '流畅',
|
Low = '流畅',
|
||||||
}
|
}
|
||||||
const entry: ComponentEntry = async ({ settings }) => {
|
const entry: ComponentEntry = async ({ settings }) => {
|
||||||
const { getDropdownItems } = await import('@/components/settings-panel/dropdown')
|
const { getDropdownItems } = await import('@/components/settings-panel/dropdown')
|
||||||
@ -60,7 +60,7 @@ export const component: ComponentMetadata = {
|
|||||||
options: {
|
options: {
|
||||||
quality: {
|
quality: {
|
||||||
displayName: '画质选择',
|
displayName: '画质选择',
|
||||||
defaultValue: LiveQuality.original,
|
defaultValue: LiveQuality.Original,
|
||||||
dropdownEnum: LiveQuality,
|
dropdownEnum: LiveQuality,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -77,7 +77,7 @@ export const component: ComponentMetadata = {
|
|||||||
displayName: '批量命名格式',
|
displayName: '批量命名格式',
|
||||||
},
|
},
|
||||||
downloadPackageEmitMode: {
|
downloadPackageEmitMode: {
|
||||||
defaultValue: DownloadPackageEmitMode.packed,
|
defaultValue: DownloadPackageEmitMode.Packed,
|
||||||
displayName: '文件下载模式',
|
displayName: '文件下载模式',
|
||||||
dropdownEnum: DownloadPackageEmitMode,
|
dropdownEnum: DownloadPackageEmitMode,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
/** 热更新使用的更新源 */
|
/** 热更新使用的更新源 */
|
||||||
export enum CdnTypes {
|
export enum CdnTypes {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
jsDelivr = 'jsDelivr',
|
jsDelivr = 'jsDelivr',
|
||||||
GitHub = 'GitHub',
|
GitHub = 'GitHub',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
export enum DownloadPackageEmitMode {
|
export enum DownloadPackageEmitMode {
|
||||||
packed = '打包下载',
|
Packed = '打包下载',
|
||||||
individual = '单独下载',
|
Individual = '单独下载',
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,7 +61,7 @@ export class DownloadPackage {
|
|||||||
filename = this.entries[0].name
|
filename = this.entries[0].name
|
||||||
}
|
}
|
||||||
const isIndividualMode = (
|
const isIndividualMode = (
|
||||||
getGeneralSettings().downloadPackageEmitMode === DownloadPackageEmitMode.individual
|
getGeneralSettings().downloadPackageEmitMode === DownloadPackageEmitMode.Individual
|
||||||
)
|
)
|
||||||
if (isIndividualMode && this.entries.length > 1) {
|
if (isIndividualMode && this.entries.length > 1) {
|
||||||
await Promise.all(this.entries.map(e => DownloadPackage.single(e.name, e.data, e.options)))
|
await Promise.all(this.entries.map(e => DownloadPackage.single(e.name, e.data, e.options)))
|
||||||
|
|||||||
@ -109,7 +109,7 @@ export const preloadStyles = lodash.once(async () => {
|
|||||||
}))
|
}))
|
||||||
const { UserStyleMode: CustomStyleMode } = await import('@/plugins/style')
|
const { UserStyleMode: CustomStyleMode } = await import('@/plugins/style')
|
||||||
Object.values(settings.userStyles)
|
Object.values(settings.userStyles)
|
||||||
.filter(c => c.mode === CustomStyleMode.instant)
|
.filter(c => c.mode === CustomStyleMode.Instant)
|
||||||
.forEach(c => {
|
.forEach(c => {
|
||||||
const style = document.createElement('style')
|
const style = document.createElement('style')
|
||||||
style.id = getDefaultStyleID(c.name)
|
style.id = getDefaultStyleID(c.name)
|
||||||
@ -138,13 +138,13 @@ export const loadAllCustomStyles = async () => {
|
|||||||
const { UserStyleMode: CustomStyleMode } = await import('@/plugins/style')
|
const { UserStyleMode: CustomStyleMode } = await import('@/plugins/style')
|
||||||
contentLoaded(() => {
|
contentLoaded(() => {
|
||||||
Object.values(settings.userStyles)
|
Object.values(settings.userStyles)
|
||||||
.filter(c => c.mode === CustomStyleMode.important)
|
.filter(c => c.mode === CustomStyleMode.Important)
|
||||||
.forEach(c => {
|
.forEach(c => {
|
||||||
addStyle(c.style, c.name, document.body)
|
addStyle(c.style, c.name, document.body)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
Object.values(settings.userStyles)
|
Object.values(settings.userStyles)
|
||||||
.filter(c => c.mode === CustomStyleMode.default)
|
.filter(c => c.mode === CustomStyleMode.Default)
|
||||||
.forEach(c => {
|
.forEach(c => {
|
||||||
addStyle(c.style, c.name, document.head)
|
addStyle(c.style, c.name, document.head)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
export enum CompareResult {
|
export enum CompareResult {
|
||||||
less = -1,
|
Less = -1,
|
||||||
equal = 0,
|
Equal = 0,
|
||||||
greater = 1,
|
Greater = 1,
|
||||||
incomparable = NaN
|
Incomparable = NaN
|
||||||
}
|
}
|
||||||
export class Version {
|
export class Version {
|
||||||
parts: number[]
|
parts: number[]
|
||||||
@ -15,28 +15,28 @@ export class Version {
|
|||||||
compareTo(other: Version) {
|
compareTo(other: Version) {
|
||||||
for (let i = 0; i < this.parts.length; ++i) {
|
for (let i = 0; i < this.parts.length; ++i) {
|
||||||
if (other.parts.length === i) {
|
if (other.parts.length === i) {
|
||||||
return CompareResult.greater
|
return CompareResult.Greater
|
||||||
}
|
}
|
||||||
if (this.parts[i] === other.parts[i]) {
|
if (this.parts[i] === other.parts[i]) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (this.parts[i] > other.parts[i]) {
|
if (this.parts[i] > other.parts[i]) {
|
||||||
return CompareResult.greater
|
return CompareResult.Greater
|
||||||
}
|
}
|
||||||
return CompareResult.less
|
return CompareResult.Less
|
||||||
}
|
}
|
||||||
if (this.parts.length !== other.parts.length) {
|
if (this.parts.length !== other.parts.length) {
|
||||||
return CompareResult.less
|
return CompareResult.Less
|
||||||
}
|
}
|
||||||
return CompareResult.equal
|
return CompareResult.Equal
|
||||||
}
|
}
|
||||||
greaterThan(other: Version) {
|
greaterThan(other: Version) {
|
||||||
return this.compareTo(other) === CompareResult.greater
|
return this.compareTo(other) === CompareResult.Greater
|
||||||
}
|
}
|
||||||
lessThan(other: Version) {
|
lessThan(other: Version) {
|
||||||
return this.compareTo(other) === CompareResult.less
|
return this.compareTo(other) === CompareResult.Less
|
||||||
}
|
}
|
||||||
equals(other: Version) {
|
equals(other: Version) {
|
||||||
return this.compareTo(other) === CompareResult.equal
|
return this.compareTo(other) === CompareResult.Equal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,11 +4,11 @@ import { deleteValue } from '@/core/utils'
|
|||||||
/** 自定义样式注入模式 */
|
/** 自定义样式注入模式 */
|
||||||
export enum UserStyleMode {
|
export enum UserStyleMode {
|
||||||
/** 组件加载完成后注入至<head>末尾 */
|
/** 组件加载完成后注入至<head>末尾 */
|
||||||
default = 'default',
|
Default = 'default',
|
||||||
/** 随首屏样式注入 */
|
/** 随首屏样式注入 */
|
||||||
instant = 'instant',
|
Instant = 'instant',
|
||||||
/** 组件加载完成后注入至<body>末尾 */
|
/** 组件加载完成后注入至<body>末尾 */
|
||||||
important = 'important',
|
Important = 'important',
|
||||||
}
|
}
|
||||||
/** 自定义样式定义 */
|
/** 自定义样式定义 */
|
||||||
export interface UserStyle {
|
export interface UserStyle {
|
||||||
@ -46,13 +46,13 @@ export const installStyle = async (input: UserStyle | string) => {
|
|||||||
} else {
|
} else {
|
||||||
const newStyle = {
|
const newStyle = {
|
||||||
displayName: name,
|
displayName: name,
|
||||||
mode: UserStyleMode.default,
|
mode: UserStyleMode.Default,
|
||||||
...userStyle,
|
...userStyle,
|
||||||
}
|
}
|
||||||
settings.userStyles[name] = newStyle
|
settings.userStyles[name] = newStyle
|
||||||
styles.push(newStyle)
|
styles.push(newStyle)
|
||||||
}
|
}
|
||||||
if (mode === UserStyleMode.important) {
|
if (mode === UserStyleMode.Important) {
|
||||||
addImportantStyle(style, name)
|
addImportantStyle(style, name)
|
||||||
} else {
|
} else {
|
||||||
addStyle(style, name)
|
addStyle(style, name)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user