feat(frontend): align single related/prevnext/maxheight with Zibll

Honor prevnext/authordesc/yiyan settings, multi-tax related queries with
orderby (incl. views), per-post maxheight override, and only expand content
when maxheight is enabled.
This commit is contained in:
kate522 committed 2026-07-11 21:46:33 +08:00
1 parent 32800ac2fd
commit 69bed0f068
8 files changed
+234 -40

No files matched your search

@@ -104,6 +104,8 @@ export const pageSchema = {
{ label: '随机', value: 'rand' },
{ label: '相关度', value: 'relevance' },
{ label: '时间', value: 'date' },
{ label: '浏览量', value: 'views' },
{ label: '更新时间', value: 'modified' },
], dependsOn: { key: 'post_related_enabled', value: true } },
{ key: 'post_related_title', label: '推荐标题', type: 'input', default: '相关推荐', dependsOn: { key: 'post_related_enabled', value: true } },
],
@@ -434,3 +434,41 @@ html.dark .article-end-separator span {
}
}
/* ===== Related list (Zibll-like) ===== */
.relates .title-theme,
.related-box .title-theme {
font-size: 14px;
font-weight: 700;
margin: 0 0 8px;
}
.related-list,
.relates ul.no-thumb {
list-style: none;
margin: 0;
padding: 4px 0 8px;
}
.related-list li,
.relates ul.no-thumb li {
padding: 8px 0;
border-bottom: 1px solid var(--color-line);
}
.related-list li:last-child,
.relates ul.no-thumb li:last-child {
border-bottom: none;
}
.related-list a,
.relates ul.no-thumb a {
color: var(--color-ink);
text-decoration: none;
font-size: 14px;
}
.related-list a:hover,
.relates ul.no-thumb a:hover {
color: var(--color-primary);
}
.post-nav-box.is-empty,
.post-nav-box__item.is-empty {
visibility: hidden;
}
+9 -5
View File
@@ -190,15 +190,19 @@
}
function initContentExpand() {
var defaultMaxHeight = 800;
document.querySelectorAll('.entry-content[data-nav]').forEach(function (content) {
if (content.dataset.aksrtExpandBound === '1') return;
content.dataset.aksrtExpandBound = '1';
var customMax = parseInt(content.dataset.maxHeight || '0', 10);
var limit = customMax > 0 ? customMax : defaultMaxHeight;
if (content.scrollHeight <= limit) return;
// Only expand when server enabled maxheight (data-maxheight > 0).
var customMax = parseInt(content.getAttribute('data-maxheight') || content.dataset.maxheight || '0', 10);
if (!(customMax > 0)) return;
var limit = customMax;
if (content.scrollHeight <= limit) {
content.classList.remove('limit-height');
content.style.maxHeight = '';
return;
}
content.classList.add('limit-height');
content.style.maxHeight = limit + 'px';