diff --git a/assets/admin/src/schema/sections/post-list/page.js b/assets/admin/src/schema/sections/post-list/page.js index 7ab6a0eb..7441df17 100644 --- a/assets/admin/src/schema/sections/post-list/page.js +++ b/assets/admin/src/schema/sections/post-list/page.js @@ -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 } }, ], diff --git a/assets/css/frontend/single-post/related-toc.css b/assets/css/frontend/single-post/related-toc.css index a880a81c..7bad5ae8 100644 --- a/assets/css/frontend/single-post/related-toc.css +++ b/assets/css/frontend/single-post/related-toc.css @@ -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; +} diff --git a/assets/js/page-template.js b/assets/js/page-template.js index a834182c..a692e227 100644 --- a/assets/js/page-template.js +++ b/assets/js/page-template.js @@ -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'; diff --git a/inc/classes/admin/schema/class-aksrt-admin-schema-post-list.php b/inc/classes/admin/schema/class-aksrt-admin-schema-post-list.php index 3ccf4cf7..80e81be0 100644 --- a/inc/classes/admin/schema/class-aksrt-admin-schema-post-list.php +++ b/inc/classes/admin/schema/class-aksrt-admin-schema-post-list.php @@ -103,6 +103,8 @@ class AKSRT_Admin_Schema_Post_List { ['label' => '随机', 'value' => 'rand'], ['label' => '相关度', 'value' => 'relevance'], ['label' => '时间', 'value' => 'date'], + ['label' => '浏览量', 'value' => 'views'], + ['label' => '更新时间', 'value' => 'modified'], ]], ['key' => 'post_related_title', 'label' => '推荐标题', 'type' => 'input', 'default' => '相关推荐'], ]], diff --git a/inc/classes/class-aksrt-settings.php b/inc/classes/class-aksrt-settings.php index 727cee5d..674de9d0 100644 --- a/inc/classes/class-aksrt-settings.php +++ b/inc/classes/class-aksrt-settings.php @@ -903,7 +903,7 @@ class AKSRT_Settings { $related_type = 'category'; } $related_orderby = sanitize_key((string) ($settings['post_related_orderby'] ?? 'rand')); - if (!in_array($related_orderby, ['rand', 'relevance', 'date'], true)) { + if (!in_array($related_orderby, ['rand', 'relevance', 'date', 'views', 'modified'], true)) { $related_orderby = 'rand'; } diff --git a/inc/classes/settings/class-aksrt-settings-post-display.php b/inc/classes/settings/class-aksrt-settings-post-display.php index be55d823..1c544c56 100644 --- a/inc/classes/settings/class-aksrt-settings-post-display.php +++ b/inc/classes/settings/class-aksrt-settings-post-display.php @@ -221,7 +221,7 @@ class AKSRT_Settings_Post_Display { 'related_enabled' => !isset($settings['post_related_enabled']) || !empty($settings['post_related_enabled']), 'related_count' => max(1, min(20, (int) ($settings['post_related_count'] ?? 6))), 'related_type' => in_array(sanitize_key((string) ($settings['post_related_type'] ?? 'category')), ['category', 'tag', 'random'], true) ? sanitize_key((string) ($settings['post_related_type'] ?? 'category')) : 'category', - 'related_orderby' => in_array(sanitize_key((string) ($settings['post_related_orderby'] ?? 'rand')), ['rand', 'relevance', 'date'], true) ? sanitize_key((string) ($settings['post_related_orderby'] ?? 'rand')) : 'rand', + 'related_orderby' => in_array(sanitize_key((string) ($settings['post_related_orderby'] ?? 'rand')), ['rand', 'relevance', 'date', 'views', 'modified'], true) ? sanitize_key((string) ($settings['post_related_orderby'] ?? 'rand')) : 'rand', 'related_title' => sanitize_text_field((string) ($settings['post_related_title'] ?? '相关推荐')), 'like_enabled' => !isset($settings['post_like_enabled']) || !empty($settings['post_like_enabled']), 'favorite_enabled' => !isset($settings['post_favorite_enabled']) || !empty($settings['post_favorite_enabled']), diff --git a/inc/helpers/aksrt-frontend-tags.php b/inc/helpers/aksrt-frontend-tags.php index 10247222..ff131488 100644 --- a/inc/helpers/aksrt-frontend-tags.php +++ b/inc/helpers/aksrt-frontend-tags.php @@ -231,6 +231,13 @@ if (!function_exists('aksrt_resolve_single_post_display_settings')) : $settings['related_count'] = max(1, min(20, (int) $meta['related_count'])); } + // Per-post maxheight override (Zibll article_maxheight_xz). + $meta_maxheight = (int) ($meta['maxheight'] ?? 0); + if ($meta_maxheight > 0) { + $settings['maxheight_enabled'] = true; + $settings['maxheight'] = $meta_maxheight; + } + $cover_mode = (string) ($meta['header_image_mode'] ?? ''); $cover_url = ''; $cover_type = 'none'; diff --git a/inc/helpers/aksrt-single.php b/inc/helpers/aksrt-single.php index 1d75c9f4..2bb05e26 100644 --- a/inc/helpers/aksrt-single.php +++ b/inc/helpers/aksrt-single.php @@ -288,7 +288,12 @@ if (!function_exists('aksrt_single_render_box_header')) :

- + true, @@ -480,79 +485,203 @@ endif; if (!function_exists('aksrt_single_render_prevnext')) : /** * Previous / next navigation. + * + * @param array $ctx Single context. */ - function aksrt_single_render_prevnext(): void { + function aksrt_single_render_prevnext(array $ctx = []): void { + $settings = is_array($ctx['settings'] ?? null) ? $ctx['settings'] : []; + // Accept both canonical `prevnext` (Settings DTO) and legacy `prevnext_s`. + $enabled = array_key_exists('prevnext', $settings) + ? !empty($settings['prevnext']) + : (!array_key_exists('prevnext_s', $settings) || !empty($settings['prevnext_s'])); + if (!$enabled) { + return; + } + $prev = get_previous_post(); $next = get_next_post(); if (!$prev && !$next) { return; } ?> -