Optimize Chinese and English typography

This commit is contained in:
Mimi 2019-12-26 11:58:27 +08:00
parent 1cdd6653dd
commit 6fd4ed5b07
4 changed files with 19 additions and 19 deletions

View File

@ -1,8 +1,8 @@
//注意live2d_path参数应使用绝对路径 // 注意live2d_path 参数应使用绝对路径
const live2d_path = "https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget/"; const live2d_path = "https://cdn.jsdelivr.net/gh/stevenjoezhang/live2d-widget/";
//const live2d_path = "/live2d-widget/"; //const live2d_path = "/live2d-widget/";
//封装异步加载资源的方法 // 封装异步加载资源的方法
function loadExternalResource(url, type) { function loadExternalResource(url, type) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let tag; 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([ Promise.all([
loadExternalResource(live2d_path + "waifu.css", "css"), loadExternalResource(live2d_path + "waifu.css", "css"),
loadExternalResource(live2d_path + "live2d.min.js", "js"), loadExternalResource(live2d_path + "live2d.min.js", "js"),
@ -32,9 +32,9 @@ Promise.all([
]).then(() => { ]).then(() => {
initWidget(live2d_path + "waifu-tips.json", "https://live2d.fghrsh.net/api"); initWidget(live2d_path + "waifu-tips.json", "https://live2d.fghrsh.net/api");
}); });
//initWidget第一个参数为waifu-tips.json的路径第二个参数为api地址 // initWidget 第一个参数为 waifu-tips.json 的路径,第二个参数为 api 地址
//api后端可自行搭建参考https://github.com/fghrsh/live2d_api // api 后端可自行搭建,参考 https://github.com/fghrsh/live2d_api
//初始化看板娘会自动加载指定目录下的waifu-tips.json // 初始化看板娘会自动加载指定目录下的 waifu-tips.json
console.log(` console.log(`
__,.ヘヽ. / , __,.ヘヽ. / ,

View File

@ -211,7 +211,7 @@ $(function() {
} }
window.info = function() { window.info = function() {
//Your code here... // Your code here...
$.getJSON("https://v1.hitokoto.cn/", function(data) { $.getJSON("https://v1.hitokoto.cn/", function(data) {
alert("「" + data.hitokoto + "」——" + data.from); alert("「" + data.hitokoto + "」——" + data.from);
}); });

View File

@ -67,8 +67,8 @@ function loadWidget(waifuPath, apiPath) {
registerEventListener(); registerEventListener();
function welcomeMessage() { function welcomeMessage() {
var SiteIndexUrl = `${location.protocol}//${location.host}/`, text; //自动获取主页 var SiteIndexUrl = `${location.protocol}//${location.host}/`, text; // 自动获取主页
if (location.href == SiteIndexUrl) { //如果是主页 if (location.href == SiteIndexUrl) { // 如果是主页
var now = new Date().getHours(); var now = new Date().getHours();
if (now > 5 && now <= 7) text = "早上好!一日之计在于晨,美好的一天就要开始了。"; if (now > 5 && now <= 7) text = "早上好!一日之计在于晨,美好的一天就要开始了。";
else if (now > 7 && now <= 11) text = "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!"; else if (now > 7 && now <= 11) text = "上午好!工作顺利嘛,不要久坐,多起来走动走动哦!";
@ -93,7 +93,7 @@ function loadWidget(waifuPath, apiPath) {
showMessage(text, 7000, 8); showMessage(text, 7000, 8);
} }
welcomeMessage(); welcomeMessage();
//检测用户活动状态,并在空闲时定时显示一言 // 检测用户活动状态,并在空闲时定时显示一言
var userAction = false, var userAction = false,
hitokotoTimer = null, hitokotoTimer = null,
messageTimer = null, messageTimer = null,
@ -115,7 +115,7 @@ function loadWidget(waifuPath, apiPath) {
}, 1000); }, 1000);
function showHitokoto() { 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); if (Math.random() < 0.6 && messageArray.length > 0) showMessage(messageArray[Math.floor(Math.random() * messageArray.length)], 6000, 9);
else fetch("https://v1.hitokoto.cn") else fetch("https://v1.hitokoto.cn")
.then(response => response.json()) .then(response => response.json())
@ -149,9 +149,9 @@ function loadWidget(waifuPath, apiPath) {
var modelId = localStorage.getItem("modelId"), var modelId = localStorage.getItem("modelId"),
modelTexturesId = localStorage.getItem("modelTexturesId"); modelTexturesId = localStorage.getItem("modelTexturesId");
if (modelId == null) { if (modelId == null) {
//首次访问加载 指定模型 的 指定材质 // 首次访问加载 指定模型 的 指定材质
var modelId = 1, //模型 ID var modelId = 1, // 模型 ID
modelTexturesId = 53; //材质 ID modelTexturesId = 53; // 材质 ID
} }
loadModel(modelId, modelTexturesId); loadModel(modelId, modelTexturesId);
fetch(waifuPath) fetch(waifuPath)
@ -198,7 +198,7 @@ function loadWidget(waifuPath, apiPath) {
function loadRandModel() { function loadRandModel() {
var modelId = localStorage.getItem("modelId"), var modelId = localStorage.getItem("modelId"),
modelTexturesId = localStorage.getItem("modelTexturesId"); modelTexturesId = localStorage.getItem("modelTexturesId");
//可选 "rand"(随机), "switch"(顺序) // 可选 "rand"(随机), "switch"(顺序)
fetch(`${apiPath}/rand_textures/?id=${modelId}-${modelTexturesId}`) fetch(`${apiPath}/rand_textures/?id=${modelId}-${modelTexturesId}`)
.then(response => response.json()) .then(response => response.json())
.then(result => { .then(result => {

View File

@ -118,13 +118,13 @@
"text": ["分享到豆瓣好像也不错!"] "text": ["分享到豆瓣好像也不错!"]
}, { }, {
"selector": ".need-share-button_qqzone", "selector": ".need-share-button_qqzone",
"text": ["QQ空间,一键转发,耶~"] "text": ["QQ 空间,一键转发,耶~"]
}, { }, {
"selector": ".need-share-button_twitter", "selector": ".need-share-button_twitter",
"text": ["Twitter好像是不存在的东西"] "text": ["Twitter好像是不存在的东西"]
}, { }, {
"selector": ".need-share-button_facebook", "selector": ".need-share-button_facebook",
"text": ["emmm…FB好像也是不存在的东西?"] "text": ["emmm…FB 好像也是不存在的东西?"]
}, { }, {
"selector": ".post-nav-next", "selector": ".post-nav-next",
"text": ["来看看下一篇文章吧。", "点它可以看下一篇文章哦!", "要翻到下一篇文章吗?"] "text": ["来看看下一篇文章吧。", "点它可以看下一篇文章哦!", "要翻到下一篇文章吗?"]
@ -151,7 +151,7 @@
"text": ["想要去评论些什么吗?", "要说点什么吗?", "觉得博客不错?快来留言和主人交流吧!"] "text": ["想要去评论些什么吗?", "要说点什么吗?", "觉得博客不错?快来留言和主人交流吧!"]
}, { }, {
"selector": ".vcontrol a", "selector": ".vcontrol a",
"text": ["你会不会熟练使用Markdown呀", "使用Markdown让评论更美观吧"] "text": ["你会不会熟练使用 Markdown 呀?", "使用 Markdown 让评论更美观吧~"]
}, { }, {
"selector": ".vemoji-btn", "selector": ".vemoji-btn",
"text": ["要插入一个萌萌哒的表情吗?", "要来一发表情吗?"] "text": ["要插入一个萌萌哒的表情吗?", "要来一发表情吗?"]
@ -167,7 +167,7 @@
}], }],
"click": [{ "click": [{
"selector": "#waifu #live2d", "selector": "#waifu #live2d",
"text": ["是…是不小心碰到了吧…", "萝莉控是什么呀?", "你看到我的小熊了吗?", "再摸的话我可要报警了!⌇●﹏●⌇", "110吗,这里有个变态一直在摸我(ó﹏ò。)", "不要摸我了,我会告诉老婆来打你的!", "干嘛动我呀!小心我咬你!", "别摸我,有什么好摸的!"] "text": ["是…是不小心碰到了吧…", "萝莉控是什么呀?", "你看到我的小熊了吗?", "再摸的话我可要报警了!⌇●﹏●⌇", "110 吗,这里有个变态一直在摸我(ó﹏ò。)", "不要摸我了,我会告诉老婆来打你的!", "干嘛动我呀!小心我咬你!", "别摸我,有什么好摸的!"]
}, { }, {
"selector": ".veditor", "selector": ".veditor",
"text": ["要吐槽些什么呢?", "一定要认真填写喵~", "有什么想说的吗?"] "text": ["要吐槽些什么呢?", "一定要认真填写喵~", "有什么想说的吗?"]