mirror of
https://github.com/caojiezi2003/live2d-widget.git
synced 2024-11-10 04:49:47 +00:00
Update CDN URL
This commit is contained in:
parent
865ecc50da
commit
cfafafaa51
@ -31,7 +31,7 @@ Add Live2D widget to web page. Compatible with PJAX.
|
|||||||
本插件需要 Font Awesome 图标支持,请确保相关样式表已在页面中加载。以 Font Awesome v6 为例,请在 `<head>` 中加入:
|
本插件需要 Font Awesome 图标支持,请确保相关样式表已在页面中加载。以 Font Awesome v6 为例,请在 `<head>` 中加入:
|
||||||
Font Awesome is required for this plugin. Take Font Awesome v6 as an example, please add the following in `<head>`:
|
Font Awesome is required for this plugin. Take Font Awesome v6 as an example, please add the following in `<head>`:
|
||||||
```xml
|
```xml
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css">
|
<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css">
|
||||||
```
|
```
|
||||||
否则图标将无法正常显示。(如果网页中已经加载了任何版本的 Font Awesome,就不要重复加载了)
|
否则图标将无法正常显示。(如果网页中已经加载了任何版本的 Font Awesome,就不要重复加载了)
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ Font Awesome is required for this plugin. Take Font Awesome v6 as an example, pl
|
|||||||
|
|
||||||
将这一行代码加入 `<head>` 或 `<body>`,即可展现出效果:
|
将这一行代码加入 `<head>` 或 `<body>`,即可展现出效果:
|
||||||
```xml
|
```xml
|
||||||
<script src="https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/autoload.js"></script>
|
<script src="https://fastly.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/autoload.js"></script>
|
||||||
```
|
```
|
||||||
如果网站启用了 PJAX,由于看板娘不必每页刷新,因此要注意将相关脚本放到 PJAX 刷新区域之外。
|
如果网站启用了 PJAX,由于看板娘不必每页刷新,因此要注意将相关脚本放到 PJAX 刷新区域之外。
|
||||||
|
|
||||||
@ -53,7 +53,7 @@ Font Awesome is required for this plugin. Take Font Awesome v6 as an example, pl
|
|||||||
|
|
||||||
要自定义有关内容,可以把这个仓库 Fork 一份,然后进行修改。这时,使用方法对应地变为
|
要自定义有关内容,可以把这个仓库 Fork 一份,然后进行修改。这时,使用方法对应地变为
|
||||||
```xml
|
```xml
|
||||||
<script src="https://cdn.jsdelivr.net/gh/username/live2d-widget@latest/autoload.js"></script>
|
<script src="https://fastly.jsdelivr.net/gh/username/live2d-widget@latest/autoload.js"></script>
|
||||||
```
|
```
|
||||||
将此处的 `username` 替换为你的 GitHub 用户名。为了使 CDN 的内容正常刷新,需要创建新的 git tag 并推送至 GitHub 仓库中,否则此处的 `@latest` 仍然指向更新前的文件。此外 CDN 本身存在缓存,因此改动可能需要一定的时间生效。相关文档:
|
将此处的 `username` 替换为你的 GitHub 用户名。为了使 CDN 的内容正常刷新,需要创建新的 git tag 并推送至 GitHub 仓库中,否则此处的 `@latest` 仍然指向更新前的文件。此外 CDN 本身存在缓存,因此改动可能需要一定的时间生效。相关文档:
|
||||||
- [Git Basics - Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging)
|
- [Git Basics - Tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// 注意:live2d_path 参数应使用绝对路径
|
// 注意:live2d_path 参数应使用绝对路径
|
||||||
const live2d_path = "https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/";
|
const live2d_path = "https://fastly.jsdelivr.net/gh/stevenjoezhang/live2d-widget@latest/";
|
||||||
//const live2d_path = "/live2d-widget/";
|
//const live2d_path = "/live2d-widget/";
|
||||||
|
|
||||||
// 封装异步加载资源的方法
|
// 封装异步加载资源的方法
|
||||||
@ -34,7 +34,7 @@ if (screen.width >= 768) {
|
|||||||
initWidget({
|
initWidget({
|
||||||
waifuPath: live2d_path + "waifu-tips.json",
|
waifuPath: live2d_path + "waifu-tips.json",
|
||||||
//apiPath: "https://live2d.fghrsh.net/api/",
|
//apiPath: "https://live2d.fghrsh.net/api/",
|
||||||
cdnPath: "https://cdn.jsdelivr.net/gh/fghrsh/live2d_api/"
|
cdnPath: "https://fastly.jsdelivr.net/gh/fghrsh/live2d_api/"
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>Live2D 看板娘 / Demo</title>
|
<title>Live2D 看板娘 / Demo</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css">
|
<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css">
|
||||||
<style>
|
<style>
|
||||||
#github svg {
|
#github svg {
|
||||||
transition: all 1s;
|
transition: all 1s;
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
<title>看板娘登陆平台</title>
|
<title>看板娘登陆平台</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css">
|
<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/bootstrap@5/dist/css/bootstrap.min.css">
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css">
|
<link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/@fortawesome/fontawesome-free@6/css/all.min.css">
|
||||||
<script src="../live2d.min.js"></script>
|
<script src="../live2d.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
html, body {
|
html, body {
|
||||||
|
@ -65,7 +65,7 @@ function loadWidget(config) {
|
|||||||
window.ASTEROIDSPLAYERS.push(new Asteroids());
|
window.ASTEROIDSPLAYERS.push(new Asteroids());
|
||||||
} else {
|
} else {
|
||||||
const script = document.createElement("script");
|
const script = document.createElement("script");
|
||||||
script.src = "https://cdn.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js";
|
script.src = "https://fastly.jsdelivr.net/gh/stevenjoezhang/asteroids/asteroids.js";
|
||||||
document.head.appendChild(script);
|
document.head.appendChild(script);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user