diff --git a/autoload.js b/autoload.js index b2020e7..aa2d56f 100644 --- a/autoload.js +++ b/autoload.js @@ -31,7 +31,11 @@ if (screen.width >= 768) { loadExternalResource(live2d_path + "live2d.min.js", "js"), loadExternalResource(live2d_path + "waifu-tips.js", "js") ]).then(() => { - initWidget(live2d_path + "waifu-tips.json", "https://live2d.fghrsh.net/api"); + initWidget({ + waifuPath: live2d_path + "waifu-tips.json", + apiPath: "https://live2d.fghrsh.net/api", + cdnPath: "https://cdn.jsdelivr.net/gh/fghrsh/live2d_api" + }); }); } // initWidget 第一个参数为 waifu-tips.json 的路径,第二个参数为 API 地址 diff --git a/waifu-tips.js b/waifu-tips.js index f44a4b8..88e3330 100755 --- a/waifu-tips.js +++ b/waifu-tips.js @@ -3,7 +3,8 @@ * https://github.com/stevenjoezhang/live2d-widget */ -function loadWidget(waifuPath, apiPath) { +function loadWidget(config) { + let { waifuPath, apiPath } = config; localStorage.removeItem("waifu-display"); sessionStorage.removeItem("waifu-text"); document.body.insertAdjacentHTML("beforeend", `