mirror of
https://github.com/caojiezi2003/live2d-widget.git
synced 2024-11-22 15:19:44 +00:00
Optimize Chinese and English typography
This commit is contained in:
parent
1cdd6653dd
commit
6fd4ed5b07
12
autoload.js
12
autoload.js
@ -1,8 +1,8 @@
|
||||
//注意:live2d_path参数应使用绝对路径
|
||||
// 注意:live2d_path 参数应使用绝对路径
|
||||
const live2d_path = "https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget/";
|
||||
//const live2d_path = "/live2d-widget/";
|
||||
|
||||
//封装异步加载资源的方法
|
||||
// 封装异步加载资源的方法
|
||||
function loadExternalResource(url, type) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let tag;
|
||||
@ -24,7 +24,7 @@ function loadExternalResource(url, type) {
|
||||
});
|
||||
}
|
||||
|
||||
//加载waifu.css live2d.min.js waifu-tips.js
|
||||
// 加载 waifu.css live2d.min.js waifu-tips.js
|
||||
Promise.all([
|
||||
loadExternalResource(live2d_path + "waifu.css", "css"),
|
||||
loadExternalResource(live2d_path + "live2d.min.js", "js"),
|
||||
@ -32,9 +32,9 @@ Promise.all([
|
||||
]).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
|
||||
// initWidget 第一个参数为 waifu-tips.json 的路径,第二个参数为 api 地址
|
||||
// api 后端可自行搭建,参考 https://github.com/fghrsh/live2d_api
|
||||
// 初始化看板娘会自动加载指定目录下的 waifu-tips.json
|
||||
|
||||
console.log(`
|
||||
く__,.ヘヽ. / ,ー、 〉
|
||||
|
@ -211,7 +211,7 @@ $(function() {
|
||||
}
|
||||
|
||||
window.info = function() {
|
||||
//Your code here...
|
||||
// Your code here...
|
||||
$.getJSON("https://v1.hitokoto.cn/", function(data) {
|
||||
alert("「" + data.hitokoto + "」——" + data.from);
|
||||
});
|
||||
|
@ -67,8 +67,8 @@ function loadWidget(waifuPath, apiPath) {
|
||||
registerEventListener();
|
||||
|
||||
function welcomeMessage() {
|
||||
var SiteIndexUrl = `${location.protocol}//${location.host}/`, text; //自动获取主页
|
||||
if (location.href == SiteIndexUrl) { //如果是主页
|
||||
var SiteIndexUrl = `${location.protocol}//${location.host}/`, text; // 自动获取主页
|
||||
if (location.href == SiteIndexUrl) { // 如果是主页
|
||||
var now = new Date().getHours();
|
||||
if (now > 5 && now <= 7) text = "早上好!一日之计在于晨,美好的一天就要开始了。";
|
||||
else if (now > 7 && now <= 11) text = "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!";
|
||||
@ -93,7 +93,7 @@ function loadWidget(waifuPath, apiPath) {
|
||||
showMessage(text, 7000, 8);
|
||||
}
|
||||
welcomeMessage();
|
||||
//检测用户活动状态,并在空闲时定时显示一言
|
||||
// 检测用户活动状态,并在空闲时定时显示一言
|
||||
var userAction = false,
|
||||
hitokotoTimer = null,
|
||||
messageTimer = null,
|
||||
@ -115,7 +115,7 @@ function loadWidget(waifuPath, apiPath) {
|
||||
}, 1000);
|
||||
|
||||
function showHitokoto() {
|
||||
//增加 hitokoto.cn 的 API
|
||||
// 增加 hitokoto.cn 的 API
|
||||
if (Math.random() < 0.6 && messageArray.length > 0) showMessage(messageArray[Math.floor(Math.random() * messageArray.length)], 6000, 9);
|
||||
else fetch("https://v1.hitokoto.cn")
|
||||
.then(response => response.json())
|
||||
@ -149,9 +149,9 @@ function loadWidget(waifuPath, apiPath) {
|
||||
var modelId = localStorage.getItem("modelId"),
|
||||
modelTexturesId = localStorage.getItem("modelTexturesId");
|
||||
if (modelId == null) {
|
||||
//首次访问加载 指定模型 的 指定材质
|
||||
var modelId = 1, //模型 ID
|
||||
modelTexturesId = 53; //材质 ID
|
||||
// 首次访问加载 指定模型 的 指定材质
|
||||
var modelId = 1, // 模型 ID
|
||||
modelTexturesId = 53; // 材质 ID
|
||||
}
|
||||
loadModel(modelId, modelTexturesId);
|
||||
fetch(waifuPath)
|
||||
@ -198,7 +198,7 @@ function loadWidget(waifuPath, apiPath) {
|
||||
function loadRandModel() {
|
||||
var modelId = localStorage.getItem("modelId"),
|
||||
modelTexturesId = localStorage.getItem("modelTexturesId");
|
||||
//可选 "rand"(随机), "switch"(顺序)
|
||||
// 可选 "rand"(随机), "switch"(顺序)
|
||||
fetch(`${apiPath}/rand_textures/?id=${modelId}-${modelTexturesId}`)
|
||||
.then(response => response.json())
|
||||
.then(result => {
|
||||
|
@ -118,13 +118,13 @@
|
||||
"text": ["分享到豆瓣好像也不错!"]
|
||||
}, {
|
||||
"selector": ".need-share-button_qqzone",
|
||||
"text": ["QQ空间,一键转发,耶~"]
|
||||
"text": ["QQ 空间,一键转发,耶~"]
|
||||
}, {
|
||||
"selector": ".need-share-button_twitter",
|
||||
"text": ["Twitter?好像是不存在的东西?"]
|
||||
}, {
|
||||
"selector": ".need-share-button_facebook",
|
||||
"text": ["emmm…FB好像也是不存在的东西?"]
|
||||
"text": ["emmm…FB 好像也是不存在的东西?"]
|
||||
}, {
|
||||
"selector": ".post-nav-next",
|
||||
"text": ["来看看下一篇文章吧。", "点它可以看下一篇文章哦!", "要翻到下一篇文章吗?"]
|
||||
@ -151,7 +151,7 @@
|
||||
"text": ["想要去评论些什么吗?", "要说点什么吗?", "觉得博客不错?快来留言和主人交流吧!"]
|
||||
}, {
|
||||
"selector": ".vcontrol a",
|
||||
"text": ["你会不会熟练使用Markdown呀?", "使用Markdown让评论更美观吧~"]
|
||||
"text": ["你会不会熟练使用 Markdown 呀?", "使用 Markdown 让评论更美观吧~"]
|
||||
}, {
|
||||
"selector": ".vemoji-btn",
|
||||
"text": ["要插入一个萌萌哒的表情吗?", "要来一发表情吗?"]
|
||||
@ -167,7 +167,7 @@
|
||||
}],
|
||||
"click": [{
|
||||
"selector": "#waifu #live2d",
|
||||
"text": ["是…是不小心碰到了吧…", "萝莉控是什么呀?", "你看到我的小熊了吗?", "再摸的话我可要报警了!⌇●﹏●⌇", "110吗,这里有个变态一直在摸我(ó﹏ò。)", "不要摸我了,我会告诉老婆来打你的!", "干嘛动我呀!小心我咬你!", "别摸我,有什么好摸的!"]
|
||||
"text": ["是…是不小心碰到了吧…", "萝莉控是什么呀?", "你看到我的小熊了吗?", "再摸的话我可要报警了!⌇●﹏●⌇", "110 吗,这里有个变态一直在摸我(ó﹏ò。)", "不要摸我了,我会告诉老婆来打你的!", "干嘛动我呀!小心我咬你!", "别摸我,有什么好摸的!"]
|
||||
}, {
|
||||
"selector": ".veditor",
|
||||
"text": ["要吐槽些什么呢?", "一定要认真填写喵~", "有什么想说的吗?"]
|
||||
|
Loading…
Reference in New Issue
Block a user