2021-09-25 22:57:18 +08:00
|
|
|
|
//弹窗样式
|
|
|
|
|
iziToast.settings({
|
|
|
|
|
timeout: 10000,
|
|
|
|
|
icon: 'Fontawesome',
|
|
|
|
|
closeOnEscape: 'true',
|
|
|
|
|
position: 'topLeft',
|
|
|
|
|
transitionIn: 'bounceInRight',
|
|
|
|
|
transitionOut: 'fadeOutLeft',
|
2021-09-27 21:07:24 +08:00
|
|
|
|
displayMode: 'replace',
|
2021-09-25 22:57:18 +08:00
|
|
|
|
layout: '2',
|
|
|
|
|
titleColor: '#efefef',
|
|
|
|
|
messageColor: '#efefef',
|
|
|
|
|
iconColor: '#efefef',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
iziToast.info({
|
|
|
|
|
icon: 'fad fa-vial',
|
|
|
|
|
title: '新版站点试运行',
|
|
|
|
|
message: '还存在亿些小问题 ~ <a href="./old/" style="color:#efefef">返回旧版</a>'
|
|
|
|
|
});
|
|
|
|
|
|
2021-09-27 09:38:36 +08:00
|
|
|
|
//控制台输出
|
|
|
|
|
/*
|
|
|
|
|
let date = '2021-09-27 21:32'
|
|
|
|
|
let a = 'background: #606060; color: #fff; border-radius: 3px 0 0 3px;'
|
|
|
|
|
let b = 'background: #1475B2; color: #fff; border-radius: 0 3px 3px 0;'
|
|
|
|
|
console.log(`%c Update Time %c ${date} `, a, b)
|
|
|
|
|
*/
|
|
|
|
|
/* 样式代码 */
|
|
|
|
|
var styleTitle1 = `
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: rgb(244,167,89);
|
|
|
|
|
`
|
|
|
|
|
var styleTitle2 = `
|
|
|
|
|
font-style: oblique;
|
|
|
|
|
font-size:14px;
|
|
|
|
|
color: rgb(244,167,89);
|
|
|
|
|
font-weight: 400;
|
|
|
|
|
`
|
|
|
|
|
var styleContent = `
|
|
|
|
|
color: rgb(30,152,255);
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
/* 内容代码 */
|
|
|
|
|
var title1 = '無名の主页'
|
|
|
|
|
var title2 = 'imsyy.top'
|
|
|
|
|
var content = `
|
2021-10-03 17:03:31 +08:00
|
|
|
|
版 本 号:1.3.0
|
|
|
|
|
更新日期:2021-10-02 14:26:31
|
2021-09-27 09:38:36 +08:00
|
|
|
|
|
|
|
|
|
更新说明:
|
|
|
|
|
1. 新增 点击左侧简介弹出更多页面
|
2021-10-03 17:03:31 +08:00
|
|
|
|
2. 修复 时间胶囊( 时光进度条 )
|
2021-09-27 09:38:36 +08:00
|
|
|
|
3. 优化 移动端动画及细节
|
2021-10-03 17:03:31 +08:00
|
|
|
|
4. 优化 Js 文件优化
|
|
|
|
|
5. 修复 星期进度条显示错误
|
2021-09-27 09:38:36 +08:00
|
|
|
|
|
|
|
|
|
主页: https://imsyy.top
|
|
|
|
|
Github: https://github.com/imsyy/home
|
|
|
|
|
`
|
|
|
|
|
console.log(`%c${title1} %c${title2}
|
|
|
|
|
%c${content}`, styleTitle1, styleTitle2, styleContent)
|
|
|
|
|
|
2021-09-25 22:57:18 +08:00
|
|
|
|
//获取一言
|
|
|
|
|
fetch('https://v1.hitokoto.cn')
|
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
const hitokoto = document.getElementById('hitokoto_text')
|
|
|
|
|
const from = document.getElementById('from_text')
|
|
|
|
|
hitokoto.innerText = data.hitokoto
|
|
|
|
|
from.innerText = data.from
|
|
|
|
|
})
|
|
|
|
|
.catch(console.error)
|
|
|
|
|
|
|
|
|
|
//获取天气
|
2021-11-17 16:29:00 +08:00
|
|
|
|
fetch('https://www.tianqiapi.com/free/day?appid=43986679&appsecret=TksqGZT7&unescape=1')
|
2021-09-25 22:57:18 +08:00
|
|
|
|
.then(response => response.json())
|
|
|
|
|
.then(data => {
|
|
|
|
|
const wea = document.getElementById('wea_text')
|
|
|
|
|
const city = document.getElementById('city_text')
|
|
|
|
|
const tem_night = document.getElementById('tem_night')
|
|
|
|
|
const tem_day = document.getElementById('tem_day')
|
|
|
|
|
const win = document.getElementById('win_text')
|
|
|
|
|
const win_speed = document.getElementById('win_speed')
|
|
|
|
|
wea.innerText = data.wea
|
|
|
|
|
city.innerText = data.city
|
|
|
|
|
tem_night.innerText = data.tem_night
|
|
|
|
|
tem_day.innerText = data.tem_day
|
|
|
|
|
win.innerText = data.win
|
|
|
|
|
win_speed.innerText = data.win_speed
|
|
|
|
|
})
|
|
|
|
|
.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;
|
|
|
|
|
}
|
|
|
|
|
document.getElementById("time").innerHTML = y + " 年 " + mm + " 月 " + d + " 日 " + "<span class='weekday'>" + weekday[day] + "</span><br>" + "<span class='time-text'>" + h + ":" + m + ":" + s + "</span>";
|
|
|
|
|
t = setTimeout(time, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//必应壁纸
|
2021-11-14 16:58:31 +08:00
|
|
|
|
/*
|
2021-09-25 22:57:18 +08:00
|
|
|
|
var url = 'https://bird.ioliu.cn/v1/?url=https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=8';
|
|
|
|
|
var imgUrls = JSON.parse(sessionStorage.getItem("imgUrls"));
|
|
|
|
|
var index = sessionStorage.getItem("index");
|
|
|
|
|
var $section = $('#section');
|
|
|
|
|
if (imgUrls == null) {
|
|
|
|
|
imgUrls = new Array();
|
|
|
|
|
index = 0;
|
|
|
|
|
$.get(url, function (result) {
|
|
|
|
|
images = result.images;
|
|
|
|
|
for (let i = 0; i < images.length; i++) {
|
|
|
|
|
const item = images[i];
|
|
|
|
|
imgUrls.push(item.url);
|
|
|
|
|
}
|
|
|
|
|
var imgUrl = imgUrls[index];
|
|
|
|
|
var url = "https://www.bing.com" + imgUrl;
|
|
|
|
|
$section.css("background", "url('" + url + "') center center no-repeat #666");
|
|
|
|
|
$section.css("background-size", "cover");
|
|
|
|
|
sessionStorage.setItem("imgUrls", JSON.stringify(imgUrls));
|
|
|
|
|
sessionStorage.setItem("index", index);
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (index == 7)
|
|
|
|
|
index = 0;
|
|
|
|
|
else
|
|
|
|
|
index++;
|
|
|
|
|
var imgUrl = imgUrls[index];
|
|
|
|
|
var url = "https://www.bing.com" + imgUrl;
|
|
|
|
|
$section.css("background", "url('" + url + "') center center no-repeat #666");
|
|
|
|
|
$section.css("background-size", "cover");
|
|
|
|
|
sessionStorage.setItem("index", index);
|
|
|
|
|
}
|
2021-11-14 16:58:31 +08:00
|
|
|
|
*/
|
|
|
|
|
//临时更换图片 api
|
2021-11-17 16:29:00 +08:00
|
|
|
|
/*
|
2021-11-14 16:58:31 +08:00
|
|
|
|
var $section = $('#section');
|
2021-11-17 15:35:51 +08:00
|
|
|
|
var url = "https://api.ixiaowai.cn/gqapi/gqapi.php";
|
2021-11-14 16:58:31 +08:00
|
|
|
|
$section.css("background", "url('" + url + "') center center no-repeat #666");
|
|
|
|
|
$section.css("background-size", "cover");
|
2021-11-17 16:29:00 +08:00
|
|
|
|
*/
|
2021-09-25 22:57:18 +08:00
|
|
|
|
|
|
|
|
|
//加载动画
|
|
|
|
|
window.addEventListener('load', function () {
|
|
|
|
|
document.body.style.overflow = 'auto';
|
|
|
|
|
document.getElementById('loading-box').classList.add("loaded")
|
|
|
|
|
}, false)
|
|
|
|
|
|
|
|
|
|
//链接提示文字
|
2021-10-03 17:03:31 +08: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 22:57:18 +08:00
|
|
|
|
|
2021-10-03 17:03:31 +08: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 22:57:18 +08:00
|
|
|
|
|
2021-10-03 17:03:31 +08: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 22:57:18 +08:00
|
|
|
|
} else {
|
2021-10-03 17:03:31 +08:00
|
|
|
|
$('#container').attr('class', 'container');
|
|
|
|
|
$("#change").html("Hello World !");
|
|
|
|
|
$("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘");
|
2021-09-25 22:57:18 +08:00
|
|
|
|
}
|
2021-10-03 17:03:31 +08:00
|
|
|
|
});
|
2021-09-25 22:57:18 +08:00
|
|
|
|
|
2021-10-03 17:03:31 +08:00
|
|
|
|
//更多页面关闭按钮
|
|
|
|
|
$('#close').on('click', function () {
|
|
|
|
|
$('#container').attr('class', 'container');
|
|
|
|
|
$("#change").html("Hello World !");
|
|
|
|
|
$("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//菜单栏切换
|
|
|
|
|
var switchmenu = false;
|
|
|
|
|
$('#switchmenu').on('click', function () {
|
|
|
|
|
switchmenu = !switchmenu;
|
|
|
|
|
if (switchmenu) {
|
|
|
|
|
$('#row').attr('class', 'row menus');
|
|
|
|
|
$("#menu").html("<i class='fad fa-times'></i>");
|
2021-09-25 22:57:18 +08:00
|
|
|
|
} else {
|
2021-10-03 17:03:31 +08:00
|
|
|
|
$('#row').attr('class', 'row');
|
|
|
|
|
$("#menu").html("<i class='fad fa-bars'></i>");
|
2021-09-25 22:57:18 +08:00
|
|
|
|
}
|
2021-10-03 17:03:31 +08:00
|
|
|
|
});
|
2021-09-25 22:57:18 +08:00
|
|
|
|
|
2021-09-27 21:07:24 +08:00
|
|
|
|
//更多弹窗页面
|
2021-10-03 17:03:31 +08: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 21:07:24 +08:00
|
|
|
|
|
2021-09-25 22:57:18 +08:00
|
|
|
|
//监听网页宽度
|
|
|
|
|
window.addEventListener('load', function () {
|
|
|
|
|
window.addEventListener('resize', function () {
|
|
|
|
|
//关闭移动端样式
|
|
|
|
|
if (window.innerWidth >= 600) {
|
2021-10-03 17:03:31 +08:00
|
|
|
|
$('#row').attr('class', 'row');
|
|
|
|
|
$("#menu").html("<i class='fad fa-bars'></i>");
|
2021-09-28 20:56:14 +08:00
|
|
|
|
//移除移动端切换功能区
|
2021-10-03 17:03:31 +08:00
|
|
|
|
$('#rightone').attr('class', 'row rightone');
|
2021-09-25 22:57:18 +08:00
|
|
|
|
}
|
2021-10-03 17:03:31 +08:00
|
|
|
|
|
2021-09-26 20:21:22 +08:00
|
|
|
|
if (window.innerWidth <= 990) {
|
2021-10-03 17:03:31 +08: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 22:57:18 +08:00
|
|
|
|
}
|
|
|
|
|
})
|
2021-09-26 21:30:38 +08:00
|
|
|
|
})
|
2021-10-13 18:16:29 +08:00
|
|
|
|
/*
|
|
|
|
|
document.getElementById("theme-toggle").addEventListener("click", () => {
|
|
|
|
|
document.body.className.includes("dark") ? (document.body.classList.remove('dark'),
|
|
|
|
|
localStorage.setItem("pref-theme", 'light')) : (document.body.classList.add('dark'),
|
|
|
|
|
localStorage.setItem("pref-theme", 'dark'))
|
|
|
|
|
})
|
|
|
|
|
*/
|
2021-09-28 20:56:14 +08:00
|
|
|
|
//移动端切换功能区
|
2021-10-03 17:03:31 +08:00
|
|
|
|
var changemore = false;
|
|
|
|
|
$('#changemore').on('click', function () {
|
|
|
|
|
changemore = !changemore;
|
|
|
|
|
if (changemore) {
|
|
|
|
|
$('#rightone').attr('class', 'row menus mobile');
|
2021-09-28 20:56:14 +08:00
|
|
|
|
} else {
|
2021-10-03 17:03:31 +08:00
|
|
|
|
$('#rightone').attr('class', 'row menus');
|
2021-09-28 20:56:14 +08:00
|
|
|
|
}
|
2021-10-03 17:03:31 +08:00
|
|
|
|
});
|
2021-09-28 20:56:14 +08:00
|
|
|
|
|
2021-09-26 21:30:38 +08:00
|
|
|
|
//更多页面显示关闭按钮
|
2021-09-28 20:56:14 +08:00
|
|
|
|
$("#more").hover(function () {
|
2021-10-03 17:03:31 +08:00
|
|
|
|
$('#close').css("display", "block");
|
2021-09-28 20:56:14 +08:00
|
|
|
|
}, function () {
|
2021-10-03 17:03:31 +08:00
|
|
|
|
$('#close').css("display", "none");
|
2021-09-27 21:07:24 +08:00
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
//屏蔽右键
|
2021-09-28 20:56:14 +08:00
|
|
|
|
document.oncontextmenu = function () {
|
2021-09-27 21:07:24 +08:00
|
|
|
|
iziToast.info({
|
|
|
|
|
icon: 'fad fa-do-not-enter',
|
|
|
|
|
title: '温馨提醒',
|
|
|
|
|
message: '为了浏览体验,本站禁用右键'
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
}
|