style(dnfs): 美化卡片发帖用户显示为头像+昵称胶囊
- dnfs.js: owner 纯文本改为首字符圆形头像 + 昵称,空值兜底匿名 - theme.css: 新增 Owner Chip 样式段,复用主题变量自动适配深色模式
This commit is contained in:
1 parent
a905dac00d
commit
dae81ba4a1
2 files changed
+52
-10
No files matched your search
@@ -224,6 +224,38 @@ input[type="button"]:disabled {
|
|||||||
.recommend-list .card h3 { transition: color 0.15s; }
|
.recommend-list .card h3 { transition: color 0.15s; }
|
||||||
.recommend-list .card p { font-size: 0.9rem; line-height: 1.6; color: var(--fg-secondary); }
|
.recommend-list .card p { font-size: 0.9rem; line-height: 1.6; color: var(--fg-secondary); }
|
||||||
|
|
||||||
|
/* ===== Owner Chip (dnfs 发帖用户) ===== */
|
||||||
|
.card-owner {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 0.4rem;
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
}
|
||||||
|
.owner-avatar {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
width: 22px;
|
||||||
|
height: 22px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--accent-soft);
|
||||||
|
color: var(--accent-dark);
|
||||||
|
border: 1px solid var(--accent);
|
||||||
|
font-size: 0.7rem;
|
||||||
|
font-weight: 700;
|
||||||
|
flex-shrink: 0;
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
.owner-name {
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--fg-secondary);
|
||||||
|
max-width: 200px;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
/* ===== Minimap (dnfs) ===== */
|
/* ===== Minimap (dnfs) ===== */
|
||||||
.minimap {
|
.minimap {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
|||||||
+20
-10
@@ -269,17 +269,27 @@ function load_notes(main_node) {
|
|||||||
ttl.appendChild(ttl1);
|
ttl.appendChild(ttl1);
|
||||||
card.appendChild(ttl);
|
card.appendChild(ttl);
|
||||||
let wrt_div = document.createElement('p');
|
let wrt_div = document.createElement('p');
|
||||||
let vit_div = document.createElement('p');
|
//let vit_div = document.createElement('p');
|
||||||
let lke_div = document.createElement('p');
|
//let lke_div = document.createElement('p');
|
||||||
let srd_div = document.createElement('p');
|
//let srd_div = document.createElement('p');
|
||||||
wrt_div.textContent = "用户:" + item.owner;
|
// 发帖用户:头像圆点(取昵称首字符)+ 昵称,样式见 theme.css 的 Owner Chip 段
|
||||||
vit_div.textContent = "观看数:" + item.visit_count;
|
wrt_div.className = "card-owner";
|
||||||
lke_div.textContent = "点赞数:" + item.like_count;
|
let owner_text = (item.owner == null || item.owner === "") ? "匿名" : String(item.owner);
|
||||||
srd_div.textContent = "分享数:" + item.share_count;
|
let owner_avatar = document.createElement('span');
|
||||||
|
owner_avatar.className = "owner-avatar";
|
||||||
|
owner_avatar.textContent = owner_text.trim().charAt(0).toUpperCase() || "?";
|
||||||
|
let owner_name = document.createElement('span');
|
||||||
|
owner_name.className = "owner-name";
|
||||||
|
owner_name.textContent = owner_text;
|
||||||
|
wrt_div.appendChild(owner_avatar);
|
||||||
|
wrt_div.appendChild(owner_name);
|
||||||
|
//vit_div.textContent = "观看数:" + item.visit_count;
|
||||||
|
//lke_div.textContent = "点赞数:" + item.like_count;
|
||||||
|
//srd_div.textContent = "分享数:" + item.share_count;
|
||||||
ttl.appendChild(wrt_div);
|
ttl.appendChild(wrt_div);
|
||||||
ttl.appendChild(vit_div);
|
//ttl.appendChild(vit_div);
|
||||||
ttl.appendChild(lke_div);
|
//ttl.appendChild(lke_div);
|
||||||
ttl.appendChild(srd_div);
|
//ttl.appendChild(srd_div);
|
||||||
let ctt = document.createElement('p');
|
let ctt = document.createElement('p');
|
||||||
renderMarkdown(ctt, item.content);
|
renderMarkdown(ctt, item.content);
|
||||||
card.appendChild(ctt)
|
card.appendChild(ctt)
|
||||||
|
|||||||
Reference in new issue
Block a user