fix(single): align slide and video cover heights with image cover
The image-mode cover reserves +50px for the title/breadcrumb overlay (calc(scale% + 50px)), but the slide cover wrapper was given a bare inline padding-bottom by aksrt_render_slider, permanently defeating the .cover-slide rule, and the video cover used a bare video_scale%. - aksrt_render_slider: add scale_extra so scale mode emits calc(ratio% + extra); the single cover passes 50px so all three modes share one height formula - drop the unreachable static slide fallback and function_exists guard (the helper is unconditionally loaded by inc/bootstrap.php), the always-true cover_url/ep_count conditions, and the dead --scale-ratio and inner swiper padding emitted in scale mode - remove the dead cover CSS cluster with no producer: .single-cover-slide (main.css/main.min.css/cover.css), .single-cover-slider family (components/base.css), .single-cover-slide-wrap and .single-cover__* helpers (cover.css), and initSlideCovers in misc.js - rebuild public bundles via tools/build-public-assets.mjs - add single-cover-height-contract test covering the shared formula and the dead-code removals
This commit is contained in:
1 parent
05a6b6fc54
commit
4f2d17f6ee
12 files changed
+133
-418
No files matched your search
@@ -31,7 +31,7 @@ if (!function_exists('aksrt_single_render_cover')) :
|
||||
?>
|
||||
<div class="single-head-cover">
|
||||
<div class="single-video">
|
||||
<div class="graphic single-cover single-cover--video imgbox-container" style="padding-bottom:<?php echo esc_attr((string) $video_scale); ?>%;">
|
||||
<div class="graphic single-cover single-cover--video imgbox-container" style="padding-bottom:calc(<?php echo esc_attr((string) $video_scale); ?>% + 50px);">
|
||||
<div class="aksrt-video single-cover__player" data-aksrt-video data-src="<?php echo esc_url($ctx['cover_url']); ?>"<?php echo $poster !== '' ? ' data-poster="' . esc_url($poster) . '"' : ''; ?> style="position:absolute;inset:0;width:100%;height:100%;"></div>
|
||||
</div>
|
||||
<div class="single-video-footer dplayer-featured">
|
||||
@@ -41,7 +41,7 @@ if (!function_exists('aksrt_single_render_cover')) :
|
||||
<h1 class="article-title">
|
||||
<?php
|
||||
$episodes = is_array($ctx['video_episodes'] ?? null) ? $ctx['video_episodes'] : [];
|
||||
if ($episodes === [] && !empty($ctx['cover_url'])) {
|
||||
if ($episodes === []) {
|
||||
$episodes = [['url' => (string) $ctx['cover_url'], 'title' => '']];
|
||||
}
|
||||
$ep_count = count($episodes);
|
||||
@@ -53,8 +53,7 @@ if (!function_exists('aksrt_single_render_cover')) :
|
||||
<?php echo $title_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</h1>
|
||||
<?php echo $badge; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php if ($ep_count > 0) : ?>
|
||||
<div class="featured-video-episode mt10">
|
||||
<div class="featured-video-episode mt10">
|
||||
<?php foreach ($episodes as $idx => $ep) :
|
||||
$ep_url = (string) ($ep['url'] ?? '');
|
||||
if ($ep_url === '') { continue; }
|
||||
@@ -67,8 +66,7 @@ if (!function_exists('aksrt_single_render_cover')) :
|
||||
<span class="mr6 badg badg-sm"><?php echo (int) ($idx + 1); ?></span><i class="episode-active-icon"></i><?php echo esc_html($ep_title); ?>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,33 +87,23 @@ if (!function_exists('aksrt_single_render_cover')) :
|
||||
. ($crumbs !== '' ? $crumbs : '')
|
||||
. $badge
|
||||
. '</div>';
|
||||
$slider_html = '';
|
||||
if (function_exists('aksrt_render_slider')) {
|
||||
$slider_html = aksrt_render_slider([
|
||||
'slides' => $slide_items,
|
||||
'scale_height' => true,
|
||||
'scale_ratio' => $img_scale / 100,
|
||||
'wrapper_class' => 'mb20 single-cover-slide imgbox-container',
|
||||
'slider_class' => 'single-cover single-cover--slide',
|
||||
'show_nav' => true,
|
||||
'show_pagination' => true,
|
||||
'loop' => count($slide_items) > 1,
|
||||
'autoplay' => count($slide_items) > 1,
|
||||
'overlay_html' => $overlay,
|
||||
]);
|
||||
}
|
||||
// 与单图封面同一高度公式:calc(比例% + 50px)。
|
||||
$slider_html = aksrt_render_slider([
|
||||
'slides' => $slide_items,
|
||||
'scale_height' => true,
|
||||
'scale_ratio' => $img_scale / 100,
|
||||
'scale_extra' => '50px',
|
||||
'wrapper_class' => 'mb20 single-cover-slide imgbox-container',
|
||||
'slider_class' => 'single-cover single-cover--slide',
|
||||
'show_nav' => true,
|
||||
'show_pagination' => true,
|
||||
'loop' => count($slide_items) > 1,
|
||||
'autoplay' => count($slide_items) > 1,
|
||||
'overlay_html' => $overlay,
|
||||
]);
|
||||
?>
|
||||
<div class="single-head-cover">
|
||||
<?php if ($slider_html !== '') : ?>
|
||||
<?php echo $slider_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php else : ?>
|
||||
<div class="graphic mb20 single-cover single-cover--slide imgbox-container" style="padding-bottom:calc(<?php echo esc_attr((string) $img_scale); ?>% + 50px);">
|
||||
<?php foreach ($slides as $idx => $slide_url) : ?>
|
||||
<img<?php echo aksrt_get_lazy_attr('lazy_sider', (string) $slide_url, 'fit-cover', aksrt_get_lazy_thumb('lg')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="" style="<?php echo $idx === 0 ? '' : 'display:none;'; ?>">
|
||||
<?php endforeach; ?>
|
||||
<?php echo $overlay; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo $slider_html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
</div>
|
||||
<?php
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user