refactor(modal): remove legacy compatibility paths

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 00:06:37 +08:00
co-authored by Claude Fable 5
parent bdfe3a461d
commit 34150f3358
18 changed files with 188 additions and 380 deletions
+2 -2
View File
@@ -152,7 +152,7 @@ trait VipServiceModal {
}
$html = '<div class="box-body payvip-modal" data-aksrt-vip-modal>';
$html .= '<button type="button" class="close aksrt-vip-modal-close" aria-label="Close">&times;</button>';
$html .= '<button type="button" class="aksrt-modal-close" data-aksrt-modal-close aria-label="Close">&times;</button>';
$html .= '<ul class="list-inline user-box flex ac mb10"><li class="avatar-img">' . $avatar . '</li>';
$html .= '<li><b class="em12">' . esc_html($name) . '</b>';
if ($desc !== '') {
@@ -232,7 +232,7 @@ trait VipServiceModal {
}
$html = '<div class="box-body payvip-modal" data-aksrt-vip-modal>';
$html .= '<button type="button" class="close aksrt-vip-modal-close" aria-label="Close">&times;</button>';
$html .= '<button type="button" class="aksrt-modal-close" data-aksrt-modal-close aria-label="Close">&times;</button>';
$html .= '<ul class="list-inline user-box flex ac mb10"><li class="avatar-img">' . $avatar . '</li>';
$html .= '<li><b class="em12">' . esc_html($name) . '</b>';
$html .= '<div class="muted-2-color em09"><span class="badg c-yellow vip-expdate-tag">'
+3 -3
View File
@@ -130,7 +130,7 @@ trait ScriptsPart1b {
}
// 4a-b. 全局补充样式(骨架屏、空状态、分页、加载指示器)
foreach (['skeleton', 'empty-state', 'pagination', 'ajax-spinner', 'remote-modal'] as $slug) {
foreach (['skeleton', 'empty-state', 'pagination', 'ajax-spinner', 'modal-runtime'] as $slug) {
$css_path = get_template_directory() . '/assets/css/frontend/' . $slug . '.css';
if (file_exists($css_path)) {
wp_enqueue_style(
@@ -894,7 +894,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
wp_enqueue_script(
'aksrt-user-badges',
$base_uri . '/assets/js/user-badges.js',
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-remote-modal'],
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-modal-triggers'],
(string) filemtime($badges_js_path),
true
);
@@ -917,7 +917,7 @@ $hmb_js = get_template_directory() . '/assets/js/header-newadd.js';
wp_enqueue_script(
'aksrt-user-badges',
$base_uri . '/assets/js/user-badges.js',
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-remote-modal'],
['aksrt-script', 'aksrt-core-request', 'aksrt-core-modal-runtime', 'aksrt-core-modal-triggers'],
(string) filemtime($badges_js_path_global),
true
);
+3 -3
View File
@@ -101,7 +101,7 @@ trait ScriptsPart1c {
true
);
// Runtime infrastructure: tbquire / notyf / confirm / refreshModal / scrollTopTo / [data-*] declarative
// Runtime infrastructure: tbquire / notyf / confirm / scrollTopTo / [data-*] declarative
$runtime_js = get_template_directory() . '/assets/js/aksrt-runtime.js';
if (file_exists($runtime_js)) {
wp_enqueue_script(
@@ -132,7 +132,7 @@ trait ScriptsPart1c {
'aksrt-core-modal-cache' => 'modal-cache.js',
'aksrt-core-modal-state' => 'modal-state.js',
'aksrt-core-modal-runtime' => 'modal-runtime.js',
'aksrt-core-remote-modal' => 'remote-modal.js',
'aksrt-core-modal-triggers' => 'modal-triggers.js',
'aksrt-core-pagination' => 'pagination.js',
'aksrt-core-archive' => 'archive.js',
'aksrt-core-footer-tabbar' => 'footer-tabbar.js',
@@ -153,7 +153,7 @@ trait ScriptsPart1c {
'aksrt-core-modal-cache',
'aksrt-core-modal-state',
]);
} elseif ($handle === 'aksrt-core-remote-modal') {
} elseif ($handle === 'aksrt-core-modal-triggers') {
$deps[] = 'aksrt-core-modal-runtime';
}
wp_enqueue_script(
+1 -1
View File
@@ -276,7 +276,7 @@ class Signin {
$html .= '<div class="aksrt-checkin-modal__head">';
$html .= '<i class="fa fa-calendar-check-o" aria-hidden="true"></i>';
$html .= '<strong>' . esc_html__('签到领奖励', 'aksrt') . '</strong>';
$html .= '<button type="button" class="aksrt-remote-modal__close" data-aksrt-remote-modal-close aria-label="' . esc_attr__('关闭', 'aksrt') . '">&times;</button>';
$html .= '<button type="button" class="aksrt-modal-runtime__close" data-aksrt-modal-close aria-label="' . esc_attr__('关闭', 'aksrt') . '">&times;</button>';
$html .= '</div>';
$html .= '<div class="aksrt-checkin-modal__user">';
+10 -10
View File
@@ -30,7 +30,7 @@ class Badges {
public function init(): void {
add_action('rest_api_init', [$this, 'register_routes']);
add_action('aksrt_badge_granted', [$this, 'on_badge_granted_notify'], 10, 3);
// HTML modal for remote-modal (zibll user_medal_info_modal).
// HTML modal for modal runtime (zibll user_medal_info_modal).
add_action('wp_ajax_aksrt_user_badge_info_modal', [$this, 'ajax_info_modal']);
add_action('wp_ajax_nopriv_aksrt_user_badge_info_modal', [$this, 'ajax_info_modal']);
add_action('wp_ajax_aksrt_single_badge_info_modal', [$this, 'ajax_single_info_modal']);
@@ -102,8 +102,8 @@ class Badges {
* Badge list modal HTML (zibll zib_get_user_medal_info_modal parity).
*
* Head (avatar + owner + worn medal) + category-grouped medal card grid.
* Each card deep-links into the single badge modal via the remote-modal
* contract (data-toggle="AksrtRemoteModal" + data-remote).
* Each card deep-links into the single badge modal via the modal runtime
* contract (data-aksrt-modal="remote" + data-aksrt-modal-url).
*/
public static function render_info_modal_html(int $user_id): string {
$user = get_userdata($user_id);
@@ -134,7 +134,7 @@ class Badges {
}
$html = '<div class="medal-modal">';
$html .= '<button type="button" class="aksrt-remote-modal__close" data-aksrt-remote-modal-close aria-label="' . esc_attr__('关闭', 'aksrt') . '">&times;</button>';
$html .= '<button type="button" class="aksrt-modal-runtime__close" data-aksrt-modal-close aria-label="' . esc_attr__('关闭', 'aksrt') . '">&times;</button>';
$html .= '<div class="medal-modal__head">';
$html .= '<img class="medal-modal__avatar" src="' . esc_url((string) $avatar) . '" alt="" width="42" height="42" />';
$html .= '<div class="medal-modal__title"><span class="em09">' . esc_html(sprintf(__('%s的徽章', 'aksrt'), $display)) . '</span>' . $wear_slot . '</div>';
@@ -164,7 +164,7 @@ class Badges {
if (!$is_self && $current > 0) {
$my_url = add_query_arg(['action' => 'aksrt_user_badge_info_modal', 'id' => $current], admin_url('admin-ajax.php'));
$html .= '<div class="medal-modal__buts">';
$html .= '<a class="but c-blue" href="' . esc_url($my_url) . '" data-toggle="AksrtRemoteModal" data-remote="' . esc_url($my_url) . '" data-class="full-sm" mobile-bottom="true"><i class="fas fa-medal" aria-hidden="true"></i> ' . esc_html__('查看我的徽章', 'aksrt') . '</a>';
$html .= '<a class="but c-blue" href="' . esc_url($my_url) . '" data-aksrt-modal="remote" data-aksrt-modal-url="' . esc_url($my_url) . '" data-aksrt-modal-class="full-sm" data-aksrt-modal-mobile-bottom="true"><i class="fas fa-medal" aria-hidden="true"></i> ' . esc_html__('查看我的徽章', 'aksrt') . '</a>';
$html .= '</div>';
}
@@ -204,7 +204,7 @@ class Badges {
admin_url('admin-ajax.php')
);
return '<a class="medal-list" href="' . esc_url($url) . '" data-toggle="AksrtRemoteModal" data-remote="' . esc_url($url) . '" data-class="modal-mini" mobile-bottom="true">' . $card . '</a>';
return '<a class="medal-list" href="' . esc_url($url) . '" data-aksrt-modal="remote" data-aksrt-modal-url="' . esc_url($url) . '" data-aksrt-modal-class="modal-mini" data-aksrt-modal-mobile-bottom="true">' . $card . '</a>';
}
/**
@@ -244,7 +244,7 @@ class Badges {
}
$html = '<div class="medal-modal medal-modal--single">';
$html .= '<button type="button" class="aksrt-remote-modal__close" data-aksrt-remote-modal-close aria-label="' . esc_attr__('关闭', 'aksrt') . '">&times;</button>';
$html .= '<button type="button" class="aksrt-modal-runtime__close" data-aksrt-modal-close aria-label="' . esc_attr__('关闭', 'aksrt') . '">&times;</button>';
$html .= '<div class="medal-single-card">';
$html .= '<div class="medal-single-bg"><img class="fit-cover" src="' . esc_url($bg) . '" alt="" /></div>';
$html .= '<div class="medal-single-main">' . $icon_html;
@@ -263,7 +263,7 @@ class Badges {
// Back to the full badge list modal.
if ($user_id > 0) {
$back_url = add_query_arg(['action' => 'aksrt_user_badge_info_modal', 'id' => $user_id], admin_url('admin-ajax.php'));
$html .= '<a class="medal-modal__back muted-2-color em09" href="' . esc_url($back_url) . '" data-toggle="AksrtRemoteModal" data-remote="' . esc_url($back_url) . '" data-class="full-sm" mobile-bottom="true"><i class="fas fa-angle-left" aria-hidden="true"></i> ' . esc_html__('返回徽章列表', 'aksrt') . '</a>';
$html .= '<a class="medal-modal__back muted-2-color em09" href="' . esc_url($back_url) . '" data-aksrt-modal="remote" data-aksrt-modal-url="' . esc_url($back_url) . '" data-aksrt-modal-class="full-sm" data-aksrt-modal-mobile-bottom="true"><i class="fas fa-angle-left" aria-hidden="true"></i> ' . esc_html__('返回徽章列表', 'aksrt') . '</a>';
}
$html .= '</div>';
@@ -280,7 +280,7 @@ class Badges {
if ($text === null) {
$text = __('徽章明细', 'aksrt');
}
if (!function_exists('aksrt_get_remote_modal_link')) {
if (!function_exists('aksrt_get_modal_link')) {
return '';
}
$url = add_query_arg(
@@ -290,7 +290,7 @@ class Badges {
],
admin_url('admin-ajax.php')
);
return aksrt_get_remote_modal_link([
return aksrt_get_modal_link([
'tag' => 'a',
'class' => trim('user-medal-info ' . $class),
'text' => $text,