增加详细卡片页

This commit is contained in:
Ember 2024-08-23 17:01:18 +08:00
parent 051908833f
commit a50ee3e613
12 changed files with 1358 additions and 5 deletions

10
card/page/1/index.html Normal file
View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>http://localhost:1313/card/</title>
<link rel="canonical" href="http://localhost:1313/card/">
<meta name="robots" content="noindex">
<meta charset="utf-8">
<meta http-equiv="refresh" content="0; url=http://localhost:1313/card/">
</head>
</html>

File diff suppressed because it is too large Load Diff

5
card/qimo.html Normal file
View File

@ -0,0 +1,5 @@
{{ define "main" }}
hello!
{{ end }}

445
card/qimo/index.html Normal file

File diff suppressed because it is too large Load Diff

445
card/xuanzeti/index.html Normal file

File diff suppressed because it is too large Load Diff

View File

File diff suppressed because one or more lines are too long

View File

@ -296,5 +296,19 @@ $$
2017-2018学年试卷B 您的设备无法正常显示PDF文件。 点击此处下载。
2016-2017学年试卷B 您的设备无法正常显示PDF文件。 点击此处下载。</description>
</item>
<item>
<title>期末真题合集</title>
<link>https://xn--xhq44jb2fzpc.com/card/qimo/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://xn--xhq44jb2fzpc.com/card/qimo/</guid>
<description></description>
</item>
<item>
<title>选择题题库合集</title>
<link>https://xn--xhq44jb2fzpc.com/card/xuanzeti/</link>
<pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
<guid>https://xn--xhq44jb2fzpc.com/card/xuanzeti/</guid>
<description></description>
</item>
</channel>
</rss>

42
js/cardlist.js Normal file
View File

@ -0,0 +1,42 @@
function createCardSection(containerId, keyword) {
fetch('/index.json')
.then(response => response.json())
.then(data => {
// 筛选文章,排除掉 permalink 包含 /card/ 的内容
const filteredArticles = data.filter(article =>
(article.title.includes(keyword) || article.content.includes(keyword)) &&
!article.permalink.includes('/card/')
);
const articlesContainer = document.getElementById(containerId);
filteredArticles.forEach(article => {
const card = document.createElement('div');
card.className = 'card';
card.onclick = () => window.location.href = article.permalink;
const title = document.createElement('div');
title.className = 'card-title'; // 使用 card-title 避免类名冲突
title.textContent = article.title.length > 30
? article.title.slice(0, 27) + "..."
: article.title;
const summary = document.createElement('div');
summary.className = 'summary';
summary.textContent = article.summary.length > 60
? article.summary.slice(0, 57) + "..."
: article.summary;
card.appendChild(title);
card.appendChild(summary);
articlesContainer.appendChild(card);
});
// 设置网格布局每行显示3个卡片
articlesContainer.style.display = 'grid';
articlesContainer.style.gridTemplateColumns = 'repeat(3, 1fr)';
articlesContainer.style.gap = '16px';
})
.catch(error => console.error('Error loading articles:', error));
}

View File

@ -243,7 +243,7 @@ Edge或Chrome浏览器如果加载不出PDF预览直接右键PDF区域选择
<div class="card-section">
<div class="section-header">
<span class="section-title">期末真题合集</span>
<a href="/search/?searchquery=期末真题" class="view-more">查看更多</a>
<a href="/card/qimo" class="view-more">查看更多</a>
</div>
<div id="qmzt" class="card-container"></div>
</div>
@ -251,7 +251,7 @@ Edge或Chrome浏览器如果加载不出PDF预览直接右键PDF区域选择
<div class="card-section">
<div class="section-header">
<span class="section-title">选择题题库合集</span>
<a href="/search/?searchquery=选择题" class="view-more">查看更多</a>
<a href="/card/xuanzeti" class="view-more">查看更多</a>
</div>
<div id="xzttk" class="card-container"></div>
</div>

Some files were not shown because too many files have changed in this diff Show More