v0.5.87: fill ability loc tokens and tidy skill detail layout.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+18
-11
@@ -2254,7 +2254,7 @@ function mountSkillInspect(root, skillEnt, heroKey) {
|
||||
main.appendChild(head);
|
||||
const desc = document.createElement("div");
|
||||
desc.className = "skill-info-desc";
|
||||
desc.textContent = skillEnt.desc_loc || "暂无描述";
|
||||
desc.textContent = stripItemDesc(skillEnt.desc_loc) || "暂无描述";
|
||||
main.appendChild(desc);
|
||||
|
||||
// Params panel, dota2.com.cn layout: a two-column "generic" grid of meta
|
||||
@@ -2267,7 +2267,8 @@ function mountSkillInspect(root, skillEnt, heroKey) {
|
||||
row.className = "skill-param";
|
||||
const lab = document.createElement("span");
|
||||
lab.className = "skill-param-label";
|
||||
lab.textContent = label + ":";
|
||||
// Defensive: stale caches may still carry Valve <font> in special labels.
|
||||
lab.textContent = stripItemDesc(label) + ":";
|
||||
const val = document.createElement("span");
|
||||
val.className = "skill-param-value";
|
||||
val.textContent = value;
|
||||
@@ -2310,7 +2311,10 @@ function mountSkillInspect(root, skillEnt, heroKey) {
|
||||
main.appendChild(params);
|
||||
}
|
||||
|
||||
// Cooldown / mana footer with icons (actives only; passives have neither).
|
||||
// Bottom cluster (costs + lore) shares one margin-top:auto so lore is not
|
||||
// pushed past the column height after the sunk cooldown row.
|
||||
const foot = document.createElement("div");
|
||||
foot.className = "skill-info-foot";
|
||||
const passiveLike =
|
||||
skillEnt.target_label === "被动" || skillEnt.target_label === "光环";
|
||||
if (!passiveLike && (skillEnt.cooldown || skillEnt.mana_cost)) {
|
||||
@@ -2342,15 +2346,16 @@ function mountSkillInspect(root, skillEnt, heroKey) {
|
||||
mp.appendChild(txt);
|
||||
costs.appendChild(mp);
|
||||
}
|
||||
main.appendChild(costs);
|
||||
foot.appendChild(costs);
|
||||
}
|
||||
|
||||
// Flavor lore line.
|
||||
if (skillEnt.lore_loc) {
|
||||
const lore = document.createElement("div");
|
||||
lore.className = "skill-info-lore";
|
||||
lore.textContent = skillEnt.lore_loc;
|
||||
main.appendChild(lore);
|
||||
lore.textContent = stripItemDesc(skillEnt.lore_loc);
|
||||
foot.appendChild(lore);
|
||||
}
|
||||
if (foot.childElementCount) {
|
||||
main.appendChild(foot);
|
||||
}
|
||||
|
||||
body.appendChild(main);
|
||||
@@ -3160,8 +3165,10 @@ function statChip(icon) {
|
||||
}
|
||||
|
||||
function patchNoteHtml(note) {
|
||||
const esc = escapeHtml(note == null ? "" : String(note));
|
||||
return esc.replace(/<br\s*\/?>/gi, "<br/>");
|
||||
// Valve notes carry <br>, <font color=…>, <span class="New|Subtitle|…">.
|
||||
// Keep line breaks; strip the rest so raw tags never leak into the UI.
|
||||
const plain = stripItemDesc(note);
|
||||
return escapeHtml(plain).replace(/\n/g, "<br/>");
|
||||
}
|
||||
|
||||
function renderNotesList(notes) {
|
||||
@@ -3250,7 +3257,7 @@ function renderPatchSection(root, title, html) {
|
||||
if (!html) return;
|
||||
const sec = document.createElement("section");
|
||||
sec.className = "patch-section";
|
||||
sec.innerHTML = `<h3 class="patch-section-title">${escapeHtml(title)}</h3>${html}`;
|
||||
sec.innerHTML = `<h3 class="patch-section-title">${escapeHtml(stripItemDesc(title))}</h3>${html}`;
|
||||
root.appendChild(sec);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user