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

+4 -4
View File
@@ -148,7 +148,7 @@ if (!function_exists('aksrt_header_user_box_html')) :
if ($user_id > 0) {
$user = $ctx['current_user'] instanceof WP_User ? $ctx['current_user'] : wp_get_current_user();
$display_name = $user->display_name ?: $user->user_login;
$avatar = get_avatar($user_id, 44, '', esc_attr($display_name), ['loading' => 'lazy']);
$avatar = aksrt_get_avatar_html($user_id, 44, ['alt' => $display_name]);
$desc = (string) ($ctx['user_desc'] ?? '');
$vip_badge = function_exists('aksrt_render_vip_badge') ? aksrt_render_vip_badge($user_id, 'sm') : '';
// Level and certification icons ride inline to the right of the display name.
@@ -167,7 +167,7 @@ if (!function_exists('aksrt_header_user_box_html')) :
$icon_url = esc_url((string) ($signal['icon_url'] ?? ''));
$title = (string) ($signal['title'] ?? $signal['label'] ?? '');
if ($icon_url !== '' && $title !== '') {
$certification_badge = '<img class="aksrt-identity-certification-icon img-icon ml3" src="' . $icon_url . '" alt="" title="' . esc_attr($title) . '" loading="lazy" decoding="async" />';
$certification_badge = '<img' . aksrt_get_lazy_attr('lazy_other', $icon_url, 'aksrt-identity-certification-icon img-icon ml3') . ' alt="" title="' . esc_attr($title) . '" decoding="async">';
}
break;
}
@@ -329,7 +329,7 @@ if (!function_exists('aksrt_menu_button')) :
$user_sub = '<div class="padding-10">' . aksrt_header_user_box_html($ctx) . '</div>';
if ('2' === $layout) {
if ($user_id > 0) {
$avatar = get_avatar($user_id, 36, '', '', ['loading' => 'lazy', 'class' => 'avatar']);
$avatar = aksrt_get_avatar_html($user_id, 36, ['class' => 'avatar']);
$sign_but = '<li><a href="javascript:;" class="navbar-avatar">' . $avatar . '</a><ul class="sub-menu">'
. $user_sub . '</ul></li>';
} else {
@@ -340,7 +340,7 @@ if (!function_exists('aksrt_menu_button')) :
}
} else {
$trigger = $user_id > 0
? get_avatar($user_id, 36, '', '', ['loading' => 'lazy'])
? aksrt_get_avatar_html($user_id, 36)
: '<i class="fas fa-user" aria-hidden="true"></i>';
$cls = $user_id > 0 ? 'navbar-avatar' : 'btn signin-loader';
$dot = ($user_id > 0 && (int) ($ctx['unread_count'] ?? 0) > 0)