JS模块化改造&看板娘正式全站应用
This commit is contained in:
parent
9230ec5aac
commit
d101a69a3b
@ -3,4 +3,5 @@ title: 实验室
|
||||
date: 2018-5-24 10:05:28
|
||||
pageid: lab
|
||||
---
|
||||
这里是内容
|
||||
这里是内容
|
||||
[测试超链接](https://www.baidu.com)
|
||||
|
||||
@ -147,4 +147,4 @@ highlight_theme: night
|
||||
# - img 图片资源下的 thumbnail 目录
|
||||
# - css 样式资源下的 fonts 目录
|
||||
#----------------------------
|
||||
CDN: https://blog-cdn.nos-eastchina1.126.net/
|
||||
# CDN: https://blog-cdn.nos-eastchina1.126.net/
|
||||
|
||||
@ -1,89 +1,7 @@
|
||||
<%- page.content %>
|
||||
<style>
|
||||
.waifu {position: fixed;bottom: 0;left: 0;z-index: 1;font-size: 0;transition: all .3s ease-in-out;-webkit-transform: translateY(3px);transform: translateY(3px);}
|
||||
.waifu:hover {-webkit-transform: translateY(0);transform: translateY(0);}
|
||||
@media (max-width: 768px) {.waifu { display: none;}}
|
||||
.waifu-tips {
|
||||
opacity: 0;
|
||||
width: 250px;
|
||||
height: 70px;
|
||||
margin: -20px 20px;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid rgba(224, 186, 140, 0.62);
|
||||
border-radius: 12px;
|
||||
background-color: rgba(236, 217, 188, 0.5);
|
||||
box-shadow: 0 3px 15px 2px rgba(191, 158, 118, 0.2);
|
||||
font-size: 14px;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
position: absolute;
|
||||
animation-delay: 5s;
|
||||
animation-duration: 50s;
|
||||
animation-iteration-count: infinite;
|
||||
animation-name: shake;
|
||||
animation-timing-function: ease-in-out;
|
||||
}
|
||||
.waifu #live2d{ position: relative;}
|
||||
|
||||
@keyframes shake {
|
||||
2% { transform: translate(0.5px, -1.5px) rotate(-0.5deg);}
|
||||
4% { transform: translate(0.5px, 1.5px) rotate(1.5deg);}
|
||||
6% {transform: translate(1.5px, 1.5px) rotate(1.5deg);}
|
||||
8% { transform: translate(2.5px, 1.5px) rotate(0.5deg);}
|
||||
10% { transform: translate(0.5px, 2.5px) rotate(0.5deg);}
|
||||
12% { transform: translate(1.5px, 1.5px) rotate(0.5deg);}
|
||||
14% { transform: translate(0.5px, 0.5px) rotate(0.5deg);}
|
||||
16% { transform: translate(-1.5px, -0.5px) rotate(1.5deg);}
|
||||
18% { transform: translate(0.5px, 0.5px) rotate(1.5deg);}
|
||||
20% { transform: translate(2.5px, 2.5px) rotate(1.5deg);}
|
||||
22% { transform: translate(0.5px, -1.5px) rotate(1.5deg);}
|
||||
24% { transform: translate(-1.5px, 1.5px) rotate(-0.5deg);}
|
||||
26% { transform: translate(1.5px, 0.5px) rotate(1.5deg);}
|
||||
28% { transform: translate(-0.5px, -0.5px) rotate(-0.5deg);}
|
||||
30% { transform: translate(1.5px, -0.5px) rotate(-0.5deg);}
|
||||
32% { transform: translate(2.5px, -1.5px) rotate(1.5deg);}
|
||||
34% { transform: translate(2.5px, 2.5px) rotate(-0.5deg);}
|
||||
36% { transform: translate(0.5px, -1.5px) rotate(0.5deg);}
|
||||
38% { transform: translate(2.5px, -0.5px) rotate(-0.5deg);}
|
||||
40% { transform: translate(-0.5px, 2.5px) rotate(0.5deg);}
|
||||
42% { transform: translate(-1.5px, 2.5px) rotate(0.5deg);}
|
||||
44% { transform: translate(-1.5px, 1.5px) rotate(0.5deg);}
|
||||
46% { transform: translate(1.5px, -0.5px) rotate(-0.5deg);}
|
||||
48% { transform: translate(2.5px, -0.5px) rotate(0.5deg);}
|
||||
50% { transform: translate(-1.5px, 1.5px) rotate(0.5deg);}
|
||||
52% { transform: translate(-0.5px, 1.5px) rotate(0.5deg);}
|
||||
54% { transform: translate(-1.5px, 1.5px) rotate(0.5deg);}
|
||||
56% { transform: translate(0.5px, 2.5px) rotate(1.5deg);}
|
||||
58% { transform: translate(2.5px, 2.5px) rotate(0.5deg);}
|
||||
60% { transform: translate(2.5px, -1.5px) rotate(1.5deg);}
|
||||
62% { transform: translate(-1.5px, 0.5px) rotate(1.5deg);}
|
||||
64% { transform: translate(-1.5px, 1.5px) rotate(1.5deg);}
|
||||
66% { transform: translate(0.5px, 2.5px) rotate(1.5deg);}
|
||||
68% { transform: translate(2.5px, -1.5px) rotate(1.5deg);}
|
||||
70% { transform: translate(2.5px, 2.5px) rotate(0.5deg);}
|
||||
72% { transform: translate(-0.5px, -1.5px) rotate(1.5deg);}
|
||||
74% { transform: translate(-1.5px, 2.5px) rotate(1.5deg);}
|
||||
76% { transform: translate(-1.5px, 2.5px) rotate(1.5deg);}
|
||||
78% { transform: translate(-1.5px, 2.5px) rotate(0.5deg);}
|
||||
80% { transform: translate(-1.5px, 0.5px) rotate(-0.5deg);}
|
||||
82% { transform: translate(-1.5px, 0.5px) rotate(-0.5deg);}
|
||||
84% { transform: translate(-0.5px, 0.5px) rotate(1.5deg);}
|
||||
86% { transform: translate(2.5px, 1.5px) rotate(0.5deg);}
|
||||
88% { transform: translate(-1.5px, 0.5px) rotate(1.5deg);}
|
||||
90% { transform: translate(-1.5px, -0.5px) rotate(-0.5deg);}
|
||||
92% { transform: translate(-1.5px, -1.5px) rotate(1.5deg);}
|
||||
94% { transform: translate(0.5px, 0.5px) rotate(-0.5deg);}
|
||||
96% { transform: translate(2.5px, -0.5px) rotate(-0.5deg);}
|
||||
98% { transform: translate(-1.5px, -1.5px) rotate(-0.5deg);}
|
||||
0%, 100% { transform: translate(0, 0) rotate(0);}
|
||||
}
|
||||
|
||||
</style>
|
||||
<div class="waifu">
|
||||
<div class="waifu-tips"></div>
|
||||
<canvas id="live2d" width="280" height="250" class="live2d"></canvas>
|
||||
</div>
|
||||
|
||||
<%- js('js/lib/jquery-3.3.1.min') %>
|
||||
<%- js('js/lib/live2d') %>
|
||||
<%- js('js/tips') %>
|
||||
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
<%- js('js/main') %>
|
||||
<%- js('js/lib/polyfill.min') %>
|
||||
<%- js('js/lib/vue.min') %>
|
||||
<%- js('js/lib/axios.min') %>
|
||||
<%- js('js/local-search') %>
|
||||
@ -5,7 +5,9 @@
|
||||
<% } else { %>
|
||||
2016-<%- new Date().getFullYear() %>
|
||||
<% } %>
|
||||
|
||||
<a href="<%- url_for() %>">Power By Hexo</a>
|
||||
</footer>
|
||||
<div class="back-to-top" id="JELON__backToTop" title="返回顶部">返回顶部</div>
|
||||
|
||||
<script src="<%=config.root %>js/lib/require.min.js" defer async="true"
|
||||
data-main="<%=config.root %>js/main.js"></script>
|
||||
|
||||
@ -1,29 +1,29 @@
|
||||
<%- partial('_partial/head') %>
|
||||
<body class="home">
|
||||
<!--[if lt IE 9]>
|
||||
<div class="browsehappy">
|
||||
当前网页 <strong>不支持</strong>
|
||||
你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>.
|
||||
</div>
|
||||
<![endif]-->
|
||||
<!--[if lt IE 9]>
|
||||
<div class="browsehappy">
|
||||
当前网页 <strong>不支持</strong>
|
||||
你正在使用的浏览器. 为了正常的访问, 请 <a href="http://browsehappy.com/">升级你的浏览器</a>.
|
||||
</div>
|
||||
<![endif]-->
|
||||
|
||||
<!-- 博客头部 -->
|
||||
<%- partial('_partial/header') %>
|
||||
|
||||
<!-- 博客正文 -->
|
||||
<div class="container body clearfix">
|
||||
<section class="content">
|
||||
<div class="content-main widget">
|
||||
<%- body %>
|
||||
</div>
|
||||
|
||||
</section>
|
||||
<%- partial('_partial/sidebar') %>
|
||||
</div>
|
||||
|
||||
<!-- 博客底部 -->
|
||||
<%- partial('_partial/footer') %>
|
||||
<!--博客js脚本 -->
|
||||
<%- partial('_partial/after-footer') %>
|
||||
<!-- 博客头部 -->
|
||||
<%- partial('_partial/header') %>
|
||||
<!-- 看板娘 -->
|
||||
<div class="waifu">
|
||||
<div class="waifu-tips"></div>
|
||||
<canvas id="live2d" width="280" height="250" class="live2d"></canvas>
|
||||
</div>
|
||||
<!-- 博客正文 -->
|
||||
<div class="container body clearfix">
|
||||
<section class="content">
|
||||
<div class="content-main widget">
|
||||
<%- body %>
|
||||
</div>
|
||||
</section>
|
||||
<%- partial('_partial/sidebar') %>
|
||||
</div>
|
||||
<!-- 博客底部 -->
|
||||
<%- partial('_partial/footer') %>
|
||||
</body>
|
||||
</html>
|
||||
92
themes/hexo-theme-xups/source/css/_partial/banner.styl
Normal file
92
themes/hexo-theme-xups/source/css/_partial/banner.styl
Normal file
@ -0,0 +1,92 @@
|
||||
.waifu
|
||||
position: fixed
|
||||
bottom: 0
|
||||
left: 0
|
||||
z-index: 1
|
||||
font-size: 0
|
||||
transition: all .3s ease-in-out
|
||||
-webkit-transform: translateY(3px)
|
||||
transform: translateY(3px)
|
||||
|
||||
.waifu:hover
|
||||
-webkit-transform: translateY(0)
|
||||
transform: translateY(0)
|
||||
|
||||
@media (max-width: 768px)
|
||||
.waifu
|
||||
display: none
|
||||
.waifu-tips
|
||||
opacity: 0
|
||||
width: 250px
|
||||
height: 70px
|
||||
margin: -20px 20px
|
||||
padding: 5px 10px
|
||||
border: 1px solid rgba(224, 186, 140, 0.62)
|
||||
border-radius: 12px
|
||||
background-color: rgba(236, 217, 188, 0.5)
|
||||
box-shadow: 0 3px 15px 2px rgba(191, 158, 118, 0.2)
|
||||
font-size: 14px
|
||||
text-overflow: ellipsis
|
||||
overflow: hidden
|
||||
position: absolute
|
||||
transition : opacity 0.3s ease-in;
|
||||
animation-delay: 5s
|
||||
animation-duration: 50s
|
||||
animation-iteration-count: infinite
|
||||
animation-name: shake
|
||||
animation-timing-function: ease-in-out
|
||||
|
||||
.waifu #live2d
|
||||
position: relative
|
||||
|
||||
@keyframes shake
|
||||
2% {transform: translate(0.5px, -1.5px) rotate(-0.5deg) }
|
||||
4% {transform: translate(0.5px, 1.5px) rotate(1.5deg) }
|
||||
6% {transform: translate(1.5px, 1.5px) rotate(1.5deg) }
|
||||
8% {transform: translate(2.5px, 1.5px) rotate(0.5deg) }
|
||||
10% {transform: translate(0.5px, 2.5px) rotate(0.5deg) }
|
||||
12% {transform: translate(1.5px, 1.5px) rotate(0.5deg) }
|
||||
14% {transform: translate(0.5px, 0.5px) rotate(0.5deg) }
|
||||
16% {transform: translate(-1.5px, -0.5px) rotate(1.5deg) }
|
||||
18% {transform: translate(0.5px, 0.5px) rotate(1.5deg) }
|
||||
20% {transform: translate(2.5px, 2.5px) rotate(1.5deg) }
|
||||
22% {transform: translate(0.5px, -1.5px) rotate(1.5deg) }
|
||||
24% {transform: translate(-1.5px, 1.5px) rotate(-0.5deg) }
|
||||
26% {transform: translate(1.5px, 0.5px) rotate(1.5deg) }
|
||||
28% {transform: translate(-0.5px, -0.5px) rotate(-0.5deg) }
|
||||
30% {transform: translate(1.5px, -0.5px) rotate(-0.5deg) }
|
||||
32% {transform: translate(2.5px, -1.5px) rotate(1.5deg) }
|
||||
34% {transform: translate(2.5px, 2.5px) rotate(-0.5deg) }
|
||||
36% {transform: translate(0.5px, -1.5px) rotate(0.5deg) }
|
||||
38% {transform: translate(2.5px, -0.5px) rotate(-0.5deg) }
|
||||
40% {transform: translate(-0.5px, 2.5px) rotate(0.5deg) }
|
||||
42% {transform: translate(-1.5px, 2.5px) rotate(0.5deg) }
|
||||
44% {transform: translate(-1.5px, 1.5px) rotate(0.5deg) }
|
||||
46% {transform: translate(1.5px, -0.5px) rotate(-0.5deg) }
|
||||
48% {transform: translate(2.5px, -0.5px) rotate(0.5deg) }
|
||||
50% {transform: translate(-1.5px, 1.5px) rotate(0.5deg) }
|
||||
52% {transform: translate(-0.5px, 1.5px) rotate(0.5deg) }
|
||||
54% {transform: translate(-1.5px, 1.5px) rotate(0.5deg) }
|
||||
56% {transform: translate(0.5px, 2.5px) rotate(1.5deg) }
|
||||
58% {transform: translate(2.5px, 2.5px) rotate(0.5deg) }
|
||||
60% {transform: translate(2.5px, -1.5px) rotate(1.5deg) }
|
||||
62% {transform: translate(-1.5px, 0.5px) rotate(1.5deg) }
|
||||
64% {transform: translate(-1.5px, 1.5px) rotate(1.5deg) }
|
||||
66% {transform: translate(0.5px, 2.5px) rotate(1.5deg) }
|
||||
68% {transform: translate(2.5px, -1.5px) rotate(1.5deg) }
|
||||
70% {transform: translate(2.5px, 2.5px) rotate(0.5deg) }
|
||||
72% {transform: translate(-0.5px, -1.5px) rotate(1.5deg) }
|
||||
74% {transform: translate(-1.5px, 2.5px) rotate(1.5deg) }
|
||||
76% {transform: translate(-1.5px, 2.5px) rotate(1.5deg) }
|
||||
78% {transform: translate(-1.5px, 2.5px) rotate(0.5deg) }
|
||||
80% {transform: translate(-1.5px, 0.5px) rotate(-0.5deg) }
|
||||
82% {transform: translate(-1.5px, 0.5px) rotate(-0.5deg) }
|
||||
84% {transform: translate(-0.5px, 0.5px) rotate(1.5deg) }
|
||||
86% {transform: translate(2.5px, 1.5px) rotate(0.5deg) }
|
||||
88% {transform: translate(-1.5px, 0.5px) rotate(1.5deg) }
|
||||
90% {transform: translate(-1.5px, -0.5px) rotate(-0.5deg) }
|
||||
92% {transform: translate(-1.5px, -1.5px) rotate(1.5deg) }
|
||||
94% {transform: translate(0.5px, 0.5px) rotate(-0.5deg) }
|
||||
96% {transform: translate(2.5px, -0.5px) rotate(-0.5deg) }
|
||||
98% {transform: translate(-1.5px, -1.5px) rotate(-0.5deg) }
|
||||
0%, 100% {transform: translate(0, 0) rotate(0) }
|
||||
@ -52,3 +52,7 @@ if $comment_config
|
||||
// 响应式样式
|
||||
//-----------------------------------------------
|
||||
@import "_partial/responsive"
|
||||
|
||||
// 看板娘样式
|
||||
//-----------------------------------------------
|
||||
@import "_partial/banner"
|
||||
151
themes/hexo-theme-xups/source/js/banner-girl.js
Normal file
151
themes/hexo-theme-xups/source/js/banner-girl.js
Normal file
@ -0,0 +1,151 @@
|
||||
define(['loadlive2d', 'axios'], function(loadlive2d, axios) {
|
||||
function render(template, context) {
|
||||
var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g;
|
||||
return template.replace(tokenReg, function (word, slash1, token, slash2) {
|
||||
if (slash1 || slash2) {
|
||||
return word.replace('\\', '');
|
||||
}
|
||||
var variables = token.replace(/\s/g, '').split('.');
|
||||
var currentObject = context;
|
||||
var i, length, variable;
|
||||
for (i = 0, length = variables.length; i < length; ++i) {
|
||||
variable = variables[i];
|
||||
currentObject = currentObject[variable];
|
||||
if (!currentObject) return '';
|
||||
}
|
||||
return currentObject;
|
||||
});
|
||||
}
|
||||
String.prototype.render = function (context) {
|
||||
return render(this, context);
|
||||
};
|
||||
|
||||
var re = /x/;
|
||||
console.log(re);
|
||||
re.toString = function() {
|
||||
showMessage('哈哈,你打开了控制台,是想要看看我的秘密吗?', 5000);
|
||||
return '';
|
||||
};
|
||||
|
||||
document.addEventListener('copy', function(){
|
||||
showMessage('你都复制了些什么呀,转载要记得加上出处哦', 5000);
|
||||
})
|
||||
|
||||
var tips = document.querySelector('.waifu-tips');
|
||||
function showMessage(text, timeout){
|
||||
if(Array.isArray(text)) text = text[Math.floor(Math.random() * text.length + 1)-1];
|
||||
// $tips.stop();
|
||||
// $tips.html(text).fadeTo(200, 1);
|
||||
//TODO 使用原生动画库
|
||||
tips.innerHTML = text;
|
||||
tips.style.opacity = 1;
|
||||
hideMessage(timeout);
|
||||
}
|
||||
function hideMessage(timeout){
|
||||
timeout = timeout || 5000;
|
||||
// $tips.stop().css('opacity',1);
|
||||
// $tips.delay(timeout).fadeTo(200, 0);
|
||||
setTimeout(function(){
|
||||
tips.style.opacity = 0;
|
||||
}, timeout);
|
||||
}
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面中元素触发的看板娘消息
|
||||
*/
|
||||
function createTrigger(tips) {
|
||||
return 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.textContent});
|
||||
showMessage(text, 3000);
|
||||
}
|
||||
}
|
||||
function bindElementEvent(url) {
|
||||
axios.get(url).then(function(res){
|
||||
res.data.mouseenter.forEach(function(tips){
|
||||
var mouseenterTrigger = createTrigger(tips);
|
||||
document.querySelectorAll(tips.selector).forEach(function(item){
|
||||
item.addEventListener("mouseenter", mouseenterTrigger);
|
||||
})
|
||||
});
|
||||
res.data.click.forEach(function(tips){
|
||||
var clickTrigger = createTrigger(tips);
|
||||
document.querySelectorAll(tips.selector).forEach(function(item){
|
||||
item.addEventListener("click", clickTrigger);
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 一言
|
||||
function getHitokoto(){
|
||||
axios.get('https://v1.hitokoto.cn/?encode=json&charset=utf-8&c=b&c=a&c=e').then(function(res){
|
||||
showMessage(res.data.hitokoto, 5000);
|
||||
setTimeout(getHitokoto, 20000);
|
||||
}).catch(function(){
|
||||
setTimeout(getHitokoto, 30000);
|
||||
})
|
||||
}
|
||||
|
||||
return function(){
|
||||
//加载看板娘模型
|
||||
axios.get('/resource/model.json').then(function(res){
|
||||
var randomIndex = Math.floor(Math.random() * res.data.textures.length);
|
||||
//随机皮肤
|
||||
if(window.location.href.startsWith('http://localhost') || ("ActiveXObject" in window)) {
|
||||
//本地开发调试或者是IE浏览器
|
||||
res.data.textures = ['/resource/model/skin/'+res.data.textures[randomIndex]];
|
||||
} else {
|
||||
//服务器部署运行(使用网易蜂巢对象存储)
|
||||
res.data.textures = ['https://blog-cdn.nos-eastchina1.126.net/live2D/'+res.data.textures[randomIndex]];
|
||||
}
|
||||
loadlive2d('live2d', '/resource/', '', res.data);
|
||||
// loadlive2d("live2d", "/resource/model.json");
|
||||
});
|
||||
// 定时显示"一言"
|
||||
setTimeout(getHitokoto, 10000);
|
||||
// 按照json当中的配置给页面元素绑定事件
|
||||
bindElementEvent("/resource/waifu-tips.json");
|
||||
showMessage(text, 6000);
|
||||
}
|
||||
});
|
||||
135
themes/hexo-theme-xups/source/js/lib/echo.js
Normal file
135
themes/hexo-theme-xups/source/js/lib/echo.js
Normal file
@ -0,0 +1,135 @@
|
||||
/*! echo-js v1.7.3 | (c) 2016 @toddmotto | https://github.com/toddmotto/echo */
|
||||
(function (root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function() {
|
||||
return factory(root);
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
root.echo = factory(root);
|
||||
}
|
||||
})(this, function (root) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var echo = {};
|
||||
|
||||
var callback = function () {};
|
||||
|
||||
var offset, poll, delay, useDebounce, unload;
|
||||
|
||||
var isHidden = function (element) {
|
||||
return (element.offsetParent === null);
|
||||
};
|
||||
|
||||
var inView = function (element, view) {
|
||||
if (isHidden(element)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var box = element.getBoundingClientRect();
|
||||
return (box.right >= view.l && box.bottom >= view.t && box.left <= view.r && box.top <= view.b);
|
||||
};
|
||||
|
||||
var debounceOrThrottle = function () {
|
||||
if(!useDebounce && !!poll) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(poll);
|
||||
poll = setTimeout(function(){
|
||||
echo.render();
|
||||
poll = null;
|
||||
}, delay);
|
||||
};
|
||||
|
||||
echo.init = function (opts) {
|
||||
opts = opts || {};
|
||||
var offsetAll = opts.offset || 0;
|
||||
var offsetVertical = opts.offsetVertical || offsetAll;
|
||||
var offsetHorizontal = opts.offsetHorizontal || offsetAll;
|
||||
var optionToInt = function (opt, fallback) {
|
||||
return parseInt(opt || fallback, 10);
|
||||
};
|
||||
offset = {
|
||||
t: optionToInt(opts.offsetTop, offsetVertical),
|
||||
b: optionToInt(opts.offsetBottom, offsetVertical),
|
||||
l: optionToInt(opts.offsetLeft, offsetHorizontal),
|
||||
r: optionToInt(opts.offsetRight, offsetHorizontal)
|
||||
};
|
||||
delay = optionToInt(opts.throttle, 250);
|
||||
useDebounce = opts.debounce !== false;
|
||||
unload = !!opts.unload;
|
||||
callback = opts.callback || callback;
|
||||
echo.render();
|
||||
if (document.addEventListener) {
|
||||
root.addEventListener('scroll', debounceOrThrottle, false);
|
||||
root.addEventListener('load', debounceOrThrottle, false);
|
||||
} else {
|
||||
root.attachEvent('onscroll', debounceOrThrottle);
|
||||
root.attachEvent('onload', debounceOrThrottle);
|
||||
}
|
||||
};
|
||||
|
||||
echo.render = function () {
|
||||
var nodes = document.querySelectorAll('img[data-echo], [data-echo-background]');
|
||||
var length = nodes.length;
|
||||
var src, elem;
|
||||
var view = {
|
||||
l: 0 - offset.l,
|
||||
t: 0 - offset.t,
|
||||
b: (root.innerHeight || document.documentElement.clientHeight) + offset.b,
|
||||
r: (root.innerWidth || document.documentElement.clientWidth) + offset.r
|
||||
};
|
||||
for (var i = 0; i < length; i++) {
|
||||
elem = nodes[i];
|
||||
if (inView(elem, view)) {
|
||||
|
||||
if (unload) {
|
||||
elem.setAttribute('data-echo-placeholder', elem.src);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('data-echo-background') !== null) {
|
||||
elem.style.backgroundImage = "url(" + elem.getAttribute('data-echo-background') + ")";
|
||||
}
|
||||
else {
|
||||
elem.src = elem.getAttribute('data-echo');
|
||||
}
|
||||
|
||||
if (!unload) {
|
||||
elem.removeAttribute('data-echo');
|
||||
elem.removeAttribute('data-echo-background');
|
||||
}
|
||||
|
||||
callback(elem, 'load');
|
||||
}
|
||||
else if (unload && !!(src = elem.getAttribute('data-echo-placeholder'))) {
|
||||
|
||||
if (elem.getAttribute('data-echo-background') !== null) {
|
||||
elem.style.backgroundImage = "url(" + src + ")";
|
||||
}
|
||||
else {
|
||||
elem.src = src;
|
||||
}
|
||||
|
||||
elem.removeAttribute('data-echo-placeholder');
|
||||
callback(elem, 'unload');
|
||||
}
|
||||
}
|
||||
if (!length) {
|
||||
echo.detach();
|
||||
}
|
||||
};
|
||||
|
||||
echo.detach = function () {
|
||||
if (document.removeEventListener) {
|
||||
root.removeEventListener('scroll', debounceOrThrottle);
|
||||
} else {
|
||||
root.detachEvent('onscroll', debounceOrThrottle);
|
||||
}
|
||||
clearTimeout(poll);
|
||||
};
|
||||
|
||||
return echo;
|
||||
|
||||
});
|
||||
2
themes/hexo-theme-xups/source/js/lib/echo.min.js
vendored
Normal file
2
themes/hexo-theme-xups/source/js/lib/echo.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/*! echo-js v1.7.3 | (c) 2016 @toddmotto | https://github.com/toddmotto/echo */
|
||||
!function(t,e){"function"==typeof define&&define.amd?define(function(){return e(t)}):"object"==typeof exports?module.exports=e:t.echo=e(t)}(this,function(t){"use strict";var e,n,o,r,c,a={},u=function(){},d=function(t){return null===t.offsetParent},i=function(t,e){if(d(t))return!1;var n=t.getBoundingClientRect();return n.right>=e.l&&n.bottom>=e.t&&n.left<=e.r&&n.top<=e.b},l=function(){(r||!n)&&(clearTimeout(n),n=setTimeout(function(){a.render(),n=null},o))};return a.init=function(n){n=n||{};var d=n.offset||0,i=n.offsetVertical||d,f=n.offsetHorizontal||d,s=function(t,e){return parseInt(t||e,10)};e={t:s(n.offsetTop,i),b:s(n.offsetBottom,i),l:s(n.offsetLeft,f),r:s(n.offsetRight,f)},o=s(n.throttle,250),r=n.debounce!==!1,c=!!n.unload,u=n.callback||u,a.render(),document.addEventListener?(t.addEventListener("scroll",l,!1),t.addEventListener("load",l,!1)):(t.attachEvent("onscroll",l),t.attachEvent("onload",l))},a.render=function(){for(var n,o,r=document.querySelectorAll("img[data-echo], [data-echo-background]"),d=r.length,l={l:0-e.l,t:0-e.t,b:(t.innerHeight||document.documentElement.clientHeight)+e.b,r:(t.innerWidth||document.documentElement.clientWidth)+e.r},f=0;d>f;f++)o=r[f],i(o,l)?(c&&o.setAttribute("data-echo-placeholder",o.src),null!==o.getAttribute("data-echo-background")?o.style.backgroundImage="url("+o.getAttribute("data-echo-background")+")":o.src=o.getAttribute("data-echo"),c||(o.removeAttribute("data-echo"),o.removeAttribute("data-echo-background")),u(o,"load")):c&&(n=o.getAttribute("data-echo-placeholder"))&&(null!==o.getAttribute("data-echo-background")?o.style.backgroundImage="url("+n+")":o.src=n,o.removeAttribute("data-echo-placeholder"),u(o,"unload"));d||a.detach()},a.detach=function(){document.removeEventListener?t.removeEventListener("scroll",l):t.detachEvent("onscroll",l),clearTimeout(n)},a});
|
||||
10364
themes/hexo-theme-xups/source/js/lib/jquery-3.3.1.js
vendored
10364
themes/hexo-theme-xups/source/js/lib/jquery-3.3.1.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
2145
themes/hexo-theme-xups/source/js/lib/require.js
Normal file
2145
themes/hexo-theme-xups/source/js/lib/require.js
Normal file
File diff suppressed because it is too large
Load Diff
5
themes/hexo-theme-xups/source/js/lib/require.min.js
vendored
Normal file
5
themes/hexo-theme-xups/source/js/lib/require.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
(function(){
|
||||
define(['axios', 'vue'],function(axios, Vue){
|
||||
var articleDatas = null,
|
||||
resultDiv = null,
|
||||
initCallback = function(){};
|
||||
resultDiv = null,
|
||||
initCallback = function(){};
|
||||
function executeSearch(keywords) {
|
||||
var _this = this;
|
||||
articleDatas.forEach(function(article){
|
||||
@ -115,4 +115,4 @@ new Vue({
|
||||
}
|
||||
}
|
||||
})
|
||||
})()
|
||||
})
|
||||
|
||||
@ -1,210 +1,96 @@
|
||||
/*! echo-js v1.7.3 | (c) 2016 @toddmotto | https://github.com/toddmotto/echo */
|
||||
(function(root, factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(function() {
|
||||
return factory(root);
|
||||
});
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory;
|
||||
} else {
|
||||
root.echo = factory(root);
|
||||
}
|
||||
})(this, function(root) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var echo = {};
|
||||
|
||||
var callback = function() {};
|
||||
|
||||
var offset, poll, delay, useDebounce, unload;
|
||||
|
||||
var isHidden = function(element) {
|
||||
return (element.offsetParent === null);
|
||||
};
|
||||
|
||||
var inView = function(element, view) {
|
||||
if (isHidden(element)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var box = element.getBoundingClientRect();
|
||||
return (box.right >= view.l && box.bottom >= view.t && box.left <= view.r && box.top <= view.b);
|
||||
};
|
||||
|
||||
var debounceOrThrottle = function() {
|
||||
if (!useDebounce && !!poll) {
|
||||
return;
|
||||
}
|
||||
clearTimeout(poll);
|
||||
poll = setTimeout(function() {
|
||||
echo.render();
|
||||
poll = null;
|
||||
}, delay);
|
||||
};
|
||||
|
||||
echo.init = function(opts) {
|
||||
opts = opts || {};
|
||||
var offsetAll = opts.offset || 0;
|
||||
var offsetVertical = opts.offsetVertical || offsetAll;
|
||||
var offsetHorizontal = opts.offsetHorizontal || offsetAll;
|
||||
var optionToInt = function(opt, fallback) {
|
||||
return parseInt(opt || fallback, 10);
|
||||
};
|
||||
offset = {
|
||||
t: optionToInt(opts.offsetTop, offsetVertical),
|
||||
b: optionToInt(opts.offsetBottom, offsetVertical),
|
||||
l: optionToInt(opts.offsetLeft, offsetHorizontal),
|
||||
r: optionToInt(opts.offsetRight, offsetHorizontal)
|
||||
};
|
||||
delay = optionToInt(opts.throttle, 250);
|
||||
useDebounce = opts.debounce !== false;
|
||||
unload = !!opts.unload;
|
||||
callback = opts.callback || callback;
|
||||
echo.render();
|
||||
if (document.addEventListener) {
|
||||
root.addEventListener('scroll', debounceOrThrottle, false);
|
||||
root.addEventListener('load', debounceOrThrottle, false);
|
||||
} else {
|
||||
root.attachEvent('onscroll', debounceOrThrottle);
|
||||
root.attachEvent('onload', debounceOrThrottle);
|
||||
}
|
||||
};
|
||||
|
||||
echo.render = function() {
|
||||
var nodes = document.querySelectorAll('img[data-echo], [data-echo-background]');
|
||||
var length = nodes.length;
|
||||
var src, elem;
|
||||
var view = {
|
||||
l: 0 - offset.l,
|
||||
t: 0 - offset.t,
|
||||
b: (root.innerHeight || document.documentElement.clientHeight) + offset.b,
|
||||
r: (root.innerWidth || document.documentElement.clientWidth) + offset.r
|
||||
};
|
||||
for (var i = 0; i < length; i++) {
|
||||
elem = nodes[i];
|
||||
if (inView(elem, view)) {
|
||||
|
||||
if (unload) {
|
||||
elem.setAttribute('data-echo-placeholder', elem.src);
|
||||
}
|
||||
|
||||
if (elem.getAttribute('data-echo-background') !== null) {
|
||||
elem.style.backgroundImage = "url(" + elem.getAttribute('data-echo-background') + ")";
|
||||
} else {
|
||||
elem.src = elem.getAttribute('data-echo');
|
||||
}
|
||||
|
||||
if (!unload) {
|
||||
elem.removeAttribute('data-echo');
|
||||
elem.removeAttribute('data-echo-background');
|
||||
}
|
||||
|
||||
callback(elem, 'load');
|
||||
} else if (unload && !!(src = elem.getAttribute('data-echo-placeholder'))) {
|
||||
|
||||
if (elem.getAttribute('data-echo-background') !== null) {
|
||||
elem.style.backgroundImage = "url(" + src + ")";
|
||||
} else {
|
||||
elem.src = src;
|
||||
}
|
||||
|
||||
elem.removeAttribute('data-echo-placeholder');
|
||||
callback(elem, 'unload');
|
||||
}
|
||||
}
|
||||
if (!length) {
|
||||
echo.detach();
|
||||
}
|
||||
};
|
||||
|
||||
echo.detach = function() {
|
||||
if (document.removeEventListener) {
|
||||
root.removeEventListener('scroll', debounceOrThrottle);
|
||||
} else {
|
||||
root.detachEvent('onscroll', debounceOrThrottle);
|
||||
}
|
||||
clearTimeout(poll);
|
||||
};
|
||||
|
||||
return echo;
|
||||
|
||||
require.config({
|
||||
baseUrl: '/js/',
|
||||
paths: {
|
||||
echo: 'lib/echo.min',
|
||||
loadlive2d: 'lib/live2d',
|
||||
axios: 'lib/axios.min',
|
||||
bannerGirl: 'banner-girl',
|
||||
vue: 'lib/vue.min',
|
||||
polyfill: 'lib/polyfill.min'
|
||||
},
|
||||
shim: {
|
||||
loadlive2d: {
|
||||
exports: 'loadlive2d'
|
||||
}
|
||||
}
|
||||
});
|
||||
function deepCopy(c, p) {
|
||||
var c = c || {};
|
||||
for (var i in p) {
|
||||
if (typeof p[i] === 'object') {
|
||||
c[i] = (p[i].constructor === Array) ? [] : {};
|
||||
deepCopy(p[i], c[i]);
|
||||
} else {
|
||||
c[i] = p[i];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
/**
|
||||
* 网站js
|
||||
* @author Jelon
|
||||
* @type {{init, toggleMenu}}
|
||||
*/
|
||||
var JELON = window.JELON || {};
|
||||
JELON = deepCopy(JELON, {
|
||||
name: 'JELON',
|
||||
version: '0.0.2',
|
||||
init: function() {
|
||||
this.toggleMenu();
|
||||
this.backToTop();
|
||||
|
||||
echo.init({
|
||||
offset: 50,
|
||||
throttle: 250,
|
||||
unload: false,
|
||||
callback: function(element, op) {
|
||||
//console.log(element, 'has been', op + 'ed')
|
||||
}
|
||||
});
|
||||
},
|
||||
$: function(str) {
|
||||
return /^(\[object HTML)[a-zA-Z]*(Element\])$/.test(Object.prototype.toString.call(str)) ? str : document.getElementById(str);
|
||||
},
|
||||
toggleMenu: function() {
|
||||
var _this = this,
|
||||
$menu = _this.$(_this.name + '__menu');
|
||||
_this.$(_this.name + '__btnDropNav').onclick = function() {
|
||||
if ($menu.className.indexOf('hidden') === -1) {
|
||||
$menu.className += ' hidden';
|
||||
} else {
|
||||
$menu.className = $menu.className.replace(/\s*hidden\s*/, '');
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
backToTop: function() {
|
||||
var _this = this;
|
||||
if (typeof _this.$(_this.name + '__backToTop') === 'undefined') return;
|
||||
window.onscroll = window.onresize = function() {
|
||||
if (document.documentElement.scrollTop + document.body.scrollTop > 0) {
|
||||
_this.$(_this.name + '__backToTop').style.display = 'block';
|
||||
} else {
|
||||
_this.$(_this.name + '__backToTop').style.display = 'none';
|
||||
}
|
||||
};
|
||||
_this.$(_this.name + '__backToTop').onclick = function() {
|
||||
var Timer = setInterval(GoTop, 10);
|
||||
|
||||
function GoTop() {
|
||||
if (document.documentElement.scrollTop + document.body.scrollTop < 1) {
|
||||
clearInterval(Timer)
|
||||
} else {
|
||||
document.documentElement.scrollTop /= 1.1;
|
||||
document.body.scrollTop /= 1.1
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
require(['echo', 'bannerGirl'],function(echo, loadBannerGirl){
|
||||
function deepCopy(c, p) {
|
||||
var c = c || {};
|
||||
for (var i in p) {
|
||||
if (typeof p[i] === 'object') {
|
||||
c[i] = (p[i].constructor === Array) ? [] : {};
|
||||
deepCopy(p[i], c[i]);
|
||||
} else {
|
||||
c[i] = p[i];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
(function(){
|
||||
var JELON = window.JELON || {};
|
||||
JELON = deepCopy(JELON, {
|
||||
name: 'JELON',
|
||||
version: '0.0.2',
|
||||
init: function() {
|
||||
this.toggleMenu();
|
||||
this.backToTop();
|
||||
|
||||
echo.init({
|
||||
offset: 50,
|
||||
throttle: 250,
|
||||
unload: false,
|
||||
callback: function(element, op) {
|
||||
//console.log(element, 'has been', op + 'ed')
|
||||
}
|
||||
});
|
||||
},
|
||||
$: function(str) {
|
||||
return /^(\[object HTML)[a-zA-Z]*(Element\])$/.test(Object.prototype.toString.call(str)) ? str : document.getElementById(str);
|
||||
},
|
||||
toggleMenu: function() {
|
||||
var _this = this,
|
||||
$menu = _this.$(_this.name + '__menu');
|
||||
_this.$(_this.name + '__btnDropNav').onclick = function() {
|
||||
if ($menu.className.indexOf('hidden') === -1) {
|
||||
$menu.className += ' hidden';
|
||||
} else {
|
||||
$menu.className = $menu.className.replace(/\s*hidden\s*/, '');
|
||||
}
|
||||
|
||||
};
|
||||
},
|
||||
backToTop: function() {
|
||||
var _this = this;
|
||||
if (typeof _this.$(_this.name + '__backToTop') === 'undefined') return;
|
||||
window.onscroll = window.onresize = function() {
|
||||
if (document.documentElement.scrollTop + document.body.scrollTop > 0) {
|
||||
_this.$(_this.name + '__backToTop').style.display = 'block';
|
||||
} else {
|
||||
_this.$(_this.name + '__backToTop').style.display = 'none';
|
||||
}
|
||||
};
|
||||
_this.$(_this.name + '__backToTop').onclick = function() {
|
||||
var Timer = setInterval(GoTop, 10);
|
||||
|
||||
function GoTop() {
|
||||
if (document.documentElement.scrollTop + document.body.scrollTop < 1) {
|
||||
clearInterval(Timer)
|
||||
} else {
|
||||
document.documentElement.scrollTop /= 1.1;
|
||||
document.body.scrollTop /= 1.1
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 布局初始化
|
||||
*/
|
||||
JELON.init();
|
||||
window.JELON = JELON;
|
||||
})();
|
||||
// 加载看板娘
|
||||
loadBannerGirl();
|
||||
});
|
||||
|
||||
/**
|
||||
* 程序入口
|
||||
*/
|
||||
JELON.init();
|
||||
require(['polyfill', 'local-search'])
|
||||
@ -1,125 +0,0 @@
|
||||
(function(){
|
||||
//加载看板娘模型
|
||||
$.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) {
|
||||
if (slash1 || slash2) {
|
||||
return word.replace('\\', '');
|
||||
}
|
||||
var variables = token.replace(/\s/g, '').split('.');
|
||||
var currentObject = context;
|
||||
var i, length, variable;
|
||||
for (i = 0, length = variables.length; i < length; ++i) {
|
||||
variable = variables[i];
|
||||
currentObject = currentObject[variable];
|
||||
if (!currentObject) return '';
|
||||
}
|
||||
return currentObject;
|
||||
});
|
||||
}
|
||||
String.prototype.render = function (context) {
|
||||
return render(this, context);
|
||||
};
|
||||
|
||||
var re = /x/;
|
||||
console.log(re);
|
||||
re.toString = function() {
|
||||
showMessage('哈哈,你打开了控制台,是想要看看我的秘密吗?', 5000);
|
||||
return '';
|
||||
};
|
||||
|
||||
document.addEventListener('copy', function(){
|
||||
showMessage('你都复制了些什么呀,转载要记得加上出处哦', 5000);
|
||||
})
|
||||
|
||||
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()});
|
||||
showMessage(text, 3000);
|
||||
});
|
||||
});
|
||||
result.click.forEach(function(tips){
|
||||
$(document).on("click", 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()});
|
||||
showMessage(text, 3000);
|
||||
});
|
||||
});
|
||||
},"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);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
@ -2,35 +2,35 @@
|
||||
"version":"1.0.0",
|
||||
"model":"model/model.moc",
|
||||
"textures":[
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Bunny_Girl_Costume_Red.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Cake_Costume_Cream.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/default-costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Dress_Costume_Brown.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Elementary_School_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Elementary_School_Costume_Navy.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Frill_Bikini_Costume_Green.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Furisode_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Halloween_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Kids_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Kids_Costume_Navy.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Maid_Costume_Red.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/New2015_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Nightsky_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Qipao_Costume_Pink.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Qipao_Costume_Red.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Sailor_Costume_Black.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Sakura_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Sakura_Costume_Navy.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Santa_Costume_Green.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Star_Witch_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Succubus_Costume_Black.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Succubus_Costume_Red.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Sukumizu_Costume_White.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Summer_Dress_Costume_Blue.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Turtleneck_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Turtleneck_Costume_Red.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Witch_Costume.png",
|
||||
"https://blog-cdn.nos-eastchina1.126.net/live2D/Witch_Costume_White.png"
|
||||
"Bunny_Girl_Costume_Red.png",
|
||||
"Cake_Costume_Cream.png",
|
||||
"default-costume.png",
|
||||
"Dress_Costume_Brown.png",
|
||||
"Elementary_School_Costume.png",
|
||||
"Elementary_School_Costume_Navy.png",
|
||||
"Frill_Bikini_Costume_Green.png",
|
||||
"Furisode_Costume.png",
|
||||
"Halloween_Costume.png",
|
||||
"Kids_Costume.png",
|
||||
"Kids_Costume_Navy.png",
|
||||
"Maid_Costume_Red.png",
|
||||
"New2015_Costume.png",
|
||||
"Nightsky_Costume.png",
|
||||
"Qipao_Costume_Pink.png",
|
||||
"Qipao_Costume_Red.png",
|
||||
"Sailor_Costume_Black.png",
|
||||
"Sakura_Costume.png",
|
||||
"Sakura_Costume_Navy.png",
|
||||
"Santa_Costume_Green.png",
|
||||
"Star_Witch_Costume.png",
|
||||
"Succubus_Costume_Black.png",
|
||||
"Succubus_Costume_Red.png",
|
||||
"Sukumizu_Costume_White.png",
|
||||
"Summer_Dress_Costume_Blue.png",
|
||||
"Turtleneck_Costume.png",
|
||||
"Turtleneck_Costume_Red.png",
|
||||
"Witch_Costume.png",
|
||||
"Witch_Costume_White.png"
|
||||
],
|
||||
"layout":{
|
||||
"center_x":0.0,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user