2022-03-04 10:52:51 +00:00
|
|
|
|
//弹窗样式
|
|
|
|
|
iziToast.settings({
|
|
|
|
|
timeout: 10000,
|
|
|
|
|
progressBar: false,
|
|
|
|
|
close: false,
|
|
|
|
|
closeOnEscape: true,
|
|
|
|
|
position: 'topCenter',
|
|
|
|
|
transitionIn: 'bounceInDown',
|
|
|
|
|
transitionOut: 'flipOutX',
|
|
|
|
|
displayMode: 'replace',
|
|
|
|
|
layout: '1',
|
|
|
|
|
backgroundColor: '#00000040',
|
|
|
|
|
titleColor: '#efefef',
|
|
|
|
|
messageColor: '#efefef',
|
|
|
|
|
iconColor: '#efefef',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//加载完成后执行
|
2022-01-20 04:12:25 +00:00
|
|
|
|
window.addEventListener('load', function () {
|
2022-03-04 10:52:51 +00:00
|
|
|
|
|
|
|
|
|
//载入动画
|
2022-01-20 04:12:25 +00:00
|
|
|
|
$('#loading-box').attr('class', 'loaded');
|
2022-01-20 13:56:06 +00:00
|
|
|
|
$('#section').css("cssText", "transform: scale(1) !important;opacity: 1 !important;filter: blur(0px) !important");
|
2022-03-04 10:52:51 +00:00
|
|
|
|
|
|
|
|
|
//用户欢迎
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
iziToast.show({
|
|
|
|
|
timeout: 2500,
|
|
|
|
|
title: hello,
|
|
|
|
|
message: '欢迎来到我的主页'
|
|
|
|
|
});
|
|
|
|
|
}, 800);
|
2022-01-20 04:12:25 +00:00
|
|
|
|
}, false)
|
|
|
|
|
|
2022-01-21 05:39:47 +00:00
|
|
|
|
setTimeout(function () {
|
|
|
|
|
$('#loading-text').html("字体及文件加载可能需要一定时间")
|
2022-02-10 08:09:09 +00:00
|
|
|
|
}, 3000);
|
2022-01-21 05:39:47 +00:00
|
|
|
|
|
2022-01-28 15:05:45 +00:00
|
|
|
|
//延迟加载音乐播放器
|
|
|
|
|
function downloadJSAtOnload() {
|
|
|
|
|
var element = document.createElement("script");
|
|
|
|
|
element.src = "./js/music.js";
|
|
|
|
|
document.body.appendChild(element);
|
|
|
|
|
}
|
|
|
|
|
if (window.addEventListener)
|
|
|
|
|
window.addEventListener("load", downloadJSAtOnload, false);
|
|
|
|
|
else if (window.attachEvent)
|
|
|
|
|
window.attachEvent("onload", downloadJSAtOnload);
|
|
|
|
|
else window.onload = downloadJSAtOnload;
|
|
|
|
|
|
2022-02-03 08:05:44 +00:00
|
|
|
|
//新春灯笼 ( 需要时取消注释 )
|
|
|
|
|
/*
|
|
|
|
|
new_element=document.createElement("link");
|
|
|
|
|
new_element.setAttribute("rel","stylesheet");
|
|
|
|
|
new_element.setAttribute("type","text/css");
|
|
|
|
|
new_element.setAttribute("href","./css/lantern.css");
|
|
|
|
|
document.body.appendChild(new_element);
|
|
|
|
|
|
|
|
|
|
new_element=document.createElement("script");
|
|
|
|
|
new_element.setAttribute("type","text/javascript");
|
|
|
|
|
new_element.setAttribute("src","./js/lantern.js");
|
|
|
|
|
document.body.appendChild(new_element);
|
|
|
|
|
*/
|
|
|
|
|
|
2022-01-29 08:46:29 +00:00
|
|
|
|
//火狐浏览器独立样式
|
|
|
|
|
if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
|
|
|
|
|
var head = document.getElementsByTagName('head')[0];
|
|
|
|
|
var link = document.createElement('link');
|
|
|
|
|
link.href = './css/firefox.css';
|
|
|
|
|
link.rel = 'stylesheet';
|
|
|
|
|
link.type = 'text/css';
|
|
|
|
|
head.appendChild(link);
|
2022-02-03 08:05:44 +00:00
|
|
|
|
window.addEventListener('load', function () {
|
2022-03-04 10:52:51 +00:00
|
|
|
|
iziToast.show({
|
2022-02-03 08:05:44 +00:00
|
|
|
|
timeout: 8000,
|
|
|
|
|
iconUrl: './img/warn.png',
|
|
|
|
|
message: '您正在使用火狐浏览器,部分功能可能不支持'
|
|
|
|
|
});
|
|
|
|
|
}, false)
|
2022-01-29 08:46:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-09-25 14:57:18 +00:00
|
|
|
|
//获取一言
|
2022-01-13 06:48:37 +00:00
|
|
|
|
fetch('https://v1.hitokoto.cn?max_length=24')
|
2021-09-25 14:57:18 +00:00
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
2022-01-20 12:50:55 +00:00
|
|
|
|
$('#hitokoto_text').text(data.hitokoto)
|
|
|
|
|
$('#from_text').text(data.from)
|
2021-09-25 14:57:18 +00:00
|
|
|
|
})
|
|
|
|
|
.catch(console.error)
|
|
|
|
|
|
|
|
|
|
//获取天气
|
2022-03-17 14:58:41 +00:00
|
|
|
|
//每日限量 100 次
|
|
|
|
|
//请前往 https://www.tianqiapi.com/ 申请(免费)
|
|
|
|
|
fetch('https://www.yiketianqi.com/free/day?appid=43986679&appsecret=TksqGZT7&unescape=1')
|
2021-09-25 14:57:18 +00:00
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
2022-01-20 12:50:55 +00:00
|
|
|
|
$('#wea_text').text(data.wea)
|
|
|
|
|
$('#city_text').text(data.city)
|
|
|
|
|
$('#tem_night').text(data.tem_night)
|
|
|
|
|
$('#tem_day').text(data.tem_day)
|
|
|
|
|
$('#win_text').text(data.win)
|
|
|
|
|
$('#win_speed').text(data.win_speed)
|
2021-09-25 14:57:18 +00:00
|
|
|
|
})
|
|
|
|
|
.catch(console.error)
|
|
|
|
|
|
|
|
|
|
//获取时间
|
|
|
|
|
var t = null;
|
|
|
|
|
t = setTimeout(time, 1000);
|
|
|
|
|
|
|
|
|
|
function time() {
|
|
|
|
|
clearTimeout(t);
|
|
|
|
|
dt = new Date();
|
|
|
|
|
var y = dt.getYear() + 1900;
|
|
|
|
|
var mm = dt.getMonth() + 1;
|
|
|
|
|
var d = dt.getDate();
|
|
|
|
|
var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
|
|
|
|
|
var day = dt.getDay();
|
|
|
|
|
var h = dt.getHours();
|
|
|
|
|
var m = dt.getMinutes();
|
|
|
|
|
var s = dt.getSeconds();
|
|
|
|
|
if (h < 10) {
|
|
|
|
|
h = "0" + h;
|
|
|
|
|
}
|
|
|
|
|
if (m < 10) {
|
|
|
|
|
m = "0" + m;
|
|
|
|
|
}
|
|
|
|
|
if (s < 10) {
|
|
|
|
|
s = "0" + s;
|
|
|
|
|
}
|
2022-01-20 13:56:06 +00:00
|
|
|
|
//document.getElementById("time").innerHTML = y + " 年 " + mm + " 月 " + d + " 日 " + "<span class='weekday'>" + weekday[day] + "</span><br>" + "<span class='time-text'>" + h + ":" + m + ":" + s + "</span>";
|
|
|
|
|
$("#time").html(y + " 年 " + mm + " 月 " + d + " 日 " + "<span class='weekday'>" + weekday[day] + "</span><br>" + "<span class='time-text'>" + h + ":" + m + ":" + s + "</span>");
|
2021-09-25 14:57:18 +00:00
|
|
|
|
t = setTimeout(time, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//链接提示文字
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$("#social").mouseover(function () {
|
|
|
|
|
$("#social").css({
|
|
|
|
|
"background": "rgb(0 0 0 / 25%)",
|
|
|
|
|
'border-radius': '6px',
|
|
|
|
|
"backdrop-filter": "blur(5px)"
|
|
|
|
|
});
|
|
|
|
|
$("#link-text").css({
|
|
|
|
|
"display": "block",
|
|
|
|
|
});
|
|
|
|
|
}).mouseout(function () {
|
|
|
|
|
$("#social").css({
|
|
|
|
|
"background": "none",
|
|
|
|
|
"border-radius": "6px",
|
|
|
|
|
"backdrop-filter": "none"
|
|
|
|
|
});
|
|
|
|
|
$("#link-text").css({
|
|
|
|
|
"display": "none"
|
|
|
|
|
});
|
|
|
|
|
});
|
2021-09-25 14:57:18 +00:00
|
|
|
|
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$("#github").mouseover(function () {
|
|
|
|
|
$("#link-text").html("去 Github 看看");
|
|
|
|
|
}).mouseout(function () {
|
|
|
|
|
$("#link-text").html("通过这里联系我");
|
|
|
|
|
});
|
|
|
|
|
$("#qq").mouseover(function () {
|
|
|
|
|
$("#link-text").html("有什么事吗");
|
|
|
|
|
}).mouseout(function () {
|
|
|
|
|
$("#link-text").html("通过这里联系我");
|
|
|
|
|
});
|
|
|
|
|
$("#email").mouseover(function () {
|
|
|
|
|
$("#link-text").html("来封 Email");
|
|
|
|
|
}).mouseout(function () {
|
|
|
|
|
$("#link-text").html("通过这里联系我");
|
|
|
|
|
});
|
|
|
|
|
$("#telegram").mouseover(function () {
|
|
|
|
|
$("#link-text").html("你懂的 ~");
|
|
|
|
|
}).mouseout(function () {
|
|
|
|
|
$("#link-text").html("通过这里联系我");
|
|
|
|
|
});
|
|
|
|
|
$("#twitter").mouseover(function () {
|
|
|
|
|
$("#link-text").html("你懂的 ~");
|
|
|
|
|
}).mouseout(function () {
|
|
|
|
|
$("#link-text").html("通过这里联系我");
|
|
|
|
|
});
|
2021-09-25 14:57:18 +00:00
|
|
|
|
|
2021-10-03 09:03:31 +00:00
|
|
|
|
//更多页面切换
|
|
|
|
|
var shoemore = false;
|
|
|
|
|
$('#switchmore').on('click', function () {
|
|
|
|
|
shoemore = !shoemore;
|
|
|
|
|
if (shoemore && $(document).width() >= 990) {
|
|
|
|
|
$('#container').attr('class', 'container mores');
|
|
|
|
|
$("#change").html("Oops !");
|
|
|
|
|
$("#change1").html("哎呀,这都被你发现了( 再点击一次可关闭 )");
|
2021-09-25 14:57:18 +00:00
|
|
|
|
} else {
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#container').attr('class', 'container');
|
|
|
|
|
$("#change").html("Hello World !");
|
|
|
|
|
$("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘");
|
2021-09-25 14:57:18 +00:00
|
|
|
|
}
|
2021-10-03 09:03:31 +00:00
|
|
|
|
});
|
2021-09-25 14:57:18 +00:00
|
|
|
|
|
2021-10-03 09:03:31 +00:00
|
|
|
|
//更多页面关闭按钮
|
|
|
|
|
$('#close').on('click', function () {
|
2022-02-03 08:05:44 +00:00
|
|
|
|
$('#switchmore').click();
|
2021-10-03 09:03:31 +00:00
|
|
|
|
});
|
|
|
|
|
|
2022-02-03 08:05:44 +00:00
|
|
|
|
//移动端菜单栏切换
|
2021-10-03 09:03:31 +00:00
|
|
|
|
var switchmenu = false;
|
|
|
|
|
$('#switchmenu').on('click', function () {
|
|
|
|
|
switchmenu = !switchmenu;
|
|
|
|
|
if (switchmenu) {
|
|
|
|
|
$('#row').attr('class', 'row menus');
|
2022-01-13 06:48:37 +00:00
|
|
|
|
$("#menu").html("<i class='iconfont icon-times'></i>");
|
2021-09-25 14:57:18 +00:00
|
|
|
|
} else {
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#row').attr('class', 'row');
|
2022-01-13 06:48:37 +00:00
|
|
|
|
$("#menu").html("<i class='iconfont icon-bars'>");
|
2021-09-25 14:57:18 +00:00
|
|
|
|
}
|
2021-10-03 09:03:31 +00:00
|
|
|
|
});
|
2021-09-25 14:57:18 +00:00
|
|
|
|
|
2021-09-27 13:07:24 +00:00
|
|
|
|
//更多弹窗页面
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#openmore').on('click', function () {
|
|
|
|
|
$('#box').css("display", "block");
|
|
|
|
|
$('#row').css("display", "none");
|
|
|
|
|
$('#more').css("cssText", "display:none !important");
|
|
|
|
|
});
|
|
|
|
|
$('#closemore').on('click', function () {
|
|
|
|
|
$('#box').css("display", "none");
|
|
|
|
|
$('#row').css("display", "flex");
|
|
|
|
|
$('#more').css("display", "flex");
|
|
|
|
|
});
|
2021-09-27 13:07:24 +00:00
|
|
|
|
|
2021-09-25 14:57:18 +00:00
|
|
|
|
//监听网页宽度
|
|
|
|
|
window.addEventListener('load', function () {
|
|
|
|
|
window.addEventListener('resize', function () {
|
|
|
|
|
//关闭移动端样式
|
|
|
|
|
if (window.innerWidth >= 600) {
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#row').attr('class', 'row');
|
2022-01-13 06:48:37 +00:00
|
|
|
|
$("#menu").html("<i class='iconfont icon-bars'>");
|
2021-09-28 12:56:14 +00:00
|
|
|
|
//移除移动端切换功能区
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#rightone').attr('class', 'row rightone');
|
2021-09-25 14:57:18 +00:00
|
|
|
|
}
|
2021-10-03 09:03:31 +00:00
|
|
|
|
|
2021-09-26 12:21:22 +00:00
|
|
|
|
if (window.innerWidth <= 990) {
|
2021-10-03 09:03:31 +00:00
|
|
|
|
//移动端隐藏更多页面
|
|
|
|
|
$('#container').attr('class', 'container');
|
|
|
|
|
$("#change").html("Hello World !");
|
|
|
|
|
$("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘");
|
|
|
|
|
|
|
|
|
|
//移动端隐藏弹窗页面
|
|
|
|
|
$('#box').css("display", "none");
|
|
|
|
|
$('#row').css("display", "flex");
|
|
|
|
|
$('#more').css("display", "flex");
|
2021-09-25 14:57:18 +00:00
|
|
|
|
}
|
|
|
|
|
})
|
2021-09-26 13:30:38 +00:00
|
|
|
|
})
|
2022-01-20 12:50:55 +00:00
|
|
|
|
|
2021-09-28 12:56:14 +00:00
|
|
|
|
//移动端切换功能区
|
2021-10-03 09:03:31 +00:00
|
|
|
|
var changemore = false;
|
|
|
|
|
$('#changemore').on('click', function () {
|
|
|
|
|
changemore = !changemore;
|
|
|
|
|
if (changemore) {
|
|
|
|
|
$('#rightone').attr('class', 'row menus mobile');
|
2021-09-28 12:56:14 +00:00
|
|
|
|
} else {
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#rightone').attr('class', 'row menus');
|
2021-09-28 12:56:14 +00:00
|
|
|
|
}
|
2021-10-03 09:03:31 +00:00
|
|
|
|
});
|
2021-09-28 12:56:14 +00:00
|
|
|
|
|
2021-09-26 13:30:38 +00:00
|
|
|
|
//更多页面显示关闭按钮
|
2021-09-28 12:56:14 +00:00
|
|
|
|
$("#more").hover(function () {
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#close').css("display", "block");
|
2021-09-28 12:56:14 +00:00
|
|
|
|
}, function () {
|
2021-10-03 09:03:31 +00:00
|
|
|
|
$('#close').css("display", "none");
|
2021-09-27 13:07:24 +00:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//屏蔽右键
|
2021-09-28 12:56:14 +00:00
|
|
|
|
document.oncontextmenu = function () {
|
2022-03-04 10:52:51 +00:00
|
|
|
|
iziToast.show({
|
|
|
|
|
timeout: 2000,
|
2022-01-14 09:35:16 +00:00
|
|
|
|
iconUrl: './img/warn.png',
|
2021-09-27 13:07:24 +00:00
|
|
|
|
message: '为了浏览体验,本站禁用右键'
|
|
|
|
|
});
|
|
|
|
|
return false;
|
2021-12-13 06:43:50 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//自动变灰
|
|
|
|
|
var myDate = new Date;
|
2022-01-16 02:28:16 +00:00
|
|
|
|
var mon = myDate.getMonth() + 1;
|
|
|
|
|
var date = myDate.getDate();
|
|
|
|
|
var days = ['4.4', '5.12', '7.7', '9.9', '9.18', '12.13'];
|
|
|
|
|
for (var day of days) {
|
2021-12-13 06:43:50 +00:00
|
|
|
|
var d = day.split('.');
|
|
|
|
|
if (mon == d[0] && date == d[1]) {
|
2022-01-16 02:28:16 +00:00
|
|
|
|
document.write(
|
|
|
|
|
'<style>html{-webkit-filter:grayscale(100%);-moz-filter:grayscale(100%);-ms-filter:grayscale(100%);-o-filter:grayscale(100%);filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);_filter:none}</style>'
|
|
|
|
|
)
|
|
|
|
|
$("#change").html("Silence in silence");
|
2022-02-03 08:05:44 +00:00
|
|
|
|
$("#change1").html("今天是中国国家纪念日,全站已切换为黑白模式");
|
|
|
|
|
window.addEventListener('load', function () {
|
2022-03-04 10:52:51 +00:00
|
|
|
|
iziToast.show({
|
2022-02-03 08:05:44 +00:00
|
|
|
|
timeout: 14000,
|
|
|
|
|
iconUrl: './img/candle.png',
|
2022-03-04 10:52:51 +00:00
|
|
|
|
message: '今天是中国国家纪念日'
|
2022-02-03 08:05:44 +00:00
|
|
|
|
});
|
|
|
|
|
}, false);
|
2021-12-13 06:43:50 +00:00
|
|
|
|
}
|
2022-01-20 04:12:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//控制台输出
|
|
|
|
|
var styleTitle1 = `
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: rgb(244,167,89);
|
|
|
|
|
`
|
|
|
|
|
var styleTitle2 = `
|
|
|
|
|
font-size:12px;
|
|
|
|
|
color: rgb(244,167,89);
|
|
|
|
|
`
|
|
|
|
|
var styleContent = `
|
|
|
|
|
color: rgb(30,152,255);
|
|
|
|
|
`
|
|
|
|
|
var title1 = '無名の主页'
|
|
|
|
|
var title2 = `
|
|
|
|
|
_____ __ __ _______ ____ __
|
|
|
|
|
|_ _| \\/ |/ ____\\ \\ / /\\ \\ / /
|
|
|
|
|
| | | \\ / | (___ \\ \\_/ / \\ \\_/ /
|
|
|
|
|
| | | |\\/| |\\___ \\ \\ / \\ /
|
|
|
|
|
_| |_| | | |____) | | | | |
|
|
|
|
|
|_____|_| |_|_____/ |_| |_|
|
|
|
|
|
`
|
|
|
|
|
var content = `
|
2022-01-29 05:09:21 +00:00
|
|
|
|
版 本 号:1.6
|
|
|
|
|
更新日期:2022-01-30
|
2022-01-20 04:12:25 +00:00
|
|
|
|
|
|
|
|
|
更新说明:
|
2022-01-29 05:09:21 +00:00
|
|
|
|
1. 新增 音乐播放器支持音量控制
|
|
|
|
|
2. 修复 CDN 加载缓慢
|
|
|
|
|
3. 优化 部分动画及细节
|
|
|
|
|
4. 优化 页面加载缓慢
|
|
|
|
|
5. 优化 音乐列表延迟加载
|
2022-01-20 04:12:25 +00:00
|
|
|
|
|
2022-01-29 05:09:21 +00:00
|
|
|
|
主页: https://www.imsyy.top
|
2022-01-20 04:12:25 +00:00
|
|
|
|
Github: https://github.com/imsyy/home
|
|
|
|
|
`
|
|
|
|
|
console.log(`%c${title1} %c${title2}
|
2022-01-21 05:39:47 +00:00
|
|
|
|
%c${content}`, styleTitle1, styleTitle2, styleContent)
|