fix(single): match reference article action bar 1:1
The action bar used a locally invented pill-chip style that overrode the reference theme's 80px icon-over-text columns, and the JS toggled a class no stylesheet targeted — so likes/favorites showed no selected state at all. - restore reference markup: <svg class="icon"> + <text>/<count> and the actived class, with data-stat-count/data-base-count preserved - toggle actived plus a transient action-animation so the lovestar keyframes finally reach the DOM - drop the CSS overrides and now-dead action-btn/.action-btn--reward and .post-actions-card rules; main.css already carried the reference rules the overrides were shadowing
This commit is contained in:
@@ -5343,16 +5343,8 @@ body.aksrt-body-scroll .aksrt-show-on-scroll {
|
||||
cursor: zoom-in;
|
||||
}
|
||||
/* ============================================================
|
||||
* 8. 打赏按钮
|
||||
* 8. 打赏弹窗
|
||||
* ============================================================ */
|
||||
.action-btn--reward {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.action-btn--reward.is-active {
|
||||
color: var(--color-warning, #F59E0B);
|
||||
}
|
||||
|
||||
.reward-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -732,111 +732,10 @@ article.article.box-body,
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* legacy .post-actions — text/icon column buttons, not pill chips */
|
||||
.post-actions-card,
|
||||
.post-actions {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 15px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.post-actions-wrap > .post-actions {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.post-actions-card__hint {
|
||||
font-size: 13px;
|
||||
color: var(--color-ink-4, var(--color-ink-4));
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
/* Legacy card-buttons flex only for non-legacy card variant */
|
||||
.post-actions-card__buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
/* legacy: .article .action { width:80px; padding:10px 0; inline-block; opacity:.7 } */
|
||||
.article .action,
|
||||
.post-actions .action {
|
||||
width: 80px;
|
||||
padding: 10px 0;
|
||||
display: inline-block;
|
||||
opacity: 0.7;
|
||||
vertical-align: top;
|
||||
min-width: 0;
|
||||
height: auto;
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--muted-color, #777);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: opacity 0.15s ease, color 0.15s ease;
|
||||
gap: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.article .action:hover,
|
||||
.post-actions .action:hover,
|
||||
.article .action.is-active,
|
||||
.post-actions .action.is-active {
|
||||
color: inherit;
|
||||
opacity: 1;
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.article .action i,
|
||||
.post-actions .action i {
|
||||
font-size: 20px;
|
||||
display: block;
|
||||
margin: 0 auto 4px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.post-actions .action .action-btn__count,
|
||||
.post-actions .action .action-btn__label,
|
||||
.action-btn__count,
|
||||
.action-btn__label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Keep pill style for non-article .action-btn if used elsewhere */
|
||||
.action-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0.38em 1.1em;
|
||||
border-radius: 50px;
|
||||
border: 1px solid transparent;
|
||||
background: var(--surface-4, rgba(136, 136, 136, 0.1));
|
||||
color: var(--color-ink-3);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
background: var(--color-primary-soft);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.action-btn.is-active {
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
background: var(--color-primary-soft, rgba(240, 68, 148, 0.08));
|
||||
}
|
||||
|
||||
.action-btn i { font-size: 1.2em; }
|
||||
|
||||
.theme-dark .post-drop-meta__menu,
|
||||
html.dark .post-drop-meta__menu {
|
||||
background: var(--surface-1, #323335);
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,14 +1,6 @@
|
||||
/* ============================================================
|
||||
* 8. 打赏按钮
|
||||
* 8. 打赏弹窗
|
||||
* ============================================================ */
|
||||
.action-btn--reward {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.action-btn--reward.is-active {
|
||||
color: var(--color-warning, #F59E0B);
|
||||
}
|
||||
|
||||
.reward-modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
|
||||
@@ -52,111 +52,10 @@
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
/* legacy .post-actions — text/icon column buttons, not pill chips */
|
||||
.post-actions-card,
|
||||
.post-actions {
|
||||
position: relative;
|
||||
text-align: center;
|
||||
margin-bottom: 16px;
|
||||
padding-bottom: 15px;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.post-actions-wrap > .post-actions {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.post-actions-card__hint {
|
||||
font-size: 13px;
|
||||
color: var(--color-ink-4, var(--color-ink-4));
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
/* Legacy card-buttons flex only for non-legacy card variant */
|
||||
.post-actions-card__buttons {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
gap: 10px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
/* legacy: .article .action { width:80px; padding:10px 0; inline-block; opacity:.7 } */
|
||||
.article .action,
|
||||
.post-actions .action {
|
||||
width: 80px;
|
||||
padding: 10px 0;
|
||||
display: inline-block;
|
||||
opacity: 0.7;
|
||||
vertical-align: top;
|
||||
min-width: 0;
|
||||
height: auto;
|
||||
border-radius: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: var(--muted-color, #777);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: opacity 0.15s ease, color 0.15s ease;
|
||||
gap: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.article .action:hover,
|
||||
.post-actions .action:hover,
|
||||
.article .action.is-active,
|
||||
.post-actions .action.is-active {
|
||||
color: inherit;
|
||||
opacity: 1;
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.article .action i,
|
||||
.post-actions .action i {
|
||||
font-size: 20px;
|
||||
display: block;
|
||||
margin: 0 auto 4px;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.post-actions .action .action-btn__count,
|
||||
.post-actions .action .action-btn__label,
|
||||
.action-btn__count,
|
||||
.action-btn__label {
|
||||
display: block;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
/* Keep pill style for non-article .action-btn if used elsewhere */
|
||||
.action-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 0.38em 1.1em;
|
||||
border-radius: 50px;
|
||||
border: 1px solid transparent;
|
||||
background: var(--surface-4, rgba(136, 136, 136, 0.1));
|
||||
color: var(--color-ink-3);
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.15s ease;
|
||||
}
|
||||
|
||||
.action-btn:hover {
|
||||
background: var(--color-primary-soft);
|
||||
color: var(--color-primary);
|
||||
}
|
||||
|
||||
.action-btn.is-active {
|
||||
border-color: var(--color-primary);
|
||||
color: var(--color-primary);
|
||||
background: var(--color-primary-soft, rgba(240, 68, 148, 0.08));
|
||||
}
|
||||
|
||||
.action-btn i { font-size: 1.2em; }
|
||||
|
||||
.theme-dark .post-drop-meta__menu,
|
||||
html.dark .post-drop-meta__menu {
|
||||
background: var(--surface-1, #323335);
|
||||
|
||||
@@ -250,8 +250,6 @@ body.dark-theme .limit-height .read-more {
|
||||
.single-cover__content { padding: 14px; }
|
||||
.single-cover__title { font-size: 1rem; }
|
||||
.post-nav-box { grid-template-columns: 1fr; }
|
||||
.post-actions-card__buttons { gap: 8px; }
|
||||
.action-btn { padding: 8px 14px; font-size: 13px; }
|
||||
}
|
||||
|
||||
/* ===== 鏆楄壊妯″紡 ===== */
|
||||
|
||||
+14
-14
@@ -247,22 +247,22 @@
|
||||
var likeBtns = collectActionButtons(scope, ".action-like[data-post-id]");
|
||||
var favBtns = collectActionButtons(scope, ".action-favorite[data-post-id]");
|
||||
|
||||
function paintLike(btn, isActive) {
|
||||
function paintLike(btn, isActive, animate) {
|
||||
btn.dataset.initialActive = isActive ? "1" : "0";
|
||||
btn.classList.toggle("is-active", isActive);
|
||||
var icon = btn.querySelector("i");
|
||||
if (icon) icon.className = isActive ? "fa fas fa-heart" : "fa fas fa-heart";
|
||||
// actived 为参考主题的选中态类名;action-animation 只在点亮瞬间附加,
|
||||
// 触发 main.css 中的 lovestar 关键帧。
|
||||
btn.classList.toggle("actived", isActive);
|
||||
btn.classList.toggle("action-animation", !!(isActive && animate));
|
||||
}
|
||||
|
||||
function paintFavorite(btn, isActive) {
|
||||
function paintFavorite(btn, isActive, animate) {
|
||||
btn.dataset.initialActive = isActive ? "1" : "0";
|
||||
btn.classList.toggle("is-active", isActive);
|
||||
var icon = btn.querySelector("i");
|
||||
if (icon) icon.className = isActive ? "fa fas fa-star" : "fa fas fa-star";
|
||||
btn.classList.toggle("actived", isActive);
|
||||
btn.classList.toggle("action-animation", !!(isActive && animate));
|
||||
}
|
||||
|
||||
function applyLikeState(isActive, count) {
|
||||
for (var i = 0; i < likeBtns.length; i++) paintLike(likeBtns[i], isActive);
|
||||
function applyLikeState(isActive, count, animate) {
|
||||
for (var i = 0; i < likeBtns.length; i++) paintLike(likeBtns[i], isActive, animate);
|
||||
if ("number" === typeof count && !isNaN(count)) {
|
||||
setBaseStatCount("likes", count);
|
||||
} else {
|
||||
@@ -270,8 +270,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
function applyFavoriteState(isActive, count) {
|
||||
for (var i = 0; i < favBtns.length; i++) paintFavorite(favBtns[i], isActive);
|
||||
function applyFavoriteState(isActive, count, animate) {
|
||||
for (var i = 0; i < favBtns.length; i++) paintFavorite(favBtns[i], isActive, animate);
|
||||
if ("number" === typeof count && !isNaN(count)) {
|
||||
setBaseStatCount("favorites", count);
|
||||
} else {
|
||||
@@ -292,7 +292,7 @@
|
||||
var nextState = likeBtn.dataset.initialActive !== "1";
|
||||
setButtonBusy(likeBtn, true);
|
||||
requestInteraction("aksrt_toggle_like", postId, nextState).then(function (data) {
|
||||
applyLikeState(!!data.active, parseInt(data.count, 10) || 0);
|
||||
applyLikeState(!!data.active, parseInt(data.count, 10) || 0, true);
|
||||
notyf(data.active ? "感谢你的点赞" : "已取消点赞", "success");
|
||||
}).catch(function (error) {
|
||||
notyf(error && error.message ? error.message : "点赞失败", "danger");
|
||||
@@ -317,7 +317,7 @@
|
||||
var nextState = favBtn.dataset.initialActive !== "1";
|
||||
setButtonBusy(favBtn, true);
|
||||
requestInteraction("aksrt_toggle_favorite", postId, nextState).then(function (data) {
|
||||
applyFavoriteState(!!data.active, parseInt(data.count, 10) || 0);
|
||||
applyFavoriteState(!!data.active, parseInt(data.count, 10) || 0, true);
|
||||
notyf(data.active ? "收藏成功" : "已取消收藏", "success");
|
||||
}).catch(function (error) {
|
||||
notyf(error && error.message ? error.message : "收藏失败", "danger");
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -24,11 +24,13 @@ if (!function_exists('aksrt_get_rewards_button')) {
|
||||
}
|
||||
$settings = \AKSRT\Settings\Settings::get_post_page_settings();
|
||||
$label = (string) ($settings['rewards_btn_text'] ?? __('赞赏', 'aksrt'));
|
||||
$icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-money') : '';
|
||||
return sprintf(
|
||||
'<button type="button" class="%1$s aksrt-reward-open" data-aksrt-reward-open data-user-id="%2$d" data-post-id="%3$d"><i class="fa fas fa-gift em09" aria-hidden="true"></i> <span class="action-btn__label">%4$s</span></button>',
|
||||
'<button type="button" class="%1$s aksrt-reward-open" data-aksrt-reward-open data-user-id="%2$d" data-post-id="%3$d">%4$s<text>%5$s</text></button>',
|
||||
esc_attr($class),
|
||||
$user_id,
|
||||
$post_id,
|
||||
$icon, // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup.
|
||||
esc_html($label)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -195,10 +195,12 @@ if (!function_exists('aksrt_single_render_actions')) :
|
||||
<div class="text-center muted-3-color box-body em09"><?php echo esc_html($settings['button_toptext'] ?? __('喜欢就支持一下吧', 'aksrt')); ?></div>
|
||||
<div class="post-actions-wrap relative">
|
||||
<div class="text-center post-actions">
|
||||
<?php if (!empty($settings['like_enabled'])) : ?>
|
||||
<button type="button" class="action action-like<?php echo $is_liked ? ' is-active' : ''; ?>" id="action-like" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>">
|
||||
<i class="<?php echo $is_liked ? 'fa' : 'fa'; ?> fa-heart" aria-hidden="true"></i>
|
||||
<span class="action-btn__count" data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></span>
|
||||
<?php
|
||||
$like_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-like') : '';
|
||||
if (!empty($settings['like_enabled'])) : ?>
|
||||
<button type="button" class="action action-like<?php echo $is_liked ? ' actived' : ''; ?>" id="action-like" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>">
|
||||
<?php echo $like_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<text><?php esc_html_e('点赞', 'aksrt'); ?></text><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></count>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -217,10 +219,12 @@ if (!function_exists('aksrt_single_render_actions')) :
|
||||
<?php echo aksrt_get_post_share_btn($post_id, 'action action-share'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($settings['favorite_enabled'])) : ?>
|
||||
<button type="button" class="action action-favorite<?php echo $is_favorited ? ' is-active' : ''; ?>" id="action-favorite" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>">
|
||||
<i class="<?php echo $is_favorited ? 'fa' : 'fa'; ?> fa-star" aria-hidden="true"></i>
|
||||
<span class="action-btn__count" data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></span>
|
||||
<?php
|
||||
$favorite_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-favorite') : '';
|
||||
if (!empty($settings['favorite_enabled'])) : ?>
|
||||
<button type="button" class="action action-favorite<?php echo $is_favorited ? ' actived' : ''; ?>" id="action-favorite" data-post-id="<?php echo esc_attr((string) $post_id); ?>" data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>">
|
||||
<?php echo $favorite_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<text><?php esc_html_e('收藏', 'aksrt'); ?></text><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></count>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
@@ -421,29 +421,31 @@ if (!function_exists('aksrt_render_footer_tabbar_single_extend')) :
|
||||
$comment_count = (int) get_comments_number($post_id);
|
||||
|
||||
if ($like_on) :
|
||||
$like_tabbar_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-like') : '';
|
||||
?>
|
||||
<button type="button"
|
||||
class="tabbar-item single-action-tabbar action-like<?php echo $is_liked ? ' is-active' : ''; ?>"
|
||||
class="tabbar-item single-action-tabbar action-like<?php echo $is_liked ? ' actived' : ''; ?>"
|
||||
data-type="like"
|
||||
data-post-id="<?php echo esc_attr((string) $post_id); ?>"
|
||||
data-initial-active="<?php echo $is_liked ? '1' : '0'; ?>"
|
||||
aria-label="<?php esc_attr_e('点赞', 'aksrt'); ?>">
|
||||
<i class="<?php echo $is_liked ? 'fa' : 'fa'; ?> fa-heart" aria-hidden="true"></i>
|
||||
<?php if ($show_text) : ?><span data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></span><?php endif; ?>
|
||||
<?php echo $like_tabbar_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<?php if ($show_text) : ?><count data-stat-count="likes" data-base-count="<?php echo esc_attr((string) $like_count); ?>"><?php echo esc_html((string) $like_count); ?></count><?php endif; ?>
|
||||
</button>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
if ($favorite_on) :
|
||||
$favorite_tabbar_icon = function_exists('aksrt_icon_markup') ? aksrt_icon_markup('zibsvg-favorite') : '';
|
||||
?>
|
||||
<button type="button"
|
||||
class="tabbar-item single-action-tabbar action-favorite<?php echo $is_favorited ? ' is-active' : ''; ?>"
|
||||
class="tabbar-item single-action-tabbar action-favorite<?php echo $is_favorited ? ' actived' : ''; ?>"
|
||||
data-type="favorite"
|
||||
data-post-id="<?php echo esc_attr((string) $post_id); ?>"
|
||||
data-initial-active="<?php echo $is_favorited ? '1' : '0'; ?>"
|
||||
aria-label="<?php esc_attr_e('收藏', 'aksrt'); ?>">
|
||||
<i class="<?php echo $is_favorited ? 'fa' : 'fa'; ?> fa-star" aria-hidden="true"></i>
|
||||
<?php if ($show_text) : ?><span data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></span><?php endif; ?>
|
||||
<?php echo $favorite_tabbar_icon; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- fixed sprite markup. ?>
|
||||
<?php if ($show_text) : ?><count data-stat-count="favorites" data-base-count="<?php echo esc_attr((string) $favorite_count); ?>"><?php echo esc_html((string) $favorite_count); ?></count><?php endif; ?>
|
||||
</button>
|
||||
<?php
|
||||
endif;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"generated_at": "2026-09-27T06:39:18+00:00",
|
||||
"generated_at": "2026-09-27T07:36:13+00:00",
|
||||
"errors": [],
|
||||
"warnings": [
|
||||
"customPage tools-update section 'tools/update' not in PHP schema (ok if pure operational page)",
|
||||
|
||||
Reference in New Issue
Block a user