feat(frontend): replace lazy loading with zibll lazysizes

This commit is contained in:
2026-08-18 01:33:38 +08:00
parent 02571eecd6
commit 435ee1daa7
78 changed files with 1515 additions and 909 deletions
+4 -2
View File
@@ -115,9 +115,11 @@ if (!function_exists('aksrt_get_avatar_html')) {
'alt' => '',
'width' => (string) $size,
'height' => (string) $size,
'loading' => 'lazy',
];
$attrs = array_merge($defaults, $attrs);
unset($attrs['loading']);
$class = (string) ($attrs['class'] ?? $defaults['class']);
unset($attrs['class']);
$html_attrs = '';
foreach ($attrs as $name => $value) {
$name = sanitize_key((string) $name);
@@ -126,7 +128,7 @@ if (!function_exists('aksrt_get_avatar_html')) {
}
$html_attrs .= ' ' . $name . '="' . esc_attr((string) $value) . '"';
}
return '<img src="' . esc_url($url) . '"' . $html_attrs . ' />';
return '<img' . aksrt_get_lazy_attr('lazy_avatar', $url, $class, aksrt_get_default_avatar_url()) . $html_attrs . '>';
}
}