友链申请入口改URL评论触发+卡片原生风格化; 博主/头衔徽章改浅底描边风格与友链友圈官职统一
Deploy to Production / pre-check (push) Successful in 39s
Deploy to Production / build (push) Successful in 4m55s
Deploy to Production / deploy-edgeone (push) Successful in 4m1s
Deploy to Production / finalize (push) Successful in 25s
Deploy to Production / notify-failure (push) Skipped

This commit is contained in:
zqlit committed 2026-10-03 15:16:00 +08:00
1 parent e84de9033d
commit 36e74d46f4
2 files changed
+50 -24

No files matched your search

+18 -20
View File
@@ -677,9 +677,9 @@ artalk.on('comment-rendered', function(node) {
var badgeWrap = el.querySelector('.atk-badge-wrap');
if (badgeWrap && badgeWrap.parentNode !== nickEl) nickEl.appendChild(badgeWrap);
// 1) 头衔徽章(金色,管理员在后台手动设置,仅次于系统徽章)
// 1) 头衔徽章(金色,管理员在后台手动设置,仅次于系统徽章;配色走 .atk-title-badge 类)
if (data.title_name && !nickEl.querySelector('.atk-title-badge')) {
injectBadge(nickEl, 'atk-title-badge', data.title_name, '头衔: ' + data.title_name, '#b8860b', 'rgba(197,136,27,.16)');
injectBadge(nickEl, 'atk-title-badge', data.title_name, '头衔: ' + data.title_name);
}
// 2) 友链
if (linkMatch) injectBadge(nickEl, 'atk-link-badge', '友链', '友链: ' + linkMatch);
@@ -693,8 +693,8 @@ artalk.on('comment-rendered', function(node) {
}
} catch (e) { /* 徽章注入失败不影响评论 */ }
// ── 置顶评论卡片化:管理员置顶且内容含「友链自助申请」的评论,
// 整条解析成申请入口卡片(点击打开申请弹窗),其余置顶评论不受影响。
// ── 友链申请入口卡片:评论内容就是约定 URL(https://usj.cc/link-apply)时,
// 整条评论解析成申请入口卡片(点击打开申请弹窗),其余评论不受影响。
try {
var d2 = null;
if (node && typeof node.getData === 'function') d2 = node.getData();
@@ -703,9 +703,9 @@ artalk.on('comment-rendered', function(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 (!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;
el2.classList.add('atk-fl-apply');
@@ -735,22 +735,21 @@ artalk.on('comment-rendered', function(node) {
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:14px 16px;margin:6px 0 2px;' +
'background:var(--bg-card,#fff);border:1px solid var(--theme-main-30,rgba(7,193,96,.3));' +
'border-radius:10px;transition:border-color .2s,box-shadow .2s;';
// 跟随评论列表原生观感:白底 + 细边框,只有按钮带主题色
card.style.cssText = 'display:flex;align-items:center;gap:12px;padding:12px 14px;margin:2px 0;' +
'background:var(--bg-card,#fff);border:1px solid var(--border-main,#eeeeee);' +
'border-radius:10px;transition:border-color .2s,background .2s;';
card.innerHTML =
'<img src="' + avatarSrc + '" alt="" referrerpolicy="no-referrer" style="flex:none;width:44px;height:44px;' +
'border-radius:8px;object-fit:cover;box-shadow:0 0 0 2px var(--theme-main-20,rgba(7,193,96,.2))">' +
'<img src="' + avatarSrc + '" alt="" referrerpolicy="no-referrer" style="flex:none;width:40px;height:40px;' +
'border-radius:6px;object-fit:cover">' +
'<span style="flex:1;min-width:0">' +
'<span style="display:flex;align-items:center;gap:6px;font-size:14px;font-weight:600;color:var(--text-main,#333)">' +
'<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">' + nickText.replace(/</g, '&lt;') + '</span>' +
'</span>' +
'<span style="display:block;font-size:13px;margin-top:3px;color:var(--text-desc,#777);line-height:1.5">' +
'<b style="color:var(--theme-main,#07c160);font-weight:600">友链自助申请</b>' +
'<span style="color:var(--text-muted,#999)"> · </span>想和我交换友链?点这里填写申请,审核结果会邮件通知你' +
'</span>' +
'<span style="display:block;font-size:13px;margin-top:2px;color:var(--text-desc,#777);line-height:1.5">想和我交换友链?点击申请,审核结果会邮件通知你</span>' +
'</span>' +
'<span style="flex:none;color:var(--theme-main,#07c160);font-size:20px;line-height:1">›</span>';
'<span style="flex:none;background:var(--theme-main-20,rgba(7,193,96,.2));color:var(--theme-main,#07c160);' +
'font-size:13px;font-weight:600;padding:6px 14px;border-radius:999px;white-space:nowrap">申请友链</span>';
// 昵称行追加官方徽章(博主),样式与评论区徽章一致
if (sysBadge) {
var bw = sysBadge.cloneNode(true);
@@ -771,11 +770,10 @@ artalk.on('comment-rendered', function(node) {
});
el2.addEventListener('mouseenter', function () {
card.style.borderColor = 'var(--theme-main,#07c160)';
card.style.boxShadow = '0 2px 12px var(--theme-main-20,rgba(7,193,96,.2))';
card.style.background = 'var(--bg-card,#fff)';
});
el2.addEventListener('mouseleave', function () {
card.style.borderColor = 'var(--theme-main-30,rgba(7,193,96,.3))';
card.style.boxShadow = 'none';
card.style.borderColor = 'var(--border-main,#eeeeee)';
});
} catch (e) { /* 卡片化失败不影响评论 */ }
});