From 95f06fab6af0f54bb34c47642db3ad324955ac3b Mon Sep 17 00:00:00 2001 From: StevenJoeZhang <1119186082@qq.com> Date: Fri, 2 Nov 2018 23:04:54 +0800 Subject: [PATCH] change api url --- README.md | 17 ++++++++++------- autoload.js | 2 +- waifu-tips.js | 3 +-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 3a0cc58..5249a87 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,25 @@ # live2d-widget ## 功能 -在网页中添加 Live2D 看板娘 +在网页中添加Live2D看板娘 ## Demo -https://zhangshuqiao.org -左下角可查看效果 +在[米米的博客](https://zhangshuqiao.org)的左下角可查看效果 ## 依赖 需要jQuery和font-awesome -请确保它们已在页面中加载 +请确保它们已在页面中加载,例如在`
`中加入: +``` + + +``` ## 使用 -请修改autoload.js中的参数(具体参考该文件内的注释),这样,通过 +请把整个项目克隆到服务器上,使之能够通过正常访问。修改autoload.js中的参数(具体参考该文件内的注释),这样,通过 ``` - + ``` -就可以加载了 +就可以加载了。 waifu-tips.json中包含了触发条件(selector,选择器)和触发时显示的文字(text)。源文件是对Hexo的NexT主题有效的,为了适用于你自己的网页,也需要自行修改,或增加新内容。 diff --git a/autoload.js b/autoload.js index 3b84858..eeab6ed 100644 --- a/autoload.js +++ b/autoload.js @@ -19,7 +19,7 @@ $.ajax({ // 初始化看板娘,会自动加载指定目录下的 waifu-tips.json $(window).on("load", function() { - initWidget("/lib/waifu/", "https://api.fghrsh.net/live2d"); + initWidget("/lib/waifu/", "https://live2d.fghrsh.net/api"); }); //initWidget第一个参数为waifu-tips.json所在的文件夹,第二个参数为api地址 //api后端可自行搭建,参考https://github.com/fghrsh/live2d_api diff --git a/waifu-tips.js b/waifu-tips.js index 7108745..80ba420 100755 --- a/waifu-tips.js +++ b/waifu-tips.js @@ -207,8 +207,7 @@ function initWidget(waifuPath, apiPath) { function initModel() { if (waifuPath === undefined) waifuPath = ""; - if (apiPath === undefined) apiPath = ""; - apiURL = apiPath; + apiURL = apiPath || ""; var modelId = localStorage.getItem("modelId"), modelTexturesId = localStorage.getItem("modelTexturesId"); if (modelId == null) {