前即可 -->
// 页面加载完成后执行所有逻辑
window.onload = function() {
// 第一步:触发灵动岛显示动画
triggerIsland();
// 第二步:根据当前页面类型,显示对应的文案
let title;
const currentUrl = window.location.pathname;
const targetDom = document.querySelector('.bars p');
if(!targetDom) return; // 容错:如果找不到目标元素,直接退出
if (currentUrl.includes('/message/')) {
// 访问消息页面
targetDom.innerText = "正在访问消息页面";
} else if (currentUrl.includes('/user/')) {
// 访问用户中心页面
targetDom.innerText = "欢迎来到用户中心";
} else if (document.body.classList.contains('home') || document.body.classList.contains('front-page')) {
// 网站首页 - 修复原代码引号冲突+HTML标签渲染失效问题
targetDom.innerHTML = '欢迎来到微生之最';
} else if (document.body.classList.contains('single')) {
// 单篇文章页面 - 自动获取当前页面的标题
title = document.title;
targetDom.innerText = "正在访问:" + title;
} else if (document.body.classList.contains('category')) {
// 分类页面 - 自动获取页面标题作为分类名
title = document.title;
targetDom.innerText = "正在访问:" + title + " 分类";
} else if (document.body.classList.contains('page')) {
// 独立页面
title = document.title;
targetDom.innerText = "正在访问:" + title;
} else {
// 默认兜底文案
targetDom.innerText = "欢迎来到微生之最";
}
};
// 触发灵动岛显示:添加激活样式+显示透明度
function triggerIsland() {
const island = document.getElementById('dynamicIsland');
if (island) {
island.style.opacity = 1;
island.classList.add('active');
island.classList.remove('inactive');
// 4秒后自动执行关闭动画
setTimeout(() => {
closeIsland();
}, 4000);
}
}
// 灵动岛关闭动画:添加关闭样式+延迟透明隐藏(和CSS动画时长匹配600ms)
function closeIsland() {
const island = document.getElementById('dynamicIsland');
if (island) {
island.classList.remove('active');
island.classList.add('inactive');
setTimeout(() => {
island.style.opacity = 0;
}, 600);
}
}
/*文章外部随机彩色*/
var links = document.querySelectorAll('.item-tags a');
for (var i = 0; i < links.length; i++) {
var randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);
links[i].style.backgroundColor = randomColor;
}
//动态标题
var OriginTitile = document.title,
titleTime;
document.addEventListener("visibilitychange",
function() {
if (document.hidden) {
document.title = "你别走吖 Σ(っ °Д °;)っ";
clearTimeout(titleTime)
} else {
document.title = "(/≧▽≦/)你又回来啦! " ;
titleTime = setTimeout(function() {
document.title = OriginTitile
},
2000)
}
});
(function() {
// 保存原始的 console.log 方法
const originalLog = console.log;
// 重写 console.log
console.log = function(...args) {
// 将日志参数拼接成字符串,检查是否包含目标关键词
const logContent = args.join('');
if (logContent.includes('https://zibll.com')) {
return; // 匹配到目标日志,直接拦截不输出
}
// 其他日志正常输出
originalLog.apply(console, args);
};
})();
//进度条加载显示
$(window).scroll(function() {
var a = $(window).scrollTop(),
c = $(document).height(),
b = $(window).height();
scrollPercent = a / (c - b) * 100;
scrollPercent = scrollPercent.toFixed(1);
$("#percentageCounter").css({
width: scrollPercent + "%"
});
}).trigger("scroll");
zi13天前0
前段时间刚看完缤纷云,然后这篇文章被我刷到了。不绑备案域名,上面的资源就是强制下载,不能当图床了。看了眼那公告,就放弃它了。域名还没备案呀ε=(´ο`*)))唉webdesign service dortmund13天前0
such an indepth and professional article, i enjoy it, you can visit my page, the best webdesign agency in dortmund Germany https://webdesignagenturdortmund.de/ top webdesigners. Thank yousainoa 2个月前0
支持大神!用户29226036 2个月前0
好东西,学习一下!xiaoli 2个月前0
这么厉害吗vjhhgf 4个月前0
thanks