修复发评论后卡片被挤下去:原评论内容改用class+!important隐藏(Artalk重渲染会抹掉内联display),转换逻辑改幂等自愈
Deploy to Production / pre-check (push) Successful in 50s
Deploy to Production / build (push) Successful in 4m30s
Deploy to Production / deploy-edgeone (push) Canceled after 2m21s
Deploy to Production / finalize (push) Canceled after 0s
Deploy to Production / notify-failure (push) Canceled after 0s
Deploy to Production / pre-check (push) Successful in 50s
Deploy to Production / build (push) Successful in 4m30s
Deploy to Production / deploy-edgeone (push) Canceled after 2m21s
Deploy to Production / finalize (push) Canceled after 0s
Deploy to Production / notify-failure (push) Canceled after 0s
This commit is contained in:
1 parent
0f4761803c
commit
ab94c25273
2 files changed
+14
-1
No files matched your search
@@ -722,9 +722,12 @@ artalk.on('comment-rendered', function(node) {
|
||||
if (!d2 || !el2) return;
|
||||
var content = String(d2.content || '').trim().replace(/\/+$/, '').toLowerCase();
|
||||
if (content !== 'https://usj.cc/link-apply') return;
|
||||
if (el2.querySelector('.atk-fl-apply')) return;
|
||||
|
||||
// 幂等 + 自愈:class 每次渲染都补一次(隐藏原评论内容的 CSS 规则依赖它),
|
||||
// 已有卡片就直接返回,避免 Artalk 重渲染时出现第二张卡片
|
||||
el2.classList.add('atk-fl-apply');
|
||||
if (el2.querySelector('.atk-fl-card')) return;
|
||||
|
||||
el2.style.cursor = 'pointer';
|
||||
el2.title = '点击申请友链';
|
||||
|
||||
|
||||
@@ -99,6 +99,16 @@
|
||||
/* ================= 友链申请入口卡片 =================
|
||||
PJAX 下每次切页评论区都会重建卡片 → 入场动画与打字机自然重播;
|
||||
打字机定时器在 artalk.js 里会检测卡片是否还在文档中(切页后自动停)。 */
|
||||
|
||||
/* 卡片评论:常规内容(头像/昵称/正文/页脚)整体隐藏。
|
||||
必须用 class + !important,不能用 JS 内联 display:none ——
|
||||
Artalk 发完新评论会重渲染 .atk-main,内联样式会被抹掉,
|
||||
原评论正文(那条 URL)就会重新冒出来把卡片挤下去(刷新才恢复)。 */
|
||||
.atk-comment-wrap.atk-fl-apply > .atk-main,
|
||||
.atk-comment-wrap.atk-fl-apply > .atk-comment > .atk-main,
|
||||
.atk-comment.atk-fl-apply > .atk-main {
|
||||
display: none !important;
|
||||
}
|
||||
.atk-fl-card {
|
||||
animation: flApplyIn .5s cubic-bezier(.22, 1, .36, 1) both;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user