feat(frontend): replace lazy loading with zibll lazysizes

This commit is contained in:
kate522 committed 2026-08-18 01:33:38 +08:00
1 parent 02571eecd6
commit 435ee1daa7
78 files changed
+1515 -909

No files matched your search

+9 -9
View File
@@ -88,12 +88,9 @@ if (!function_exists('aksrt_render_comment_smilie')) :
if (!isset($map[$lookup])) {
return '[g=' . esc_html($raw) . ']';
}
return sprintf(
'<img class="smilie-icon" src="%1$s" alt="%2$s" title="%2$s" width="30" height="30" loading="lazy" decoding="async" data-smilie="%3$s" />',
esc_url($map[$lookup]),
esc_attr('[' . $lookup . ']'),
esc_attr($lookup)
);
$label = esc_attr('[' . $lookup . ']');
return '<img' . aksrt_get_lazy_attr('lazy_comment', (string) $map[$lookup], 'smilie-icon', aksrt_get_lazy_thumb('sm'))
. ' alt="' . $label . '" title="' . $label . '" width="30" height="30" decoding="async" data-smilie="' . esc_attr($lookup) . '">';
}
endif;
@@ -103,9 +100,12 @@ if (!function_exists('aksrt_render_comment_content')) :
*/
function aksrt_render_comment_content(string $content): string {
// [img=url]
$rendered = preg_replace(
$rendered = preg_replace_callback(
'/\[img=(https?:\/\/[^\s\[\]]+)\]/i',
'<img class="box-img comment-inline-img" src="$1" alt="' . esc_attr__('评论图片', 'aksrt') . '" loading="lazy" decoding="async" />',
static function (array $matches): string {
return '<img' . aksrt_get_lazy_attr('lazy_comment', (string) $matches[1], 'box-img comment-inline-img', aksrt_get_lazy_thumb('lg'))
. ' alt="' . esc_attr__('评论图片', 'aksrt') . '" decoding="async">';
},
$content
);
// [code]...[/code]
@@ -134,7 +134,7 @@ if (!function_exists('aksrt_render_comment_content')) :
'title' => true,
'width' => true,
'height' => true,
'loading' => true,
'data-src' => true,
'decoding' => true,
'data-smilie' => true,
'data-src' => true,
+1 -1
View File
@@ -45,7 +45,7 @@ if (!function_exists('aksrt_get_input_expand_but')) :
$map = function_exists('aksrt_comment_smilie_map') ? aksrt_comment_smilie_map() : [];
$icons = '';
foreach ($map as $key => $url) {
$icons .= '<a class="smilie-icon" href="javascript:;" data-smilie="' . esc_attr((string) $key) . '"><img src="' . esc_url($url) . '" alt="[' . esc_attr((string) $key) . ']" width="28" height="28" loading="lazy" /></a>';
$icons .= '<a class="smilie-icon" href="javascript:;" data-smilie="' . esc_attr((string) $key) . '"><img' . aksrt_get_lazy_attr('lazy_comment', (string) $url, '', aksrt_get_lazy_thumb('sm')) . ' alt="[' . esc_attr((string) $key) . ']" width="28" height="28"></a>';
}
$but = '<a class="but btn-input-expand input-smilie mr6" href="javascript:;" data-toggle-class="open" data-target=".dropdown-smilie-wrap" title="' . esc_attr__('表情', 'aksrt') . '"><i class="fa fa-fw fa-smile-o" aria-hidden="true"></i><span class="hide-sm">' . esc_html__('表情', 'aksrt') . '</span></a>';
$drop = '<div class="dropdown-smilie-wrap relative dropup"><div class="dropdown-smilie scroll-y mini-scrollbar dropdown-menu">' . $icons . '</div></div>';