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