添加博客跳转

This commit is contained in:
chicrobot committed 2025-11-21 01:30:02 +08:00
1 parent bf80cc9150
commit 816caaae5b
2 files changed
+21 -3

No files matched your search

+18
View File
@@ -53,6 +53,9 @@ window.addEventListener('load', function() {
const jenkinsUrl = `${window.location.protocol}//${currentHost}:9095`;
const chatUrl = `${window.location.protocol}//${currentHost}/baseTalk`;
const cloudreveUrl = `${window.location.protocol}//${currentHost}:5212`;
// 构建博客文章URL,指向8090端口
const blogBaseUrl = `${window.location.protocol}//${currentHost}:8090`;
// 设置链接的href属性和target属性,确保在新标签中打开
const portainerLink = document.getElementById('portainerLink');
const giteaLink = document.getElementById('giteaLink');
@@ -60,6 +63,7 @@ window.addEventListener('load', function() {
const jenkinsLink = document.getElementById('jenkinsLink');
const chatLink = document.getElementById('chatLink');
const cloudreveLink = document.getElementById('cloudreveLink');
if (portainerLink) {
portainerLink.href = portainerUrl;
portainerLink.target = '_blank';
@@ -84,6 +88,20 @@ window.addEventListener('load', function() {
cloudreveLink.href = cloudreveUrl;
cloudreveLink.target = '_blank';
}
// 处理博客文章链接
const blogPosts = document.querySelectorAll('.thought-card');
blogPosts.forEach((post, index) => {
// 移除原有的onclick属性
post.removeAttribute('onclick');
// 添加新的点击事件监听器
post.addEventListener('click', function() {
// const postPath = `/blog/post${index + 1}`;
// const postUrl = `${blogBaseUrl}${postPath}`;
const postUrl = `${blogBaseUrl}`;
window.open(postUrl, '_blank');
});
});
});
// 粒子背景效果