友链申请卡片改挂置顶评论 + 弹窗挂 body 加毛玻璃
Deploy to Production / pre-check (push) Successful in 28s
Deploy to Production / build (push) Successful in 2m41s
Deploy to Production / deploy-edgeone (push) Successful in 3m47s
Deploy to Production / finalize (push) Successful in 27s
Deploy to Production / notify-failure (push) Skipped
Deploy to Production / pre-check (push) Successful in 28s
Deploy to Production / build (push) Successful in 2m41s
Deploy to Production / deploy-edgeone (push) Successful in 3m47s
Deploy to Production / finalize (push) Successful in 27s
Deploy to Production / notify-failure (push) Skipped
- 置顶评论卡片化:管理员置顶且内容含「友链自助申请」的评论, 整条解析成申请入口卡片(隐藏昵称/页脚,渐变虚线卡片,点击打开 申请弹窗),其余置顶评论不受影响 - 弹窗 DOM 动态挂 document.body:评论容器带 transform 动画会把 position:fixed 劫持成相对定位,导致遮罩/表单跟着容器变形—— 挂 body 彻底规避 - 遮罩加 backdrop-filter 毛玻璃(GPU 合成,不影响页面性能)
This commit is contained in:
1 parent
5fcbd2a7b6
commit
da1a77a313
2 files changed
+141
-80
No files matched your search
@@ -686,6 +686,63 @@ artalk.on('comment-rendered', function(node) {
|
||||
injectBadge(nickEl, 'atk-rank-badge', data.rank_name, tip, data.rank_color || '', data.rank_bg || '');
|
||||
}
|
||||
} catch (e) { /* 徽章注入失败不影响评论 */ }
|
||||
|
||||
// ── 置顶评论卡片化:管理员置顶且内容含「友链自助申请」的评论,
|
||||
// 整条解析成申请入口卡片(点击打开申请弹窗),其余置顶评论不受影响。
|
||||
try {
|
||||
var d2 = null;
|
||||
if (node && typeof node.getData === 'function') d2 = node.getData();
|
||||
else if (node && node.comment && typeof node.comment.getData === 'function') d2 = node.comment.getData();
|
||||
else d2 = node;
|
||||
var el2 = null;
|
||||
if (node && node.$el) el2 = node.$el;
|
||||
else if (node && typeof node.getEl === 'function') el2 = node.getEl();
|
||||
if (!d2 || !d2.is_pinned || !el2) return;
|
||||
var content = String(d2.content || '');
|
||||
if (content.indexOf('友链自助申请') === -1) return;
|
||||
if (el2.querySelector('.atk-fl-apply')) return;
|
||||
|
||||
el2.classList.add('atk-fl-apply');
|
||||
el2.style.cursor = 'pointer';
|
||||
el2.title = '点击申请友链';
|
||||
|
||||
// 隐藏评论常规元素(昵称行/页脚操作),整条变成一张卡片
|
||||
var hd = el2.querySelector('.atk-header');
|
||||
var ft = el2.querySelector('.atk-footer');
|
||||
if (hd) hd.style.display = 'none';
|
||||
if (ft) ft.style.display = 'none';
|
||||
var meta = el2.querySelector('.atk-meta');
|
||||
if (meta) meta.style.display = 'none';
|
||||
|
||||
var main = el2.querySelector('.atk-main') || el2;
|
||||
var contentEl = main.querySelector('.atk-content');
|
||||
var card = document.createElement('div');
|
||||
card.className = 'atk-fl-apply';
|
||||
card.style.cssText = 'display:flex;align-items:center;gap:12px;padding:16px 18px;margin:6px 0;' +
|
||||
'background:linear-gradient(135deg,rgba(47,158,99,.08),rgba(47,158,99,.02));' +
|
||||
'border:1px dashed rgba(47,158,99,.45);border-radius:10px;transition:border-color .2s,transform .2s;';
|
||||
card.innerHTML =
|
||||
'<span style="flex:none;width:40px;height:40px;border-radius:10px;background:rgba(47,158,99,.12);' +
|
||||
'display:flex;align-items:center;justify-content:center;font-size:20px">🔗</span>' +
|
||||
'<span style="flex:1;min-width:0">' +
|
||||
'<span style="display:block;font-size:15px;font-weight:600;color:#2f9e63">友链自助申请</span>' +
|
||||
'<span style="display:block;font-size:12px;color:#8a8e98;margin-top:2px">想和我交换友链?点这里填写申请,审核结果会邮件通知你</span>' +
|
||||
'</span>' +
|
||||
'<span style="flex:none;color:#2f9e63;font-size:18px">›</span>';
|
||||
if (contentEl) {
|
||||
contentEl.innerHTML = '';
|
||||
contentEl.appendChild(card);
|
||||
contentEl.style.cursor = 'pointer';
|
||||
} else {
|
||||
main.appendChild(card);
|
||||
}
|
||||
|
||||
el2.addEventListener('click', function () {
|
||||
if (window.flApplyOpenModal) window.flApplyOpenModal();
|
||||
});
|
||||
el2.addEventListener('mouseenter', function () { card.style.borderColor = 'rgba(47,158,99,.8)'; });
|
||||
el2.addEventListener('mouseleave', function () { card.style.borderColor = 'rgba(47,158,99,.45)'; });
|
||||
} catch (e) { /* 卡片化失败不影响评论 */ }
|
||||
});
|
||||
|
||||
artalk.on('list-loaded', function() {
|
||||
|
||||
Reference in new issue
Block a user