diff --git a/dist/main.js b/dist/main.js index 2b5da35..4c01980 100644 --- a/dist/main.js +++ b/dist/main.js @@ -15,8 +15,6 @@ (function () { 'use strict'; - if (!window.UGAPP || !window.UGAPP.store || !window.UGAPP.store.jmuse_settings) { return } - const getIndexPath = (id) => { const idStr = String(id); // 获取最后三位,倒序排列 @@ -42,6 +40,10 @@ }; const main = () => { + // @ts-ignore + if (!window.UGAPP || !window.UGAPP.store || !window.UGAPP.store.jmuse_settings) { + return; + } // @ts-ignore const scorePlayer = window.UGAPP.store.jmuse_settings.score_player; const { id, vid } = scorePlayer.json; diff --git a/rollup.config.js b/rollup.config.js index 81e78fd..0051e95 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -16,7 +16,6 @@ export default { format: "iife", sourcemap: false, banner: getBannerText, - intro: "if (!window.UGAPP || !window.UGAPP.store || !window.UGAPP.store.jmuse_settings) { return }" }, plugins: [ typescript({ diff --git a/src/main.ts b/src/main.ts index bbdf562..3d45f5b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,6 +5,9 @@ import { getIndexPath, waitForDocumentLoaded } from "./utils" const main = () => { + // @ts-ignore + if (!window.UGAPP || !window.UGAPP.store || !window.UGAPP.store.jmuse_settings) { return } + // @ts-ignore const scorePlayer: ScorePlayerData = window.UGAPP.store.jmuse_settings.score_player