Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Join the Playtest on Steam Now: SpiritVale

Module:GameSkills: Difference between revisions

From SpiritVale Wiki
No edit summary
No edit summary
Line 145: Line 145:


return (v ~= nil) and tostring(v) or nil
return (v ~= nil) and tostring(v) or nil
end
-- svgInfoIcon: render a small inline info icon (circle + “i”).
local function svgInfoIcon(size)
size = tonumber(size) or 16
return string.format(
'<svg class="sv-ico sv-ico--info" width="%d" height="%d" viewBox="0 0 16 16" aria-hidden="true" focusable="false">' ..
'<circle cx="8" cy="8" r="7" fill="var(--sv-ico-bg, #6aa6ff)"></circle>' ..
'<path d="M8 4.25a1 1 0 1 0 0 2a1 1 0 0 0 0-2zm1 8.5H7V6.5h2v6.25z" fill="var(--sv-ico-fg, #081018)"></path>' ..
'</svg>',
size, size
)
end
end


Line 917: Line 905:
local iconBox = wrap:tag("div")
local iconBox = wrap:tag("div")
iconBox:addClass("sv-herobar-icon")
iconBox:addClass("sv-herobar-icon")
local metaBox = wrap:tag("div")
metaBox:addClass("sv-herobar-meta")


if icon and icon ~= "" then
if icon and icon ~= "" then
Line 925: Line 910:
end
end


if hasNotes then
local textBox = wrap:tag("div")
local notesBtn = mw.html.create("button")
textBox:addClass("sv-herobar-text")
 
local titleBox = textBox:tag("div")
titleBox:addClass("spiritvale-infobox-title")
 
if hasNotes and icon and icon ~= "" then
local notesBtn = mw.html.create("span")
notesBtn:addClass("sv-tip-btn sv-tip-btn--notes")
notesBtn:addClass("sv-tip-btn sv-tip-btn--notes")
notesBtn:attr("type", "button")
notesBtn:attr("role", "button")
notesBtn:attr("tabindex", "0")
notesBtn:attr("data-sv-tip", "notes")
notesBtn:attr("data-sv-tip", "notes")
notesBtn:attr("aria-label", "Notes")
notesBtn:attr("aria-label", "Notes")
notesBtn:attr("aria-expanded", "false")
notesBtn:attr("aria-expanded", "false")
notesBtn:wikitext(svgInfoIcon(16))
notesBtn:tag("span"):addClass("sv-ico sv-ico--info"):attr("aria-hidden", "true"):wikitext("i")
iconBox:node(notesBtn)
iconBox:node(notesBtn)
end
end


metaBox:tag("div")
if hasNotes and (not icon or icon == "") then
:addClass("spiritvale-infobox-title")
local notesBtn = mw.html.create("span")
:wikitext(title)
notesBtn:addClass("sv-tip-btn sv-tip-btn--notes")
notesBtn:attr("role", "button")
notesBtn:attr("tabindex", "0")
notesBtn:attr("data-sv-tip", "notes")
notesBtn:attr("aria-label", "Notes")
notesBtn:attr("aria-expanded", "false")
notesBtn:tag("span"):addClass("sv-ico sv-ico--info"):attr("aria-hidden", "true"):wikitext("i")
titleBox:node(notesBtn)
end
 
titleBox:wikitext(title)


if hasReq then
if hasReq then
local pillRow = metaBox:tag("div")
local pillRow = textBox:tag("div")
pillRow:addClass("sv-pill-row")
pillRow:addClass("sv-pill-row")
local pill = mw.html.create("button")
local pill = mw.html.create("span")
pill:addClass("sv-pill sv-pill--req sv-tip-btn")
pill:addClass("sv-pill sv-pill--req sv-tip-btn")
pill:attr("type", "button")
pill:attr("role", "button")
pill:attr("tabindex", "0")
pill:attr("data-sv-tip", "req")
pill:attr("data-sv-tip", "req")
pill:attr("aria-label", "Requirements")
pill:attr("aria-label", "Requirements")