看板娘随机换肤

This commit is contained in:
结发受长生 2018-05-25 11:18:37 +08:00
parent bf12f6ea65
commit afe8229f86
33 changed files with 103 additions and 1563 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,11 @@
(function(){
//加载看板娘模型
loadlive2d("live2d", "/resource/model.json");
$.getJSON('/resource/model.json',function(model){
var randomIndex = Math.floor(Math.random() * model.textures.length);
model.textures = [model.textures[randomIndex]]; //随机皮肤
loadlive2d('live2d', '/resource/', '', model);
})
// loadlive2d("live2d", "/resource/model.json");
function render(template, context) {
var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g;
return template.replace(tokenReg, function (word, slash1, token, slash2) {
@ -33,16 +38,64 @@ document.addEventListener('copy', function(){
showMessage('你都复制了些什么呀,转载要记得加上出处哦', 5000);
})
var randomTip = [];
// axios.get('/resource/waifu-tips.json',{responseType:'json'}).then(function(response){
// })
$.ajax({
cache: true,
url: "/resource/waifu-tips.json",
dataType: "json",
success: function (result){
result.mouseover.forEach(function(tips){
$(document).on("mouseover", tips.selector, function (){
var $tips = null;
function showMessage(text, timeout){
timeout = timeout || 5000;
if(Array.isArray(text)) text = text[Math.floor(Math.random() * text.length + 1)-1];
$tips.stop();
$tips.html(text).fadeTo(200, 1);
hideMessage(timeout);
}
function hideMessage(timeout){
timeout = timeout || 5000;
$tips.stop().css('opacity',1);
$tips.delay(timeout).fadeTo(200, 0);
}
$(function(){
var text;
$tips = $('.waifu-tips');
if(document.referrer){
var referrer = document.createElement('a');
referrer.href = document.referrer;
text = 'Hello! 来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友';
var domain = referrer.hostname.split('.')[1];
if (domain == 'baidu') {
text = 'Hello! 来自 百度搜索 的朋友<br>你是搜索 <span style="color:#0099cc;">' + referrer.search.split('&wd=')[1].split('&')[0] + '</span> 找到的我吗?';
}else if (domain == 'so') {
text = 'Hello! 来自 360搜索 的朋友<br>你是搜索 <span style="color:#0099cc;">' + referrer.search.split('&q=')[1].split('&')[0] + '</span> 找到的我吗?';
}else if (domain == 'google') {
text = 'Hello! 来自 谷歌搜索 的朋友<br>欢迎阅读<span style="color:#0099cc;">『' + document.title.split(' - ')[0] + '』</span>';
}
}else {
if (window.location.href == 'https://www.colorfulsweet.site/') { //如果是主页
var now = new Date().getHours();
if (now > 23 || now <= 5) {
text = '你是夜猫子呀?这么晚还不睡觉,明天起的来吗';
} else if (now > 5 && now <= 7) {
text = '早上好!一日之计在于晨,美好的一天就要开始了';
} else if (now > 7 && now <= 11) {
text = '上午好!工作顺利吗,不要久坐,多起来走动走动哦!';
} else if (now > 11 && now <= 14) {
text = '中午了,工作了一个上午,现在是午餐时间!';
} else if (now > 14 && now <= 17) {
text = '午后很容易犯困呢,今天的运动目标完成了吗?';
} else if (now > 17 && now <= 19) {
text = '傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~';
} else if (now > 19 && now <= 21) {
text = '晚上好,今天过得怎么样?';
} else if (now > 21 && now <= 23) {
text = '已经这么晚了呀,早点休息吧,晚安~';
} else {
text = '嗨~ 快来逗我玩吧!';
}
}else {
text = '欢迎阅读<span style="color:#0099cc;">『' + document.title.split('|')[0] + '』</span>';
}
}
showMessage(text, 6000);
$.get("/resource/waifu-tips.json",null,function(result){
result.mouseenter.forEach(function(tips){
$(document).on("mouseenter", tips.selector, function (){
var text = tips.text;
if(Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1)-1];
text = text.render({text: $(this).text()});
@ -57,68 +110,16 @@ $.ajax({
showMessage(text, 3000);
});
});
randomTip = result.random;
},"json")
// 一言
function getHitokoto(){
$.getJSON('https://v1.hitokoto.cn/?encode=json&charset=utf-8&c=b&c=a&c=e',function(result){
showMessage(result.hitokoto, 5000);
setTimeout(getHitokoto, 20000);
});
}
});
var text;
if(document.referrer !== ''){
var referrer = document.createElement('a');
referrer.href = document.referrer;
text = 'Hello! 来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友';
var domain = referrer.hostname.split('.')[1];
if (domain == 'baidu') {
text = 'Hello! 来自 百度搜索 的朋友<br>你是搜索 <span style="color:#0099cc;">' + referrer.search.split('&wd=')[1].split('&')[0] + '</span> 找到的我吗?';
}else if (domain == 'so') {
text = 'Hello! 来自 360搜索 的朋友<br>你是搜索 <span style="color:#0099cc;">' + referrer.search.split('&q=')[1].split('&')[0] + '</span> 找到的我吗?';
}else if (domain == 'google') {
text = 'Hello! 来自 谷歌搜索 的朋友<br>欢迎阅读<span style="color:#0099cc;">『' + document.title.split(' - ')[0] + '』</span>';
}
}else {
if (window.location.href == 'https://www.colorfulsweet.site/') { //如果是主页
var now = new Date().getHours();
if (now > 23 || now <= 5) {
text = '你是夜猫子呀?这么晚还不睡觉,明天起的来嘛';
} else if (now > 5 && now <= 7) {
text = '早上好!一日之计在于晨,美好的一天就要开始了';
} else if (now > 7 && now <= 11) {
text = '上午好!工作顺利嘛,不要久坐,多起来走动走动哦!';
} else if (now > 11 && now <= 14) {
text = '中午了,工作了一个上午,现在是午餐时间!';
} else if (now > 14 && now <= 17) {
text = '午后很容易犯困呢,今天的运动目标完成了吗?';
} else if (now > 17 && now <= 19) {
text = '傍晚了!窗外夕阳的景色很美丽呢,最美不过夕阳红~';
} else if (now > 19 && now <= 21) {
text = '晚上好,今天过得怎么样?';
} else if (now > 21 && now <= 23) {
text = '已经这么晚了呀,早点休息吧,晚安~';
} else {
text = '嗨~ 快来逗我玩吧!';
}
}else {
text = '欢迎阅读<span style="color:#0099cc;">『' + document.title.split('|')[0] + '』</span>';
}
}
showMessage(text, 6000);
window.setInterval(function(){
if(randomTip.length !== 0) {
showMessage(randomTip, 5000);
}
},20000);
function showMessage(text, timeout){
timeout = timeout || 5000;
if(Array.isArray(text)) text = text[Math.floor(Math.random() * text.length + 1)-1];
$('.waifu-tips').stop();
$('.waifu-tips').html(text).fadeTo(200, 1);
hideMessage(timeout);
}
function hideMessage(timeout){
timeout = timeout || 5000;
$('.waifu-tips').stop().css('opacity',1);
$('.waifu-tips').delay(timeout).fadeTo(200, 0);
}
})();

View File

@ -2,8 +2,35 @@
"version":"1.0.0",
"model":"model/model.moc",
"textures":[
"model/Nightsky_Costume.png",
"model/Sailor_Costume_Black.png"
"/resource/model/skin/Nightsky_Costume.png",
"/resource/model/skin/Sailor_Costume_Black.png",
"/resource/model/skin/Bunny_Girl_Costume_Red.png",
"/resource/model/skin/Cake_Costume_Cream.png",
"/resource/model/skin/default-costume.png",
"/resource/model/skin/Dress_Costume_Brown.png",
"/resource/model/skin/Elementary_School_Costume.png",
"/resource/model/skin/Elementary_School_Costume_Navy.png",
"/resource/model/skin/Frill_Bikini_Costume_Green.png",
"/resource/model/skin/Furisode_Costume.png",
"/resource/model/skin/Halloween_Costume.png",
"/resource/model/skin/Kids_Costume.png",
"/resource/model/skin/Kids_Costume_Navy.png",
"/resource/model/skin/Maid_Costume_Red.png",
"/resource/model/skin/New2015_Costume.png",
"/resource/model/skin/Qipao_Costume_Pink.png",
"/resource/model/skin/Qipao_Costume_Red.png",
"/resource/model/skin/Sakura_Costume.png",
"/resource/model/skin/Sakura_Costume_Navy.png",
"/resource/model/skin/Santa_Costume_Green.png",
"/resource/model/skin/Star_Witch_Costume.png",
"/resource/model/skin/Succubus_Costume_Black.png",
"/resource/model/skin/Succubus_Costume_Red.png",
"/resource/model/skin/Sukumizu_Costume_White.png",
"/resource/model/skin/Summer_Dress_Costume_Blue.png",
"/resource/model/skin/Turtleneck_Costume.png",
"/resource/model/skin/Turtleneck_Costume_Red.png",
"/resource/model/skin/Witch_Costume.png",
"/resource/model/skin/Witch_Costume_White.png"
],
"layout":{
"center_x":0.0,

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 546 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 519 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 454 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 481 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 KiB

View File

Before

Width:  |  Height:  |  Size: 503 KiB

After

Width:  |  Height:  |  Size: 503 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 516 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 536 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 538 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 418 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 442 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 465 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 529 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 518 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 KiB

File diff suppressed because it is too large Load Diff