//加载动画 window.addEventListener('load', function () { $('#loading-box').attr('class', 'loaded'); $('#section').css("cssText", "transform: scale(1) !important;opacity: 1 !important;filter: blur(0px) !important"); }, false) //弹窗样式 iziToast.settings({ timeout: 10000, //icon: 'Fontawesome', closeOnEscape: 'true', position: 'topLeft', transitionIn: 'bounceInRight', transitionOut: 'fadeOutLeft', displayMode: 'replace', layout: '2', titleColor: '#efefef', messageColor: '#efefef', iconColor: '#efefef', }); //获取一言 fetch('https://v1.hitokoto.cn?max_length=24') .then(response => response.json()) .then(data => { $('#hitokoto_text').text(data.hitokoto) $('#from_text').text(data.from) }) .catch(console.error) //获取天气 fetch('https://www.yiketianqi.com/free/day?appid=43986679&appsecret=TksqGZT7&unescape=1') .then(response => response.json()) .then(data => { $('#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) }) .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 + " 日 " + "" + weekday[day] + "
" + "" + h + ":" + m + ":" + s + ""; $("#time").html(y + " 年 " + mm + " 月 " + d + " 日 " + "" + weekday[day] + "
" + "" + h + ":" + m + ":" + s + ""); t = setTimeout(time, 1000); } //链接提示文字 $("#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" }); }); $("#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("通过这里联系我"); }); //更多页面切换 var shoemore = false; $('#switchmore').on('click', function () { shoemore = !shoemore; if (shoemore && $(document).width() >= 990) { $('#container').attr('class', 'container mores'); $("#change").html("Oops !"); $("#change1").html("哎呀,这都被你发现了( 再点击一次可关闭 )"); } else { $('#container').attr('class', 'container'); $("#change").html("Hello World !"); $("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘"); } }); //更多页面关闭按钮 $('#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(""); } else { $('#row').attr('class', 'row'); $("#menu").html(""); } }); //更多弹窗页面 $('#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"); }); //监听网页宽度 window.addEventListener('load', function () { window.addEventListener('resize', function () { //关闭移动端样式 if (window.innerWidth >= 600) { $('#row').attr('class', 'row'); $("#menu").html(""); //移除移动端切换功能区 $('#rightone').attr('class', 'row rightone'); } if (window.innerWidth <= 990) { //移动端隐藏更多页面 $('#container').attr('class', 'container'); $("#change").html("Hello World !"); $("#change1").html("一个建立于 21 世纪的小站,存活于互联网的边缘"); //移动端隐藏弹窗页面 $('#box').css("display", "none"); $('#row').css("display", "flex"); $('#more').css("display", "flex"); } }) }) //移动端切换功能区 var changemore = false; $('#changemore').on('click', function () { changemore = !changemore; if (changemore) { $('#rightone').attr('class', 'row menus mobile'); } else { $('#rightone').attr('class', 'row menus'); } }); //更多页面显示关闭按钮 $("#more").hover(function () { $('#close').css("display", "block"); }, function () { $('#close').css("display", "none"); }) //屏蔽右键 document.oncontextmenu = function () { iziToast.info({ //icon: 'fad fa-do-not-enter', iconUrl: './img/warn.png', title: '温馨提醒', message: '为了浏览体验,本站禁用右键' }); return false; } //自动变灰 var myDate = new Date; 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) { var d = day.split('.'); if (mon == d[0] && date == d[1]) { document.write( '' ) $("#change").html("Silence in silence"); $("#change1").html("今天是国家纪念日,全站已切换为黑白模式"); iziToast.info({ timeout: 14000, //icon: 'fad fa-candle-holder', iconUrl: './img/candle.png', title: '今天是国家纪念日', message: '历史不会忘记,人民永远铭记!' }); } } //控制台输出 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 = ` 版 本 号:1.5.2 更新日期:2022-01-20 更新说明: 1. 新增 音乐播放器 2. 新增 开屏载入动画 3. 修复 部分边距不一致 4. 优化 移动端动画及细节 5. 优化 页面加载缓慢 6. 修复 时光胶囊显示错误 主页: https://imsyy.top Github: https://github.com/imsyy/home ` console.log(`%c${title1} %c${title2} %c${content}`, styleTitle1, styleTitle2, styleContent)