mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-04-01 06:39:45 +08:00
🎨 代码格式化
This commit is contained in:
@@ -1,29 +1,21 @@
|
||||
/**
|
||||
* @file plugins Mys index.ts
|
||||
* @description Mys plugin index
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Beta v0.3.0
|
||||
*/
|
||||
|
||||
// Api
|
||||
import MysApi from "./api";
|
||||
// Post
|
||||
import getPostData from "./request/getPostData";
|
||||
import parsePost from "./utils/parsePost";
|
||||
// Gacha
|
||||
import getGachaData from "./request/getGachaData";
|
||||
import getGachaCard from "./utils/getGachaCard";
|
||||
// Position
|
||||
import getPositionData from "./request/getPositionData";
|
||||
import getPositionCard from "./utils/getPositionCard";
|
||||
// News
|
||||
import getNewsList from "./request/getNewsList";
|
||||
import { getNoticeCard, getActivityCard, getNewsCard } from "./utils/getNewsCard";
|
||||
// Lottery
|
||||
import getLotteryData from "./request/getLotteryData";
|
||||
import getLotteryCard from "./utils/getLotteryCard";
|
||||
// User
|
||||
import { getLoginQr, getLoginStatus } from "./request/doGameLogin";
|
||||
import getGachaData from "./request/getGachaData";
|
||||
import getLotteryData from "./request/getLotteryData";
|
||||
import getNewsList from "./request/getNewsList";
|
||||
import getPositionData from "./request/getPositionData";
|
||||
import getPostData from "./request/getPostData";
|
||||
import getGachaCard from "./utils/getGachaCard";
|
||||
import getLotteryCard from "./utils/getLotteryCard";
|
||||
import { getNoticeCard, getActivityCard, getNewsCard } from "./utils/getNewsCard";
|
||||
import getPositionCard from "./utils/getPositionCard";
|
||||
import parsePost from "./utils/parsePost";
|
||||
|
||||
const Mys = {
|
||||
Api: MysApi,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* @file plugins Mys request getGachaData.ts
|
||||
* @description Mys 抽卡请求
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import MysApi from "../api";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* @file plugins Mys interface getLotteryData.ts
|
||||
* @description Mys 插件抽奖接口
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import MysApi from "../api";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* @file plugins Mys request getNewsList.ts
|
||||
* @description Mys 插件咨讯请求
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import MysApi from "../api";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* @file plugins Mys request getPositionData.ts
|
||||
* @description Mys 插件热点追踪请求
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import MysApi from "../api";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* @file plugins Mys request getPostData.ts
|
||||
* @description Mys帖子请求
|
||||
* @author BTMuli <bt-muli@outlook.com>
|
||||
* @since Alpha v0.2.1
|
||||
*/
|
||||
|
||||
import { http } from "@tauri-apps/api";
|
||||
|
||||
import MysApi from "../api";
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* @since Beta v0.3.3
|
||||
*/
|
||||
|
||||
import { score } from "wcag-color";
|
||||
import * as colorConvert from "color-convert";
|
||||
import { score } from "wcag-color";
|
||||
|
||||
/**
|
||||
* @description 给定两个16进制颜色值,确认两者是否相近
|
||||
@@ -215,10 +215,10 @@ function LinkTextParser(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLSpa
|
||||
throw new Error(`[LinkTextParser] data.insert is not a string: ${JSON.stringify(data)}`);
|
||||
}
|
||||
if (data.attributes == null) {
|
||||
throw new Error(`[LinkTextParser] data.attributes is not defined`);
|
||||
throw new Error("[LinkTextParser] data.attributes is not defined");
|
||||
}
|
||||
if (!data.attributes.link) {
|
||||
throw new Error(`[LinkTextParser] data.attributes.link is not defined`);
|
||||
throw new Error("[LinkTextParser] data.attributes.link is not defined");
|
||||
}
|
||||
// 创建图标
|
||||
const icon = document.createElement("i");
|
||||
@@ -254,7 +254,7 @@ function parseDivider(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLDivEl
|
||||
throw new Error(`[ParseDivider] data.insert is a string: ${data.insert}`);
|
||||
}
|
||||
if (!data.insert.divider) {
|
||||
throw new Error(`[ParseDivider] data.insert.divider is not defined`);
|
||||
throw new Error("[ParseDivider] data.insert.divider is not defined");
|
||||
}
|
||||
// 创建分割线
|
||||
const div = document.createElement("div");
|
||||
@@ -291,7 +291,7 @@ function parseImage(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLDivElem
|
||||
throw new Error(`[ParseImage] data.insert is a string: ${data.insert}`);
|
||||
}
|
||||
if (!data.insert.image) {
|
||||
throw new Error(`[ParseImage] data.insert.image is not defined`);
|
||||
throw new Error("[ParseImage] data.insert.image is not defined");
|
||||
}
|
||||
const div = document.createElement("div");
|
||||
// 创建图片
|
||||
@@ -319,7 +319,7 @@ function parseVideo(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLDivElem
|
||||
throw new Error(`[ParseVideo] data.insert is a string: ${data.insert}`);
|
||||
}
|
||||
if (data.insert.vod == null && !data.insert.video) {
|
||||
throw new Error(`[ParseVideo] data.insert.vod and data.insert.video is not defined`);
|
||||
throw new Error("[ParseVideo] data.insert.vod and data.insert.video is not defined");
|
||||
}
|
||||
// 创建 div
|
||||
const div = document.createElement("div");
|
||||
@@ -383,7 +383,7 @@ function parseBackup(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLDivEle
|
||||
return LotteryParser(data);
|
||||
}
|
||||
if (data.insert.fold == null) {
|
||||
throw new Error(`[ParseBackup] data.insert.fold is not defined`);
|
||||
throw new Error("[ParseBackup] data.insert.fold is not defined");
|
||||
}
|
||||
// 转换
|
||||
const titleJson: TGApp.Plugins.Mys.Post.StructuredContent[] = JSON.parse(data.insert.fold.title);
|
||||
@@ -428,13 +428,13 @@ function LotteryParser(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLDivE
|
||||
throw new Error(`[LotteryParser] data.insert is a string: ${data.insert}`);
|
||||
}
|
||||
if (!data.insert.backup_text) {
|
||||
throw new Error(`[LotteryParser] data.insert.backup_text is not defined`);
|
||||
throw new Error("[LotteryParser] data.insert.backup_text is not defined");
|
||||
}
|
||||
if (data.insert.backup_text !== "[抽奖]") {
|
||||
throw new Error(`[LotteryParser] data.insert.backup_text is not [抽奖]`);
|
||||
throw new Error("[LotteryParser] data.insert.backup_text is not [抽奖]");
|
||||
}
|
||||
if (data.insert.lottery == null) {
|
||||
throw new Error(`[LotteryParser] data.insert.lottery is not defined`);
|
||||
throw new Error("[LotteryParser] data.insert.lottery is not defined");
|
||||
}
|
||||
// 创建 div
|
||||
const div = document.createElement("div");
|
||||
@@ -466,7 +466,7 @@ function parseLinkCard(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLDivE
|
||||
throw new Error(`[ParseLinkCard] data.insert is a string: ${data.insert}`);
|
||||
}
|
||||
if (data.insert.link_card == null) {
|
||||
throw new Error(`[ParseLinkCard] data.insert.link_card is not defined`);
|
||||
throw new Error("[ParseLinkCard] data.insert.link_card is not defined");
|
||||
}
|
||||
// 创建 div
|
||||
const div = document.createElement("div");
|
||||
@@ -529,7 +529,7 @@ function parseMention(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLAncho
|
||||
throw new Error(`[ParseMention] data.insert is a string: ${data.insert}`);
|
||||
}
|
||||
if (data.insert.mention == null) {
|
||||
throw new Error(`[ParseMention] data.insert.mention is not defined`);
|
||||
throw new Error("[ParseMention] data.insert.mention is not defined");
|
||||
}
|
||||
// 创建图标
|
||||
const icon = document.createElement("i");
|
||||
@@ -558,7 +558,7 @@ function emojiParser(data: TGApp.Plugins.Mys.Post.StructuredContent): HTMLImageE
|
||||
}
|
||||
const emojis = localStorage.getItem("emojis");
|
||||
if (!emojis) {
|
||||
throw new Error(`[EmojiParser] emojis is not defined`);
|
||||
throw new Error("[EmojiParser] emojis is not defined");
|
||||
}
|
||||
const emojiList: Record<string, string> = JSON.parse(emojis);
|
||||
const emojiName = data.insert.slice(2, -1);
|
||||
|
||||
Reference in New Issue
Block a user