sidebar
<script>
/*此文件只需修改下面两行信息*/
/*分别写你的用户名,博客开始使用的年、月、日*/
var USERNAME="Gokix";
var STARTY=2022,STARTM=5,STARTD=5;
</script>
<script>
function sleep(time){
var startTime = new Date().getTime() + parseInt(time, 10);
while(new Date().getTime() < startTime) {}
}
/*回到顶部*/
var scrolling;
function gotoTopWork(){
let dy = document.documentElement.scrollTop / 10; // 每次更新scrollTop改变的大小
if(document.documentElement.scrollTop > 0) {
document.documentElement.scrollTop -= Math.max(dy, 10);
setTimeout(() => {
gotoTopWork();
}, 15);
}
}
function gotoTop() {
if(scrolling) return;
scrolling=1;
gotoTopWork();
setTimeout(function(){
scrolling=0;
},800);
}
function gotoBottomWork(){
let dy = (document.documentElement.scrollHeight-document.documentElement.clientHeight-document.documentElement.scrollTop) / 10;
if(document.documentElement.scrollHeight-document.documentElement.clientHeight-document.documentElement.scrollTop> 0) {
document.documentElement.scrollTop += Math.max(dy, 10);
setTimeout(()=>{
gotoBottomWork();
},15);
}
}
function gotoBottom(){
if(scrolling) return;
scrolling=1;
gotoBottomWork();
setTimeout(function(){
scrolling=0;
},800);
}
</script>
<script>
/*对首页/非首页的处理*/
function doFuckingThings(){
if(nowUrl=="/"+USERNAME+"/"||nowUrl=="/"+USERNAME){
// is_user_name=1;
console.log("first page!");
var backgroundimg=["https://z4a.net/images/2022/10/23/1c02b3501c04574c588bac41a876da9c.jpg",
"https://www.helloimg.com/images/2023/05/02/oqOI96.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/aeo1zcid.png",
"https://pic.downk.cc/item/5e7cd9d5504f4bcb04e063ec.jpg",
"https://z4a.net/images/2022/10/23/2d81bdd3e75bda66f2e2433247569c5c.jpg",
"https://pic.downk.cc/item/5e7cd9d5504f4bcb04e063ce.jpg",
"https://www.helloimg.com/images/2023/03/11/oaIzou.png",
"https://pic.downk.cc/item/5e7b16a0504f4bcb04d8f5c0.jpg",
"https://z4a.net/images/2022/10/23/-.jpg",
"https://z4a.net/images/2022/10/23/Koishi.jpg",
"https://pic.downk.cc/item/5e7b16bf504f4bcb04d910cd.jpg",
"https://s2.loli.net/2023/07/15/pSXAah9fE8dy3BM.jpg",
"https://z4a.net/images/2022/10/23/68d4cce4068556c1b778e63943d08a17.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/8c9vyc38.png",
"https://pic.downk.cc/item/5e7b16e5504f4bcb04d93068.png",
"https://pic.downk.cc/item/5e7b16e5504f4bcb04d930b7.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/mq8tmsh4.png",
"https://www.helloimg.com/images/2023/03/11/oaI8s9.png",
"https://www.helloimg.com/images/2023/05/07/oxeXfQ.jpg",
"https://z4a.net/images/2022/10/23/Reimu.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/giqk068e.png",
"https://cdn.luogu.com.cn/upload/image_hosting/3mo3cv6x.png",
"https://pic.downk.cc/item/5e7b171b504f4bcb04d961dd.jpg",
"https://pic.downk.cc/item/5e7b16a0504f4bcb04d8f5b4.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/qqdzjhu9.png",
"https://www.helloimg.com/images/2023/03/11/oaIN2Q.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/zwoniuoa.png",
"https://cdn.luogu.com.cn/upload/image_hosting/ugiqqphm.png",
"https://cdn.luogu.com.cn/upload/image_hosting/y3epbh3n.png",
"https://cdn.luogu.com.cn/upload/image_hosting/2c3h58ea.png",
"https://z4a.net/images/2022/10/23/-12.jpg",
"https://pic.downk.cc/item/5e7e25fe504f4bcb04a1e75a.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/oqzmdisg.png",
"https://cdn.luogu.com.cn/upload/image_hosting/s0yx6u0d.png",
"https://pic.downk.cc/item/5e7e25fe504f4bcb04a1e768.jpg",
"https://z4a.net/images/2022/10/23/7df4c989fca53ea9ac0d85283545a03c.jpg",
"https://www.helloimg.com/images/2023/03/11/oaIKvX.png",
"https://cdn.luogu.com.cn/upload/image_hosting/xyk09o0i.png",
"https://www.helloimg.com/images/2023/03/11/oaIQKt.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/o7jyzytd.png",
"https://cdn.luogu.com.cn/upload/image_hosting/x32cg6sm.png",
"https://cdn.luogu.com.cn/upload/image_hosting/raofin3w.png",
"https://www.helloimg.com/images/2023/05/07/oxeEUv.jpg",
"https://www.helloimg.com/images/2023/05/07/oxemPE.jpg",
"https://cdn.luogu.com.cn/upload/image_hosting/prqcvxtg.png"
];
titlePage.style.backgroundImage="url(\" "+backgroundimg[Math.floor(Math.random()*45)]+"\")";
titlePage.style.height="100vh";
document.getElementById("onePoem").style.display="block";
document.getElementById("onePoemTitle").style.display="block";
marginTop.innerHTML="#home{margin-top:100vh}"
document.getElementsByTagName("HEAD")[0].appendChild(marginTop);
var style=document.createElement("style");
style.type="text/css";
style.innerHTML="@media only screen and (max-width:1000px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 68vh; height: 68vh; max-height:68vh; padding: 15% 0;}#home{ margin-top:68vh;}}@media only screen and (max-width:950px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 64vh; height:64vh; max-height:64vh; padding: 15% 0;}#home{ margin-top:64vh;}}@media only screen and (max-width:900px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 60vh; height: 60vh; max-height:60vh; padding: 15% 0;}#home{ margin-top:60vh;}}@media only screen and (max-width:850px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 56vh; height: 56vh; max-height:56vh; padding: 15% 0;}#home{ margin-top:56vh;}}@media only screen and (max-width:800px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 53vh; height: 53vh; max-height:53vh; padding: 15% 0;}#home{ margin-top:53vh;}}@media only screen and (max-width:760px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 50vh; height: 50vh; max-height: 50vh; padding: 15% 0;}#home{ margin-top:50vh;}}@media only screen and (max-width:700px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 46vh; height: 46vh; max-height:46vh; padding: 15% 0;}#home{ margin-top:46vh;}}@media only screen and (max-width:650px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 43vh; height: 43vh; max-height:43vh; padding: 15% 0;}#home{ margin-top:43vh;}}"
document.getElementsByTagName("HEAD")[0].appendChild(style);
}
/************************非首页******************/
else{
console.log("this is not first page")
console.log(nowUrl);
/*寻找当前的标题并处理*/
var articleTitle;
articleTitle=document.getElementsByClassName("PostListTitle")[0];/*标签列表标题*/
if(!articleTitle) articleTitle=document.getElementsByClassName("entrylistTitle")[0];/*分类列表标题,随便,文章档案标题*/
if(!articleTitle) articleTitle=document.getElementById("cb_post_title_url");/*文章的标题*/
if(!articleTitle) articleTitle=document.getElementById("taglist_title");
if(!articleTitle) articleTitle=document.getElementsByClassName("big_a_top")[0],is_user_name=1;/*名字*/
var userName=document.getElementById("userName");
userName.innerHTML=articleTitle.innerHTML;
console.log(articleTitle.innerHTML);
if(!is_user_name){
articleTitle.style.display="none";
document.getElementById("topTitle_p").innerHTML=articleTitle.innerHTML;
}
else document.getElementById("topTitle").style.display="none";
/*处理home的位置*/
marginTop.innerHTML="#home{margin-top:45vh;}";
document.getElementsByTagName("HEAD")[0].appendChild(marginTop);
titlePageHeight.innerHTML="#titlePage{height:45vh;}";
document.getElementsByTagName("HEAD")[0].appendChild(titlePageHeight);
userNameStyle.innerHTML="#userName{font-size:3em;font-weight:800;}";
document.getElementsByTagName("HEAD")[0].appendChild(userNameStyle);
/*背景图*/
var backgroundimg=[
"https://pic.downk.cc/item/5e7b1700504f4bcb04d9496b.jpg",
"https://pic.downk.cc/item/5e7e23ac504f4bcb049ff1b2.png",
"https://pic.downk.cc/item/5e7e24a0504f4bcb04a0cc60.png",
"https://cdn.luogu.com.cn/upload/image_hosting/72tb82ke.png",
"https://pic.imgdb.cn/item/61dd44e22ab3f51d918ab998.png",
"https://cdn.luogu.com.cn/upload/image_hosting/5ma5xwkq.png",
"https://cdn.luogu.com.cn/upload/image_hosting/gw5j7utl.png"];
titlePage.style.backgroundImage="url(\" "+backgroundimg[Math.floor(Math.random()*7)]+"\")";
var style=document.createElement("style");
style.type="text/css";
style.innerHTML="@media only screen and (max-width:900px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 35vh; height: 35vh; max-height:35vh;}#home{ margin-top:35vh !important;}}@media only screen and (max-width:800px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 32vh; height: 32vh; max-height:32vh;}#userName{ font-size:2em !important;}#home{ margin-top:32vh !important;}}@media only screen and (max-width:700px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height: 28vh; height: 28vh; max-height:28vh; min-height:28vh;}#userName{ font-size:2em !important;}#home{ margin-top:28vh !important;}}@media only screen and (max-width:600px){#titlePage{ -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; min-height:25vh; height: 25vh; max-height:25vh; min-height:25vh;}#userName{ font-size:1.5em !important;}#home{ margin-top:25vh !important;}}";
document.getElementsByTagName("HEAD")[0].appendChild(style);
}
document.getElementById("userName").style.display="block";
}
function initPc(width){
console.log("This is PC or ipad or others that the width bigger than 870px");
if(width<want_width) Home.style="width:100%",TopMenuMain.style="width:100%";
else Home.style="width:"+want_width+"px;",TopMenuMain.style="width:"+want_width+"px;";
doFuckingThings();
/*一言只有 PC 上显示*/
var st=["<center>梦违,将幻之朝雾中世界的记忆<br><center>现世,构筑于徐徐崩去的沙土之上<br>",
"<center> 纵横汪洋 彼岸归航<br>",
"<center> 此刻仅存旧梦相伴<br><center>空杯高举亦有何妨<br>",
"<center> 生生生生暗生始<br><center>死死死死冥死终<br>",
"<center> 红茶的要素里最重要的,就是质量、品位、还有格调<br><center>质量的话……这个只要选了优良的茶叶就可以了<br><center>品位则来自于后天被赋予的由来和氛围之类的东西<br>",
"<center> 满目唯有缤纷落花<br><center>仿若远去那日的景象<br>",
"<center> 且怀悲悯之心走过世间<br><center>世间怜我以虚妄谎言<br>",
"<center> 步之于春径<br><center>浸至于皓白<br>",
"<center> 不知为何 感觉这样就能很自然地笑出来了<br>",
"<center> 盼凯风 待快晴<br>",
"<center> 幻想乡的和平<br><center>也就像是沙上的巴别塔吧<br>",
"<center> 虽有忮心<br><center>不怨飘瓦<br>",
"<center> 蛙以口鸣<br><center>方致蛇祸<br>",
"<center> 你说用刀背砍……<br><center>那把刀<br><center>不是双刃吗?<br>",
"<center> 以和为贵<br><center>无忤为宗<br>",
"<center> 雾雨蒙蒙、黑暗且不显眼<br><center>但却拥有温柔<br>",
"<center> 就在这万物颠倒的反转城<br><center>体味弱者的屈辱吧!<br>",
"<center> 来吧,秘宝哟!<br><center>将迷途的羔羊引导至我们叛逆者这边吧! <br>",
"<center> 道具会根据自己的想法驱使使用者 <br>",
"<center> 霞出光离 若现青涩之身影<br><center> 声销音霁 继导游子之羁行<br>",
"<center> 人是从何时开始不再接受神秘的呢<br><center> 那之中有着深厚的想象力<br>",
"<center> 你所看到的天上的月亮<br><center> 只是真实之月在天穹中的倒影<br>",
"<center> 彷徨独至鬼蜮处<br><center> 繁絮空吟怀古词<br>",
"<center> メリー! この場所、見た事があるよ!<br>",
"<center> 即使科学昌明,想象力的重要性也不会有变</center><center>因为科学的大部分是由想象力而生</center>" ,
"<center> 明天看见的景色<br> 已在梦里见过了<br>",
"<center> 高动态范围的影像也好<br>都敌不过真正的天空的颜色<br>就好像梦与现实无法区分一样<br>就好像人类与蝴蝶无法区分一样</center>",
"<center> 身与华落 心将香飞</center>",
"<center> 愿其余命尚存之时 至少让它绽放本色</center>",
"<center> 明日之盛 昨日之俗</center>",
"<center> 正因为我曾以为那一切<br><center>美丽得无与伦比 <br><center> 才会被囚禁于此处<br>",
"<center> 見るな。来るな。<br><center>知るな。渡るな。<br><center>あまりにも絶対的な“とおりゃんせ”に背を向けよ。<br>",
"<center> 相互厌恶 <br><center> 相互怨恨<br><center> 我们 <br><center>知晓了哀为何物 <br><center> 知晓了爱名为何物<br>",
"<center> 怀抱着恐惧面对世界 <br><center> 试图作出解答<br><center>将其蕴藏的所有感情 <br><center>将它的内涵 <br><center> 试图作出解答<br><center>就算世界与我天各一方<br>",
"<center> 如果世界如此幼稚的话 <br><center> 我能做到的就仅仅只有爱<br><center>如果世界如此残酷的话 <br><center> 我能做到的就仅仅只有哀<br>",
"<center> 花开似锦 <br><center>花落如缤 <br><center><br><center> 优雅无暇,飘然起舞 <br><center>只愿交口相传能延续<br><center><br><center> 花之都市,尽在于此 <br><center>如画般的景致就在这里<br>",
"<center> 风拂过的彼岸 <br><center>早已忘却的昔日风景叠印忽现<br><center> 最后却仍是留下凋零一幕<br>",
"<center> 花看半开 酒饮微醉</center>"];
document.getElementById("onePoem").innerHTML=st[Math.floor((Math.random()*38))];
}
function initMobile(width){
console.log("This is mobile phone or the width less than 870px");
document.getElementById("topMenu").remove();
if(width<want_width) Home.style="width:100%";
else Home.style="width:"+want_width+"px;";
document.getElementById("topMenuSearch2").style="display:block";
doFuckingThings();
document.getElementById("onePoemTitle").remove();
document.getElementById("onePoem").remove();
}
/*首页和非首页公用*/
var nowUrl=window.location.pathname,is_user_name=0;
console.log(nowUrl);
var titlePage=document.getElementById("titlePage");
var marginTop=document.createElement("style");
marginTop.type="text/css";
var titlePageHeight=document.createElement("style");
titlePageHeight.type="text/css";
var userNameStyle=document.createElement("style");
userNameStyle.type="text/css";
/*预处理*/
document.getElementById("mainContent").style="width:100% !important;padding-left:25px !important;padding-right:25px !important;";
/*home width*/
var home_min_width;
if(nowUrl=="/"+USERNAME+"/"||nowUrl=="/"+USERNAME) home_min_width=830;
else home_min_width=770;
let width=document.body.clientWidth;
var want_width=Math.max(home_min_width,Math.floor(width*0.7));
console.log("want 70% of width is: "+want_width+"and the width: "+width);
var Home=document.getElementById("home"),TopMenuMain=document.getElementById("topMenuMain");
let agent = navigator.userAgent.toLowerCase();
if( (/android/.test(agent) && /mobile/.test(agent)) || (/iphone|ipod/.test(agent) && /mobile/.test(agent)) ) initMobile(width);
else if(width<870) initMobile(width);
else initPc(width);
/*****************************************************************/
/*******************************************************************************************/
</script>
<script>
/*If you want to hide something when you are on it's bottom, you should go to the top at first*/
function gotoPosition(el){//let the top of el in the middle of the screen
// console.log(el);
let pos=el.offsetTop;
//if el is visile, don't do anything
if(pos>=document.documentElement.scrollTop && pos<=document.documentElement.scrollTop+document.documentElement.clientHeight) return;
pos-=document.documentElement.clientHeight/2;
if(pos<0) pos=0;
document.documentElement.scrollTop=pos;
}
/**************Hide and Show For the Sidebar*************/
function hideAndShow(){
console.log(this);
let tmp=this.parentElement.childNodes;
let show=2;
// for(let i=0;i<tmp.length;i++)if(tmp[i].className=="ShowAndHideButton"||tmp[i].className=="AlwaysHideButton"){
// if(tmp[i].value=="Show") tmp[i].value="Hide",show=1;
// else if(tmp[i].value=="Hide") tmp[i].value="Show",show=0;
// else show=0;//alwaysHide
// break;
// }
if(this.value=="Show") this.value="Hide",show=1;
else if(this.value=="Hide") show=0,this.value="Show";//className == "ShowAndHideButton"
else{//className == "AlwaysHideButton"
console.log("hide it");
show=0;
gotoPosition(this.parentElement);
for(let i=0;i<tmp.length;i++)if(tmp[i].className=="ShowAndHideButton"){
tmp[i].value="Show";
break;
}
}
if(show==2){
console.log("Erro! Unable to get button properties(Hide or Show)");
console.log(this);
return;
}
for(let i=0;i<tmp.length;i++)if(tmp[i].className!="ShowAndHideButton"&&tmp[i].tagName){
if(show) tmp[i].style.display="block";
else{
tmp[i].style.display="none";
}
}
// console.log(div_);
// if(div_.style.display=="block"){
// div_.style.display="none";
// this.innerHTML="Show";
// }
// else{
// div_.style.display="block";
// this.innerHTML="Hide";
// }
}
let button_,div_;
let hide=document.getElementsByClassName("hide_at_first");
for(let i=0;i<hide.length;i++){
button_=document.createElement("input");
button_.type="button";
button_.value="Hide";
button_.classList.add("ShowAndHideButton");
console.log("hide[i]: "+hide[i]);
hide[i].insertAdjacentHTML("afterbegin",button_.outerHTML);
// button_=document.createElement("input");
// button_.type="button";
// button_.value="Hide ⇧";
// button_.classList.add("AlwaysHideButton");
// hide[i].insertAdjacentHTML("beforeend",button_.outerHTML);
button_=document.createElement("button");
button_.classList.add("AlwaysHideButton");
button_.innerHTML="Hide ⇧";
hide[i].insertAdjacentHTML("beforeend",button_.outerHTML);
}
let show=document.getElementsByClassName("show_at_first");
for(let i=0;i<show.length;i++){
button_=document.createElement("input");
button_.type="button";
button_.value="Hide";
button_.classList.add("ShowAndHideButton");
show[i].insertAdjacentHTML("afterbegin",button_.outerHTML);
// button_=document.createElement("input");
// button_.type="button";
// button_.value="Hide ⇧";
// button_.classList.add("AlwaysHideButton");
// show[i].insertAdjacentHTML("beforeend",button_.outerHTML);
button_=document.createElement("button");
button_.classList.add("AlwaysHideButton");
button_.innerHTML="Hide ⇧";
show[i].insertAdjacentHTML("beforeend",button_.outerHTML);
}
for(let el of document.querySelectorAll('.ShowAndHideButton')){
el.onclick=hideAndShow;
if(el.parentElement.className=="hide_at_first") el.onclick();
}
for(let el of document.querySelectorAll('.AlwaysHideButton')){
el.onclick=hideAndShow;
}
</script>
<script>
window.onresize=function(){
let width_now=document.body.clientWidth;
if(width_now<want_width) Home.style="width:100%;",TopMenuMain.style="width:100%";
else Home.style="width:"+want_width+"px;",TopMenuMain.style="width:"+want_width+"px;";
if(Math.max(home_min_width,Math.floor(width_now*0.7))>want_width) want_width=Math.max(home_min_width,Math.floor(width_now*0.7));
// console.log("now,want_width is : "+want_width);
}
</script>
<script>
var topMenu=document.getElementById("topMenu"),now,last=0,type=0;
//type=0 表示顶部菜单为链接,1 代表为标题
window.onscroll=function(){
now=document.documentElement.scrollTop||document.body.scrollTop;
if(now>last&&!type){/*向上*/
setTimeout(function(){
type=1;
topMenu.style.transform="translateY(-55px)";
if(!is_user_name) topMenu.style.height="110px";
},130);
}
else if(now<last&&type){/*向下*/
setTimeout(function(){
type=0;
topMenu.style.transform="translateY(0px)";
topMenu.style.height="55px";
},130);
}
last=now;
}
</script>
<script>
/*弹出和关闭menu*/
function getMenu(){
var menuList=document.getElementById("menuList");
var menus=document.getElementById("menus");
var menus2=document.getElementById("menus2");
if(menus.style.display=="block"){
menus.style.display="none";
menus2.style.display="block";
menuList.style.width="250px";
menuList.style.paddingLeft="10px";
}
else{
menus.style.display="block";
menus2.style.display="none";
menuList.style.width="0px";
menuList.style.paddingLeft="0px";
}
}
/*离开当前页面时,关闭menu*/
document.addEventListener("visibilitychange", function(){
if(document.hidden){
if(document.getElementById("menus2").style.display=="block") getMenu();
}
});
</script>
<script>
</script>
<script>
/*将侧边栏复制到menu里*/
$(document).ready(function(){
$("#myBlogStats").html($(".blogStats").html());
$("#myMenu").html($("#sideBarMain").html());
$("#others").html($("#footer").html());
});
</script>
<script>
/*时间*/
function getTime(){
let date=new Date();
let x=date.getTime();
date=new Date(STARTY,STARTM,STARTD);
let beginTime=date.getTime();
x=x-beginTime;
x=Math.floor(x/1000);
let sec=x%60;
x=Math.floor(x/60);
let min=x%60;
x=Math.floor(x/60);
let hour=x%24;
x=Math.floor(x/24);
let day=x;
let htmlDate=document.getElementById("date");
htmlDate.innerHTML="This blog has running: "+day+" days "+hour+" hours "+min+" minutes "+sec+" seconds"
}
setInterval("getTime()", 500);
</script>