From ed066f8565bbc6ef5c06eb55be24472ad0d40cf2 Mon Sep 17 00:00:00 2001 From: Liwanyi Date: Fri, 3 Mar 2023 15:35:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rollup.config.js | 2 +- src/ts/class/Application.ts | 95 +++++++++++++++++++------------------ src/ts/index.ts | 51 ++++++++++++++++++-- 3 files changed, 96 insertions(+), 52 deletions(-) diff --git a/rollup.config.js b/rollup.config.js index c7530f9..525ba4e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -16,7 +16,7 @@ let vuePath = node_env === 'production' ? 'vue/dist/vue.runtime.esm-browser.prod.js' : 'vue/dist/vue.runtime.esm-browser.js'; export default { - input: 'src/ts/class/Application.ts', + input: 'src/ts/index.ts', output: { file: 'dist/bundle.js', format: 'iife', diff --git a/src/ts/class/Application.ts b/src/ts/class/Application.ts index fe63b1d..f753ce2 100644 --- a/src/ts/class/Application.ts +++ b/src/ts/class/Application.ts @@ -1,47 +1,48 @@ -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"; -import EntryPoint from "./provider/EntryPoint"; - -@EntryPoint -export default class Application { - - public static main(): void { - WuhuBase.conditionInterrupt(); - - // 初始化 - WuHuTornHelper.getInstance().init(); - - // 插件设置默认值 - WuhuConfig.setDefaults(); - - // 插件图标和设置菜单 - ZhongIcon.getInstance().init(); - - let tmp = () => { - // 所有页面通用 - try { - Common.getInstance().resolve(Application.main); - } catch (e) { - // if (e.message === '重载') Common.getInstance().resolve(null); - } - - // URL匹配 - UrlPattern.getInstance().resolve(); - - // 翻译 - if (WuhuConfig.get('transEnable')) translateMain(window.location.href); - }; - // TODO 临时检测jquery - if (typeof $ === "function") { - tmp(); - } else { - CommonUtils.getInstance().jQueryReady().then(() => tmp()); - } - } -} +// 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"; +// import EntryPoint from "./provider/EntryPoint"; +// +// @EntryPoint +// export default class Application { +// +// public static main(): void { +// WuhuBase.conditionInterrupt(); +// +// // 初始化 +// WuHuTornHelper.getInstance().init(); +// +// // 插件设置默认值 +// WuhuConfig.setDefaults(); +// +// // 插件图标和设置菜单 +// ZhongIcon.getInstance().init(); +// +// let tmp = () => { +// // 所有页面通用 +// try { +// Common.getInstance().resolve(Application.main); +// } catch (e) { +// // if (e.message === '重载') Common.getInstance().resolve(null); +// } +// +// // URL匹配 +// UrlPattern.getInstance().resolve(); +// +// // 翻译 +// if (WuhuConfig.get('transEnable')) translateMain(window.location.href); +// }; +// // TODO 临时检测jquery +// if (typeof $ === "function") { +// tmp(); +// } else { +// CommonUtils.getInstance().jQueryReady().then(() => tmp()); +// } +// } +// } +export default {} \ No newline at end of file diff --git a/src/ts/index.ts b/src/ts/index.ts index 64918dd..2043792 100644 --- a/src/ts/index.ts +++ b/src/ts/index.ts @@ -1,4 +1,47 @@ -// import Starter from "./class/provider/Starter"; -// import Application from "./class/Application"; -// -// Starter.run(Application); \ No newline at end of file +import WuhuBase from "./class/WuhuBase"; +import WuHuTornHelper from "./class/WuhuTornHelper"; +import ZhongIcon from "./class/ZhongIcon"; +import { Common } from "./class/Common"; +import UrlPattern from "./class/UrlMatch"; +import WuhuConfig from "./class/WuhuConfig"; +import translateMain from "./func/translate/translateMain"; +import CommonUtils from "./class/utils/CommonUtils"; +import EntryPoint from "./class/provider/EntryPoint"; + +@EntryPoint +export default class Application { + + public static main(): void { + WuhuBase.conditionInterrupt(); + + // 初始化 + WuHuTornHelper.getInstance().init(); + + // 插件设置默认值 + WuhuConfig.setDefaults(); + + // 插件图标和设置菜单 + ZhongIcon.getInstance().init(); + + let tmp = () => { + // 所有页面通用 + try { + Common.getInstance().resolve(Application.main); + } catch (e) { + // if (e.message === '重载') Common.getInstance().resolve(null); + } + + // URL匹配 + UrlPattern.getInstance().resolve(); + + // 翻译 + if (WuhuConfig.get('transEnable')) translateMain(window.location.href); + }; + // TODO 临时检测jquery + if (typeof $ === "function") { + tmp(); + } else { + CommonUtils.getInstance().jQueryReady().then(() => tmp()); + } + } +}