wuhu-torn-helper/src/class/Application.ts
2022-11-03 16:34:58 +08:00

41 lines
1.1 KiB
TypeScript

import WuhuBase from "./WuhuBase";
import WuHuTornHelper from "./WuhuTornHelper";
import ZhongIcon from "./ZhongIcon";
import { Common } from "./Common";
import UrlPattern from "./UrlMatch";
import WuhuConfig from "./WuhuConfig";
import translateMain from "../func/translate/translateMain";
import CommonUtils from "./utils/CommonUtils";
export default class Application {
public static main() {
WuhuBase.conditionInterrupt();
// 初始化
WuHuTornHelper.getInstance();
// 插件设置默认值
WuhuConfig.setDefaults();
// 插件图标和设置菜单
ZhongIcon.getInstance();
let tmp = () => {
// 所有页面通用
Common.getInstance().resolve();
// URL匹配
UrlPattern.getInstance().resolve();
// 翻译
if (WuhuConfig.get('transEnable')) translateMain(window.location.href);
};
// TODO 临时检测jquery
if (typeof $ === "function") {
tmp();
} else {
CommonUtils.getInstance().jQueryReady().then(() => tmp());
}
}
}