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:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user