修复若干bug
This commit is contained in:
1 parent
94855a49bf
commit
21fa47801b
14 files changed
+69
-130
No files matched your search
@@ -25,55 +25,6 @@
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
// 配置:友链数据源地址 (与 new-links-lite.html 保持一致)
|
||||
// 1. 本地模块模式:使用 '/json/link_lite.json' (默认)
|
||||
// 2. 远程模式:修改为您的 GitHub + jsDelivr 链接
|
||||
const linksJsonUrl = '/json/link_lite.json';
|
||||
|
||||
const container = document.getElementById('links-container');
|
||||
if (!container) return;
|
||||
|
||||
fetch(linksJsonUrl)
|
||||
.then(response => {
|
||||
if (!response.ok) throw new Error('Network response was not ok');
|
||||
return response.json();
|
||||
})
|
||||
.then(data => {
|
||||
if (data && Array.isArray(data) && data.length > 0) {
|
||||
// 清空现有的静态内容,使用动态数据
|
||||
container.innerHTML = '';
|
||||
|
||||
data.forEach(item => {
|
||||
const div = document.createElement('div');
|
||||
div.className = 'item-box';
|
||||
div.innerHTML = `
|
||||
<div class="website-img">
|
||||
<img src="https://s0.wp.com/mshots/v1/${item.url}?w=800&h=600" alt="${item.name}">
|
||||
</div>
|
||||
<div class="link-info">
|
||||
<div class="link-avatar">
|
||||
<img src="${item.image}" alt="${item.name}">
|
||||
</div>
|
||||
<div class="link-des">
|
||||
<div class="link-name">${item.name}</div>
|
||||
<div class="link-des" style="color: #64748B;">${item.description || ''}</div>
|
||||
</div>
|
||||
</div>
|
||||
<a href="${item.url}" target="_blank">
|
||||
<div class="website-go-button">逛一逛</div>
|
||||
</a>
|
||||
`;
|
||||
container.appendChild(div);
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
console.warn('友链动态加载失败,回退到静态内容:', error);
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
<!-- 移除动态加载脚本,仅保留静态生成内容 -->
|
||||
</div>
|
||||
{{ end }}
|
||||
Reference in new issue
Block a user