Compare commits
3
Commits
ce6fbb4e39
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5810693e01 | ||
|
|
0722c4f00e | ||
|
|
4f2edebab6 |
+28
-69
@@ -2714,27 +2714,22 @@ main.container,
|
||||
* shell anchoring plus the account action-row geometry.
|
||||
*/
|
||||
|
||||
/* The desktop action cluster owns one horizontal alignment context. */
|
||||
.navbar-top .aksrt-navbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 50px;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions > *,
|
||||
.navbar-top .aksrt-navbar-account,
|
||||
.navbar-top .aksrt-navbar-account > li {
|
||||
/* The reference keeps the right cluster as three floated .navbar-form groups, so
|
||||
* only the account row carries its own alignment context; the button groups
|
||||
* inherit their geometry from .navbar-top .navbar-but .but and .navbar-form. */
|
||||
.navbar-top .aksrt-navbar-account {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
gap: 4px;
|
||||
min-height: 50px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account > li {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
@@ -2747,39 +2742,6 @@ main.container,
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account {
|
||||
gap: 4px;
|
||||
min-height: 50px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account.navbar-text {
|
||||
float: none;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-cta {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
min-height: 29px;
|
||||
margin: 0;
|
||||
padding: .3em 1em !important;
|
||||
border-radius: var(--radius-btn, 4px);
|
||||
font-size: .8em;
|
||||
line-height: 1.44;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-cta.radius {
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-cta > .icon {
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-icon,
|
||||
.navbar-top .aksrt-nav-avatar {
|
||||
display: inline-flex !important;
|
||||
@@ -2812,33 +2774,22 @@ main.container,
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .toggle-radius {
|
||||
.navbar-top .navbar-form .toggle-radius {
|
||||
flex: 0 0 29px;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-language {
|
||||
.navbar-top .navbar-form .aksrt-navbar-language {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Anchor the VIP preview to the full navigation row instead of relying on
|
||||
* the absolute panel's static position beside the compact CTA. */
|
||||
.navbar-top .aksrt-navbar-actions .navbar-vip-hover {
|
||||
position: relative;
|
||||
align-self: stretch;
|
||||
align-items: center;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-vip-hover > .sub-vip-card {
|
||||
top: 100%;
|
||||
right: 0;
|
||||
left: auto;
|
||||
width: max-content;
|
||||
max-width: calc(100vw - 24px);
|
||||
margin: 0;
|
||||
z-index: 1002;
|
||||
/* The reference keeps the publish/VIP hover wrapper a plain inline-block, so the
|
||||
* absolutely positioned .sub-vip-card takes its normal-flow static position.
|
||||
* The shared action cluster otherwise forces inline-flex on every child, which
|
||||
* would move that static position to the flex container's cross-start. */
|
||||
.navbar-top .navbar-but > .hover-show {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Keep the drop-down search panel above a fixed header (z-index: 999). */
|
||||
@@ -2886,11 +2837,19 @@ main.container,
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
/* The later .but compatibility layer otherwise replaces the legacy payvip surface. */
|
||||
.aksrt-header-userbox .pay-vip.but.payvip-icon {
|
||||
/* core/buttons.css restates the legacy .but block after main.css, so its
|
||||
* background / color / border / text-shadow declarations outrank .payvip-icon
|
||||
* and replace the payvip surface with whatever .jb-* skin is on the element.
|
||||
* The reference theme has no such compatibility layer, so its .payvip-icon
|
||||
* declarations are the last word in the cascade. Re-assert them here, which
|
||||
* loads after core/buttons.css, so every payvip surface (top-nav chip, user
|
||||
* card status bar and CTA, guest CTA) keeps the legacy metallic gradient. */
|
||||
.payvip-icon {
|
||||
background: linear-gradient(300deg, #4c4d51, #2a2a31 15%, #85858a 40%, #393a3c 60%, #393838 80%, #5e5f62 100%);
|
||||
color: #ece0e0;
|
||||
--this-color: #ece0e0;
|
||||
border: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/* Keep the header check-in action flush with the VIP row's padded inner width. */
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -7,27 +7,22 @@
|
||||
* shell anchoring plus the account action-row geometry.
|
||||
*/
|
||||
|
||||
/* The desktop action cluster owns one horizontal alignment context. */
|
||||
.navbar-top .aksrt-navbar-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
min-height: 50px;
|
||||
margin-top: 0;
|
||||
margin-bottom: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions > *,
|
||||
.navbar-top .aksrt-navbar-account,
|
||||
.navbar-top .aksrt-navbar-account > li {
|
||||
/* The reference keeps the right cluster as three floated .navbar-form groups, so
|
||||
* only the account row carries its own alignment context; the button groups
|
||||
* inherit their geometry from .navbar-top .navbar-but .but and .navbar-form. */
|
||||
.navbar-top .aksrt-navbar-account {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
gap: 4px;
|
||||
min-height: 50px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account > li {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
padding: 0;
|
||||
overflow: visible;
|
||||
}
|
||||
@@ -40,39 +35,6 @@
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account {
|
||||
gap: 4px;
|
||||
min-height: 50px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-account.navbar-text {
|
||||
float: none;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-cta {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 4px;
|
||||
min-height: 29px;
|
||||
margin: 0;
|
||||
padding: .3em 1em !important;
|
||||
border-radius: var(--radius-btn, 4px);
|
||||
font-size: .8em;
|
||||
line-height: 1.44;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-cta.radius {
|
||||
border-radius: 50px;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-cta > .icon {
|
||||
width: 1.2em;
|
||||
height: 1.2em;
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-nav-icon,
|
||||
.navbar-top .aksrt-nav-avatar {
|
||||
display: inline-flex !important;
|
||||
@@ -105,33 +67,22 @@
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .toggle-radius {
|
||||
.navbar-top .navbar-form .toggle-radius {
|
||||
flex: 0 0 29px;
|
||||
margin: 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-language {
|
||||
.navbar-top .navbar-form .aksrt-navbar-language {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Anchor the VIP preview to the full navigation row instead of relying on
|
||||
* the absolute panel's static position beside the compact CTA. */
|
||||
.navbar-top .aksrt-navbar-actions .navbar-vip-hover {
|
||||
position: relative;
|
||||
align-self: stretch;
|
||||
align-items: center;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.navbar-top .aksrt-navbar-actions .navbar-vip-hover > .sub-vip-card {
|
||||
top: 100%;
|
||||
right: 0;
|
||||
left: auto;
|
||||
width: max-content;
|
||||
max-width: calc(100vw - 24px);
|
||||
margin: 0;
|
||||
z-index: 1002;
|
||||
/* The reference keeps the publish/VIP hover wrapper a plain inline-block, so the
|
||||
* absolutely positioned .sub-vip-card takes its normal-flow static position.
|
||||
* The shared action cluster otherwise forces inline-flex on every child, which
|
||||
* would move that static position to the flex container's cross-start. */
|
||||
.navbar-top .navbar-but > .hover-show {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Keep the drop-down search panel above a fixed header (z-index: 999). */
|
||||
@@ -179,11 +130,19 @@
|
||||
padding: 6px;
|
||||
}
|
||||
|
||||
/* The later .but compatibility layer otherwise replaces the legacy payvip surface. */
|
||||
.aksrt-header-userbox .pay-vip.but.payvip-icon {
|
||||
/* core/buttons.css restates the legacy .but block after main.css, so its
|
||||
* background / color / border / text-shadow declarations outrank .payvip-icon
|
||||
* and replace the payvip surface with whatever .jb-* skin is on the element.
|
||||
* The reference theme has no such compatibility layer, so its .payvip-icon
|
||||
* declarations are the last word in the cascade. Re-assert them here, which
|
||||
* loads after core/buttons.css, so every payvip surface (top-nav chip, user
|
||||
* card status bar and CTA, guest CTA) keeps the legacy metallic gradient. */
|
||||
.payvip-icon {
|
||||
background: linear-gradient(300deg, #4c4d51, #2a2a31 15%, #85858a 40%, #393a3c 60%, #393838 80%, #5e5f62 100%);
|
||||
color: #ece0e0;
|
||||
--this-color: #ece0e0;
|
||||
border: none;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/* Keep the header check-in action flush with the VIP row's padded inner width. */
|
||||
|
||||
+1
-1
@@ -6838,7 +6838,7 @@ badge.top,
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.navbar-top .navbar-but > .but {
|
||||
.navbar-top .navbar-but .but {
|
||||
font-size: 0.8em;
|
||||
padding: 0.3em 1em !important;
|
||||
margin: 0.4em;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -37,102 +37,33 @@ if (!function_exists('aksrt_get_new_add_actions')) :
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_normalize_header_cta_label')) :
|
||||
/**
|
||||
* Normalize CTA label HTML: map FA5 classes and keep a single leading icon.
|
||||
*/
|
||||
function aksrt_normalize_header_cta_label(string $label, string $fallback_icon = 'fa fas fa-pen'): string {
|
||||
$label = trim($label);
|
||||
if ($label === '') {
|
||||
return '<i class="' . esc_attr($fallback_icon) . '" aria-hidden="true"></i> ' . esc_html__('发布', 'aksrt');
|
||||
}
|
||||
|
||||
if (stripos($label, '<i') === false) {
|
||||
// No space between icon and label — spacing via CSS margin (legacy .but > .fa).
|
||||
$label = '<i class="' . esc_attr($fallback_icon) . '" aria-hidden="true"></i><span class="navbar-cta-text">' . esc_html(wp_strip_all_tags($label)) . '</span>';
|
||||
} else {
|
||||
$label = preg_replace(
|
||||
'/(<\/i>)\s*([^<].*)$/u',
|
||||
'$1<span class="navbar-cta-text">$2</span>',
|
||||
$label
|
||||
) ?? $label;
|
||||
}
|
||||
|
||||
return $label;
|
||||
}
|
||||
endif;
|
||||
|
||||
if (!function_exists('aksrt_render_new_add_btns')) :
|
||||
/**
|
||||
* Multi-type publish button (legacy newadd-btns).
|
||||
* Publish chip (legacy newadd-btns, single action).
|
||||
*
|
||||
* Mirrors the single-button branch of the reference zib_get_new_add_btns():
|
||||
* the paint classes ride on the anchor itself and the label is emitted
|
||||
* verbatim. Only the post action exists, so there is no dropdown branch.
|
||||
*
|
||||
* @param string[] $types
|
||||
*/
|
||||
function aksrt_render_new_add_btns(array $types, string $class = '', string $label = ''): string {
|
||||
if (class_exists('\AKSRT\Settings\Settings') && \AKSRT\Settings\Settings::close_sign()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$actions = aksrt_get_new_add_actions($types);
|
||||
if (!$actions) {
|
||||
// Last resort: keep a write-post entry so the top-nav chip is never blank.
|
||||
$fallback = function_exists('aksrt_get_new_post_url') ? (string) aksrt_get_new_post_url() : '';
|
||||
if ($fallback === '') {
|
||||
$fallback = admin_url('post-new.php');
|
||||
}
|
||||
$actions = [[
|
||||
'type' => 'post',
|
||||
'url' => $fallback,
|
||||
'label' => __('写文章', 'aksrt'),
|
||||
'icon' => 'fa fas fa-file-alt',
|
||||
]];
|
||||
return '';
|
||||
}
|
||||
|
||||
$a = $actions[0];
|
||||
if ($label === '') {
|
||||
$label = __('发布', 'aksrt');
|
||||
}
|
||||
$label_html = aksrt_normalize_header_cta_label((string) $label, 'fa fas fa-pen');
|
||||
|
||||
// Split paint classes vs wrapper tokens.
|
||||
$class_tokens = preg_split('/\s+/', trim($class), -1, PREG_SPLIT_NO_EMPTY) ?: [];
|
||||
$cta_tokens = [];
|
||||
$wrap_tokens = ['newadd-btns'];
|
||||
foreach ($class_tokens as $token) {
|
||||
if ($token === 'newadd-btns') {
|
||||
continue;
|
||||
}
|
||||
if ($token === 'btn-primary' || $token === 'but' || $token === 'navbar-cta' || $token === 'radius' || $token === 'main-radius' || $token === 'mini-radius' || str_starts_with($token, 'jb-') || str_starts_with($token, 'b-')) {
|
||||
$cta_tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
$wrap_tokens[] = $token;
|
||||
}
|
||||
if (!$cta_tokens) {
|
||||
$cta_tokens[] = 'jb-blue';
|
||||
}
|
||||
if (!in_array('but', $cta_tokens, true)) {
|
||||
$cta_tokens[] = 'but';
|
||||
}
|
||||
$cta_class = trim(implode(' ', array_unique($cta_tokens)));
|
||||
|
||||
if (count($actions) === 1) {
|
||||
$a = $actions[0];
|
||||
return '<a rel="nofollow" class="' . esc_attr(trim(implode(' ', $wrap_tokens) . ' ' . $cta_class . ' navbar-cta')) . '" href="' . esc_url($a['url']) . '">'
|
||||
. $label_html
|
||||
. '</a>';
|
||||
}
|
||||
|
||||
// legacy: span.newadd-btns.hover-show > toggle chip + .hover-show-con.drop-newadd
|
||||
// Paint classes (jb-*, but, radius) MUST live on the toggle — wrapper is layout-only
|
||||
// (background forced transparent). Bare navbar-but has no .navbar-but-cluster shell.
|
||||
// data-aksrt-newadd: JS may portal menu to body so chip width cannot track menu.
|
||||
$html = '<span class="' . esc_attr(trim(implode(' ', $wrap_tokens) . ' hover-show')) . '" data-aksrt-newadd="1">';
|
||||
$html .= '<span class="newadd-btns__toggle navbar-cta ' . esc_attr($cta_class) . '">' . $label_html
|
||||
. '<i class="fa fas fa-caret-down" aria-hidden="true"></i></span>';
|
||||
$html .= '<div class="hover-show-con dropdown-menu drop-newadd" role="menu">';
|
||||
foreach ($actions as $a) {
|
||||
$html .= '<a rel="nofollow" class="btn-newadd newadd-btns__item" role="menuitem" href="' . esc_url($a['url']) . '">';
|
||||
$html .= '<i class="' . esc_attr($a['icon']) . '" aria-hidden="true"></i> '
|
||||
. '<text>' . esc_html($a['label']) . '</text>';
|
||||
$html .= '</a>';
|
||||
}
|
||||
$html .= '</div></span>';
|
||||
return $html;
|
||||
return '<a rel="nofollow" class="newadd-btns ' . esc_attr($class) . ' btn-newadd" href="' . esc_url($a['url']) . '">'
|
||||
. $label . '</a>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Saved through sanitize_type 'html' (wp_kses_post).
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -142,26 +73,19 @@ if (!function_exists('aksrt_render_header_menu_buttons')) :
|
||||
*/
|
||||
function aksrt_render_header_menu_buttons(): string {
|
||||
$settings = class_exists('\AKSRT\Settings\Settings') ? \AKSRT\Settings\Settings::read_domain('page_display', 'header-nav') : [];
|
||||
$cfg = [
|
||||
'enabled' => !isset($settings['nav_newposts']) || !empty($settings['nav_newposts']),
|
||||
'text' => trim((string) ($settings['nav_newposts_text'] ?? __('发布', 'aksrt'))),
|
||||
'radius_pill' => !isset($settings['nav_newposts_radius']) || !empty($settings['nav_newposts_radius']),
|
||||
'class' => sanitize_html_class((string) (($settings['nav_newposts_class'] ?? '') ?: 'jb-blue')),
|
||||
];
|
||||
$enabled = !isset($settings['nav_newposts']) || !empty($settings['nav_newposts']);
|
||||
$text = trim((string) ($settings['nav_newposts_text'] ?? ''));
|
||||
$pill = !isset($settings['nav_newposts_radius']) || !empty($settings['nav_newposts_radius']);
|
||||
$skin = sanitize_html_class((string) (($settings['nav_newposts_class'] ?? '') ?: 'jb-blue'));
|
||||
|
||||
$html = '';
|
||||
if (!empty($cfg['enabled'])) {
|
||||
if ($enabled) {
|
||||
// legacy default: but nowave jb-blue (+ radius).
|
||||
$class = 'but nowave navbar-newposts';
|
||||
$skin = trim((string) ($cfg['class'] ?? ''));
|
||||
if ($skin === '') {
|
||||
$skin = 'jb-blue';
|
||||
}
|
||||
$class .= ' ' . $skin;
|
||||
$pill = !empty($cfg['radius_pill']);
|
||||
$class = 'but nowave ' . $skin;
|
||||
if ($pill && !str_contains($class, 'radius')) {
|
||||
$class .= ' radius';
|
||||
}
|
||||
$label = (string) ($cfg['text'] ?? __('发布', 'aksrt'));
|
||||
$label = $text !== '' ? $text : __('发布', 'aksrt');
|
||||
$btn = aksrt_render_new_add_btns(['post'], $class, $label);
|
||||
if ($btn !== '') {
|
||||
$html .= $btn;
|
||||
@@ -173,7 +97,8 @@ if (!function_exists('aksrt_render_header_menu_buttons')) :
|
||||
$show_vip = false;
|
||||
if (class_exists('\AKSRT\Settings\Settings')) {
|
||||
$vs = \AKSRT\Settings\Settings::get_payment_vip_settings();
|
||||
$show_vip = !empty($vs['enabled']) && !empty($vs['nav_pay_vip']);
|
||||
$show_vip = !empty($vs['enabled']) && !empty($vs['nav_pay_vip'])
|
||||
&& !\AKSRT\Settings\Settings::close_sign();
|
||||
}
|
||||
if ($show_vip) {
|
||||
$is_vip = false;
|
||||
@@ -188,17 +113,15 @@ if (!function_exists('aksrt_render_header_menu_buttons')) :
|
||||
if (method_exists($svc, 'render_vip_card')) {
|
||||
$cards = $svc->render_vip_card(1, $user_id) . $svc->render_vip_card(2, $user_id);
|
||||
if ($cards !== '') {
|
||||
$hover = '<div class="hover-show-con sub-menu sub-vip-card">' . $cards . '</div>';
|
||||
$hover = '<div class="sub-menu hover-show-con sub-vip-card">' . $cards . '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
// legacy: span.hover-show wraps button + .hover-show-con.sub-vip-card
|
||||
$html .= '<span class="hover-show inline-block navbar-vip-hover">';
|
||||
$html .= '<a class="but jb-red radius payvip-icon ml10 navbar-cta ' . esc_attr($cls) . '" href="javascript:;"'
|
||||
. ($user_id > 0 ? ' vip-level="1"' : '') . '>';
|
||||
$html .= '<svg class="icon em12 mr3" aria-hidden="true"><use xlink:href="#icon-vip_1"></use></svg>'
|
||||
. '<span class="navbar-cta-text">' . esc_html__('开通会员', 'aksrt') . '</span>';
|
||||
$html .= '</a>' . $hover . '</span>';
|
||||
// legacy: span.hover-show wraps button + .sub-menu.sub-vip-card
|
||||
$html .= '<span class="hover-show inline-block">';
|
||||
$html .= '<a class="' . esc_attr($cls) . ' but jb-red radius payvip-icon ml10" href="javascript:;">'
|
||||
. '<svg class="em12 mr3" aria-hidden="true"><use xlink:href="#icon-vip_1"></use></svg>'
|
||||
. esc_html__('开通会员', 'aksrt') . '</a>' . $hover . '</span>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -230,11 +230,11 @@ if (!function_exists('aksrt_header_payvip_bar')) :
|
||||
return '';
|
||||
}
|
||||
|
||||
// 几何对齐参考主题 CTA(通栏、radius4)——不是顶导 navbar-cta chips。
|
||||
// 1:1 对齐参考主题 zib_get_header_payvip_icon():通栏、radius4、vip_1 SVG 图标、裸文案。
|
||||
return '<div class="mt10 em09" style="padding:2px;">'
|
||||
. '<a class="pay-vip but radius4 payvip-icon btn-block" href="javascript:;" vip-level="1">'
|
||||
. '<i class="fa fas fa-gem em12 mr6" aria-hidden="true"></i>'
|
||||
. '<span>' . esc_html__('开通会员 尊享会员权益', 'aksrt') . '</span>'
|
||||
. '<a class="pay-vip but radius4 payvip-icon btn-block" href="javascript:;">'
|
||||
. '<svg class="em12 mr6" aria-hidden="true"><use xlink:href="#icon-vip_1"></use></svg>'
|
||||
. esc_html__('开通会员 尊享会员权益', 'aksrt')
|
||||
. '</a></div>';
|
||||
}
|
||||
endif;
|
||||
|
||||
@@ -303,6 +303,12 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
/**
|
||||
* Right cluster: fold, publish/VIP, theme, user, search (legacy).
|
||||
*
|
||||
* The reference splits the cluster into three floated .navbar-form
|
||||
* groups (publish/VIP, theme + language, account row). Each group
|
||||
* keeps its own .navbar-form padding, which is what produces the
|
||||
* reference inter-cluster spacing, so the groups are emitted
|
||||
* separately instead of being merged into one flex container.
|
||||
*
|
||||
* @param array<string,mixed> $ctx
|
||||
*/
|
||||
function aksrt_menu_button(array $ctx): void {
|
||||
@@ -371,14 +377,24 @@ if (!function_exists('aksrt_menu_button')) :
|
||||
$account = '<ul class="list-inline splitters relative aksrt-navbar-account'
|
||||
. ($user_id <= 0 && '2' === $layout ? ' navbar-text' : '') . '">'
|
||||
. $notification_but . $sign_but . $search_but . '</ul>';
|
||||
$button = '<div class="aksrt-navbar-actions navbar-form navbar-right navbar-but">'
|
||||
. $actions . $utility_buttons . $account . '</div>';
|
||||
|
||||
// Reference cluster split: publish/VIP, theme + language, account row.
|
||||
$button = '';
|
||||
if ($actions !== '') {
|
||||
$button = '<div class="navbar-form navbar-right navbar-but">' . $actions . '</div>';
|
||||
}
|
||||
if ($utility_buttons !== '') {
|
||||
$button .= '<div class="navbar-form navbar-right flex ac">' . $utility_buttons . '</div>';
|
||||
}
|
||||
$right_but = '<div class="navbar-form navbar-right'
|
||||
. ($user_id <= 0 && '2' === $layout ? ' navbar-text' : '') . '">'
|
||||
. $account . '</div>';
|
||||
|
||||
$fold = '<div class="navbar-form navbar-right hide show-nav-but" style="margin-right:-10px;">'
|
||||
. '<a data-toggle-class data-target=".nav.navbar-nav" href="javascript:;" class="aksrt-nav-icon" aria-label="'
|
||||
. esc_attr__('展开菜单', 'aksrt') . '"><svg class="icon" viewBox="0 0 1024 1024" aria-hidden="true"><use xlink:href="#icon-menu_2"></use></svg></a></div>';
|
||||
|
||||
$html = $fold . $button;
|
||||
$html = $fold . $button . $right_but;
|
||||
|
||||
echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class SchemaPageDisplay {
|
||||
self::field('nav_newposts', 'Add发布按钮', 'switcher', true, ['description' => '顶部导航显示文章投稿按钮。']),
|
||||
self::field('nav_newposts_radius', '按钮圆角', 'switcher', true, ['dependsOn' => self::enabled('nav_newposts')]),
|
||||
self::field('nav_newposts_class', '按钮颜色', 'palette', 'jb-blue', ['dependsOn' => self::enabled('nav_newposts'), 'options' => self::aksrt_palette()]),
|
||||
self::field('nav_newposts_text', '按钮文案', 'textarea', '<i class="fa fas fa-fw fas fa-pencil-alt"></i>发布', ['dependsOn' => self::enabled('nav_newposts'), 'sanitize_type' => 'html', 'rows' => 1]),
|
||||
self::field('nav_newposts_text', '按钮文案', 'textarea', '<i class="fa fas fa-fw fa-pencil-alt"></i>发布', ['dependsOn' => self::enabled('nav_newposts'), 'sanitize_type' => 'html', 'rows' => 1]),
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -217,7 +217,12 @@ test('the account popover rows match the reference user box structure', () => {
|
||||
assert.match(header, /radius4 payvip-icon btn-block text-center/);
|
||||
assert.match(header, /vip-expdate-tag/);
|
||||
assert.match(header, /pay-vip but radius4 payvip-icon btn-block/);
|
||||
assert.match(userboxCss, /\.aksrt-header-userbox \.pay-vip\.but\.payvip-icon\s*\{[\s\S]*?background:\s*linear-gradient\(300deg,[\s\S]*?color:\s*#ece0e0;[\s\S]*?--this-color:\s*#ece0e0;/s);
|
||||
// core/buttons.css restates .but after main.css, which would otherwise replace
|
||||
// the legacy .payvip-icon surface with the .jb-* skin. The restoration must
|
||||
// cover background, color, border and text-shadow, and must not be scoped to
|
||||
// one call site or the top-nav chip keeps the wrong gradient.
|
||||
assert.match(userboxCss, /\.payvip-icon\s*\{[\s\S]*?background:\s*linear-gradient\(300deg,[\s\S]*?color:\s*#ece0e0;[\s\S]*?--this-color:\s*#ece0e0;[\s\S]*?border:\s*none;[\s\S]*?text-shadow:\s*none;/s);
|
||||
assert.doesNotMatch(userboxCss, /\.aksrt-header-userbox \.pay-vip\.but\.payvip-icon/)
|
||||
assert.doesNotMatch(header, /vipbg-v2/);
|
||||
|
||||
// Check-in entry is an anchor with the reference button classes.
|
||||
@@ -225,8 +230,11 @@ test('the account popover rows match the reference user box structure', () => {
|
||||
assert.match(header, /but block c-yellow is-done/);
|
||||
assert.match(buttonsCss, /\.but\.block\s*\{\s*display:\s*block;\s*\}/);
|
||||
assert.match(buttonsCss, /\.btn-block\s*\{\s*display:\s*block;\s*width:\s*100%;\s*\}/);
|
||||
assert.match(legacyMainCss, /\.navbar-top \.navbar-but > \.but\s*\{[^}]*font-size:\s*0\.8em;[^}]*padding:\s*0\.3em 1em !important;[^}]*margin:\s*0\.4em;/s);
|
||||
assert.doesNotMatch(legacyMainCss, /\.navbar-top \.navbar-but \.but\s*\{/);
|
||||
// The reference selector is a descendant, so the VIP chip inside its hover-show
|
||||
// wrapper receives the same .but geometry (font-size, padding, margin) as the
|
||||
// publish chip instead of falling back to the bare .but defaults.
|
||||
assert.match(legacyMainCss, /\.navbar-top \.navbar-but \.but\s*\{[^}]*font-size:\s*0\.8em;[^}]*padding:\s*0\.3em 1em !important;[^}]*margin:\s*0\.4em;/s);
|
||||
assert.doesNotMatch(legacyMainCss, /\.navbar-top \.navbar-but > \.but\s*\{/);
|
||||
assert.doesNotMatch(header, /but block c-yellow[^"']*btn-block/);
|
||||
assert.match(header, /<div class="mt6 em09" style="padding:2px;">' \. \$checkin \. '<\/div>/);
|
||||
assert.match(header, /data-signin-done-label[\s\S]{0,120}?今日已签到/);
|
||||
|
||||
@@ -120,6 +120,10 @@ test('defaults, nested structures, dependencies, and excluded product families a
|
||||
}
|
||||
assert.equal(headerMenuButtons.includes('nav_newposts_btns'), false)
|
||||
assert.match(headerMenuButtons, /aksrt_render_new_add_btns\(\['post'\], \$class, \$label\)/)
|
||||
// FA5 spelling of the reference '<i class="fa fa-fw fa-pencil"></i>发布'
|
||||
// default: fa-pencil does not exist in the bundled FA 5.15.4 free set.
|
||||
assert.match(schema, /'nav_newposts_text', '按钮文案', 'textarea', '<i class="fa fas fa-fw fa-pencil-alt"><\/i>发布'/)
|
||||
assert.doesNotMatch(schema, /fa fas fa-fw fas /)
|
||||
})
|
||||
|
||||
test('VIP navigation purchase switches are saved and consumed end to end', () => {
|
||||
@@ -136,8 +140,18 @@ test('VIP navigation purchase switches are saved and consumed end to end', () =>
|
||||
})
|
||||
|
||||
test('header VIP hover cards match the legacy markup and style contract', () => {
|
||||
assert.match(headerMenuButtons, /<span class="hover-show inline-block navbar-vip-hover">/)
|
||||
assert.match(headerMenuButtons, /<div class="hover-show-con sub-menu sub-vip-card">/)
|
||||
assert.match(headerMenuButtons, /<span class="hover-show inline-block">/)
|
||||
assert.match(headerMenuButtons, /<div class="sub-menu hover-show-con sub-vip-card">/)
|
||||
assert.match(headerMenuButtons, /'<a class="' \. esc_attr\(\$cls\) \. ' but jb-red radius payvip-icon ml10" href="javascript:;">'/)
|
||||
// The payvip surface must survive the .but compatibility layer for the top-nav
|
||||
// chip too, not just the user-card CTA.
|
||||
assert.match(headerCss, /\.payvip-icon\s*\{[\s\S]*?background:\s*linear-gradient\(300deg,[\s\S]*?--this-color:\s*#ece0e0;/s)
|
||||
assert.match(headerMenuButtons, /<svg class="em12 mr3" aria-hidden="true"><use xlink:href="#icon-vip_1"><\/use><\/svg>'/)
|
||||
assert.match(headerMenuButtons, /'<a rel="nofollow" class="newadd-btns ' \. esc_attr\(\$class\) \. ' btn-newadd"/)
|
||||
assert.equal((headerMenuButtons.match(/Settings::close_sign\(\)/g) || []).length, 2)
|
||||
for (const dead of ['navbar-cta', 'navbar-cta-text', 'navbar-newposts', 'navbar-vip-hover', 'newadd-btns__', 'vip-level', 'fa-gem']) {
|
||||
assert.equal(headerMenuButtons.includes(dead), false, `AKSRT-only header CTA token remains: ${dead}`)
|
||||
}
|
||||
assert.match(vipCardRenderer, /aksrt_get_lazy_attr\('lazy_other', \$icon_url, 'img-icon'\)/)
|
||||
assert.match(vipCardRenderer, /<div class=\"abs-center vip-baicon\"[^>]*>/)
|
||||
assert.match(vipCardRenderer, /<div class=\"vip-img abs-right\">/)
|
||||
@@ -154,8 +168,21 @@ test('header VIP hover cards match the legacy markup and style contract', () =>
|
||||
assert.match(legacyMainCss, /\.sub-vip-card \.vip-card\s*\{[^}]*display:\s*inline-block;[^}]*width:\s*240px;[^}]*margin:\s*5px;/s)
|
||||
assert.match(legacyMainCss, /\.sub-vip-card \.vip-baicon\.abs-center\s*\{[^}]*font-size:\s*10em;[^}]*left:\s*55%;/s)
|
||||
assert.match(legacyMainCss, /\.sub-vip-card \.vip-img\s*\{[^}]*display:\s*none;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-actions \.navbar-vip-hover\s*\{[^}]*align-self:\s*stretch;[^}]*overflow:\s*visible;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-actions \.navbar-vip-hover > \.sub-vip-card\s*\{[^}]*top:\s*100%;[^}]*right:\s*0;[^}]*left:\s*auto;[^}]*max-width:\s*calc\(100vw - 24px\);/s)
|
||||
// The hover wrapper must stay a plain block container so the legacy static
|
||||
// position of .sub-vip-card matches the reference theme.
|
||||
assert.match(headerCss, /\.navbar-top \.navbar-but > \.hover-show\s*\{[^}]*display:\s*inline-block;/s)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-cta|\.navbar-vip-hover/)
|
||||
assert.match(legacyMainCss, /\.navbar-top \.navbar-right \.sub-menu\s*\{[^}]*right:\s*0;/s)
|
||||
})
|
||||
|
||||
test('user card VIP CTA matches the reference zib_get_header_payvip_icon()', () => {
|
||||
assert.match(headerUserbox, /'<a class="pay-vip but radius4 payvip-icon btn-block" href="javascript:;">'/)
|
||||
assert.match(headerUserbox, /<svg class="em12 mr6" aria-hidden="true"><use xlink:href="#icon-vip_1"><\/use><\/svg>'/)
|
||||
assert.match(headerUserbox, /esc_html__\('开通会员 尊享会员权益', 'aksrt'\)/)
|
||||
for (const dead of ['fa-gem', 'vip-level']) {
|
||||
assert.equal(headerUserbox.includes(dead), false, `AKSRT-only user card CTA token remains: ${dead}`)
|
||||
}
|
||||
assert.doesNotMatch(headerUserbox, /<span>' \. esc_html__\('开通会员 尊享会员权益'/)
|
||||
})
|
||||
|
||||
test('VIP purchase modal matches legacy desktop-center and mobile-bottom positioning', () => {
|
||||
@@ -322,13 +349,21 @@ test('user profile and author widgets render the reference user-card contract',
|
||||
})
|
||||
|
||||
test('desktop header actions share one row without generic button masks', () => {
|
||||
assert.match(headerNavbar, /aksrt-navbar-actions navbar-form navbar-right/)
|
||||
assert.match(headerNavbar, /navbar-form navbar-right navbar-but/)
|
||||
assert.match(headerNavbar, /navbar-form navbar-right flex ac/)
|
||||
assert.match(headerNavbar, /\$fold \. \$button \. \$right_but/)
|
||||
assert.match(headerNavbar, /class="aksrt-nav-icon nav-search-btn main-search-btn"/)
|
||||
assert.doesNotMatch(headerNavbar, /class="btn nav-search-btn main-search-btn"/)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-actions\s*\{[^}]*display:\s*flex;[^}]*align-items:\s*center;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-account\s*\{[^}]*display:\s*inline-flex;[^}]*align-items:\s*center;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-nav-icon,[\s\S]*?background:\s*transparent !important;/)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-actions \.navbar-cta\.radius\s*\{[^}]*border-radius:\s*50px;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-actions \.navbar-cta > \.icon\s*\{[^}]*width:\s*1\.2em;[^}]*height:\s*1\.2em;[^}]*flex:\s*0 0 auto;/s)
|
||||
// The publish and VIP chips ride the legacy .but geometry verbatim; nothing in
|
||||
// the header module may restate their padding, margin, radius or icon size.
|
||||
// Descendant, not child: the VIP chip lives inside the hover-show wrapper.
|
||||
assert.match(legacyMainCss, /\.navbar-top \.navbar-but \.but\s*\{[^}]*font-size:\s*0\.8em;[^}]*padding:\s*0\.3em 1em !important;[^}]*margin:\s*0\.4em;/s)
|
||||
assert.doesNotMatch(headerCss, /\.navbar-cta|\.navbar-vip-hover/)
|
||||
// No merged flex container: the three groups keep their own .navbar-form
|
||||
// padding, which is what produces the reference inter-cluster spacing.
|
||||
assert.doesNotMatch(headerCss, /\.aksrt-navbar-actions/)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-account > li\s*\{[^}]*position:\s*relative;/s)
|
||||
assert.match(headerCss, /\.navbar-top \.aksrt-navbar-account > li > \.sub-menu\s*\{[^}]*top:\s*calc\(100% \+ 5px\);[^}]*right:\s*0;/s)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user