Skip to content

Commit

Permalink
Update autoload.js
Browse files Browse the repository at this point in the history
  • Loading branch information
GavinIves authored Jul 31, 2020
1 parent 18921bb commit 6170c48
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions autoload.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// 注意:live2d_path 参数应使用绝对路径
const live2d_path = "https://cdn.jsdelivr.net/gh/gavinives/live2d-widget3/";
const live2d_path = "https://cdn.jsdelivr.net/gh/gavinives/live2d-widget@master/";
//const live2d_path = "/live2d-widget/";

// 封装异步加载资源的方法
Expand All @@ -25,19 +25,13 @@ function loadExternalResource(url, type) {
}

// 加载 waifu.css live2d.min.js waifu-tips.js
if (screen.width >= 768) {
Promise.all([
loadExternalResource(live2d_path + "waifu.css", "css"),
loadExternalResource(live2d_path + "live2d.min.js", "js"),
loadExternalResource(live2d_path + "waifu-tips.js", "js")
]).then(() => {
initWidget({
waifuPath: live2d_path + "waifu-tips.json",
//apiPath: "https://live2d.fghrsh.net/api/",
cdnPath: "https://cdn.jsdelivr.net/gh/fghrsh/live2d_api/"
});
});
}
Promise.all([
loadExternalResource(live2d_path + "waifu.css", "css"),
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 第一个参数为 waifu-tips.json 的路径,第二个参数为 API 地址
// API 后端可自行搭建,参考 https://github.com/fghrsh/live2d_api
// 初始化看板娘会自动加载指定目录下的 waifu-tips.json
Expand Down

0 comments on commit 6170c48

Please sign in to comment.