feat(frontend): replace lazy loading with zibll lazysizes
This commit is contained in:
1 parent
02571eecd6
commit
435ee1daa7
78 files changed
+1515
-909
No files matched your search
+11
-12
@@ -1243,7 +1243,7 @@ if (!function_exists('aksrt_render_paid_gallery')) {
|
||||
<div class="swiper-wrapper">
|
||||
<?php foreach ($images as $img_url) : ?>
|
||||
<div class="swiper-slide">
|
||||
<img src="<?php echo esc_url($img_url); ?>" alt="" loading="lazy">
|
||||
<img<?php echo aksrt_get_lazy_attr('lazy_other', (string) $img_url, '', aksrt_get_lazy_thumb('lg')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="">
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
@@ -1255,7 +1255,7 @@ if (!function_exists('aksrt_render_paid_gallery')) {
|
||||
<!-- 未付费:仅首图模糊预览,不输出完整图库 URL 列表 -->
|
||||
<div class="aksrt-paid-gallery__locked">
|
||||
<div class="aksrt-paid-gallery__preview">
|
||||
<img src="<?php echo esc_url((string) $images[0]); ?>" alt="" class="aksrt-gallery-locked" loading="lazy">
|
||||
<img<?php echo aksrt_get_lazy_attr('lazy_other', (string) $images[0], 'aksrt-gallery-locked', aksrt_get_lazy_thumb('lg')); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> alt="">
|
||||
</div>
|
||||
<div class="aksrt-paid-gallery__overlay">
|
||||
<i class="fas fa-images" aria-hidden="true"></i>
|
||||
@@ -1316,16 +1316,15 @@ if (!function_exists('aksrt_render_paid_video')) {
|
||||
<div class="aksrt-paid-video" data-post-id="<?php echo esc_attr((string) $post->ID); ?>">
|
||||
<?php if ($has_access) : ?>
|
||||
<!-- 已付费:视频播放器 -->
|
||||
<div class="aksrt-paid-video__player">
|
||||
<?php if (preg_match('/\.(mp4|webm|ogg)$/i', $video_url)) : ?>
|
||||
<video controls preload="metadata" style="width:100%;border-radius:var(--radius-lg);">
|
||||
<source src="<?php echo esc_url($video_url); ?>">
|
||||
<?php esc_html_e('您的浏览器不支持视频播放。', 'aksrt'); ?>
|
||||
</video>
|
||||
<?php else : ?>
|
||||
<div class="aksrt-paid-video__embed">
|
||||
<iframe src="<?php echo esc_url($video_url); ?>" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
<div class="aksrt-paid-video__player">
|
||||
<?php if (preg_match('/\.(mp4|webm|ogg)$/i', $video_url)) : ?>
|
||||
<video controls preload="metadata"<?php echo aksrt_is_lazy('lazy_posts_content') ? ' class="lazyload" src="" data-src="' . esc_url($video_url) . '"' : ' src="' . esc_url($video_url) . '"'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> style="width:100%;border-radius:var(--radius-lg);">
|
||||
<?php esc_html_e('您的浏览器不支持视频播放。', 'aksrt'); ?>
|
||||
</video>
|
||||
<?php else : ?>
|
||||
<div class="aksrt-paid-video__embed">
|
||||
<iframe<?php echo aksrt_is_lazy('lazy_posts_content') ? ' class="lazyload" src="" data-src="' . esc_url($video_url) . '"' : ' src="' . esc_url($video_url) . '"'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?> frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
|
||||
Reference in new issue
Block a user