看板娘优化

This commit is contained in:
结发受长生 2018-05-27 21:05:50 +08:00
parent 2602784e0e
commit 8726cb3361
4 changed files with 14 additions and 19 deletions

View File

@ -1,4 +0,0 @@
<!-- 文档分类 -->
<% if (post.categories && post.categories.length) { %>
<% } %>

View File

@ -1,4 +0,0 @@
<% if (post.photos && post.photos.length) { %>
<!-- 相册 -->
<% } %>

View File

@ -39,7 +39,7 @@ var tipTimer = undefined;
/**
* 显示消息
* @param {Object} text 消息内容(如果是数组则显示其中的随机一个元素)
* @param {Numer} timeout 消失的延迟时间
* @param {Number} timeout 消失的延迟时间
*/
function showMessage(text, timeout){
if(tipTimer) {
@ -60,7 +60,11 @@ function hideMessage(timeout){
tips.style.opacity = 0;
}, timeout || 5000);
}
var text;
var text, productHref = [
'https://www.colorfulsweet.site/',
'https://sookie2010.coding.me/',
'https://sookie2010.github.io/'
];
if(document.referrer){
var referrer = document.createElement('a');
referrer.href = document.referrer;
@ -74,7 +78,7 @@ if(document.referrer){
text = 'Hello! 来自 谷歌搜索 的朋友<br>欢迎阅读<span style="color:#0099cc;">『' + document.title.split(' - ')[0] + '』</span>';
}
}else {
if (window.location.href == 'https://www.colorfulsweet.site/') { //如果是主页
if (productHref.indexOf(window.location.href) !== -1) { //如果是主页
var now = new Date().getHours();
if (now > 23 || now <= 5) {
text = '你是夜猫子呀?这么晚还不睡觉,明天起的来吗';

View File

@ -15,7 +15,7 @@ require.config({
}
});
require(['polyfill', 'local-search']);
require(['echo', 'bannerGirl'],function(echo, bannerGirl){
require(['echo'],function(echo, bannerGirl){
function deepCopy(c, p) {
 var c = c || {};
 for (var i in p) {
@ -28,7 +28,6 @@ require(['echo', 'bannerGirl'],function(echo, bannerGirl){
 }
 return c;
}
(function(){
var JELON = window.JELON || {};
JELON = deepCopy(JELON, {
name: 'JELON',
@ -58,7 +57,6 @@ require(['echo', 'bannerGirl'],function(echo, bannerGirl){
} else {
$menu.className = $menu.className.replace(/\s*hidden\s*/, '');
}
};
},
backToTop: function() {
@ -90,9 +88,10 @@ require(['echo', 'bannerGirl'],function(echo, bannerGirl){
*/
JELON.init();
window.JELON = JELON;
})();
// 在PC端加载看板娘
if(!/Android|webOS|iPhone|iPad|BlackBerry/i.test(navigator.userAgent)) {
});
if(!/Android|webOS|iPhone|iPad|BlackBerry/i.test(navigator.userAgent)) {
// 只在PC端加载看板娘
require(['bannerGirl'], function(bannerGirl){
bannerGirl.init('/resource/model.json');
}
});
});
}