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:
2026-07-11 21:46:33 +08:00
parent 32800ac2fd
commit 69bed0f068
8 changed files with 234 additions and 40 deletions
+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';