Module:Sandbox/LVL: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Tooltip fix |
No edit summary |
||
| Line 632: | Line 632: | ||
end) | end) | ||
-- Iterate heroes | |||
for _, hero_entry in ipairs(sorted_heroes) do | for _, hero_entry in ipairs(sorted_heroes) do | ||
local hero_key = hero_entry.key | local hero_key = hero_entry.key | ||
| Line 725: | Line 725: | ||
-- Build tooltip content showing scaling info | -- Build tooltip content showing scaling info | ||
local tooltip_lines = {} | local tooltip_lines = {} | ||
local has_scaling = false | |||
if type(base_value) == "number" then | if type(base_value) == "number" then | ||
table.insert(tooltip_lines, string.format("Base: %s", util_module.round_to_sig_fig(base_value, 3))) | table.insert(tooltip_lines, string.format("Base: %s", util_module.round_to_sig_fig(base_value, 3))) | ||
| Line 735: | Line 737: | ||
if tp_boon_scale and tp_boon_scale > 0 then | if tp_boon_scale and tp_boon_scale > 0 then | ||
table.insert(tooltip_lines, string.format("Level: +%s per boon", tp_boon_scale)) | table.insert(tooltip_lines, string.format("Level: +%s per boon", tp_boon_scale)) | ||
has_scaling = true | |||
end | end | ||
else | else | ||
| Line 740: | Line 743: | ||
if level_scale and level_scale > 0 then | if level_scale and level_scale > 0 then | ||
table.insert(tooltip_lines, string.format("Level: +%s per boon", level_scale)) | table.insert(tooltip_lines, string.format("Level: +%s per boon", level_scale)) | ||
has_scaling = true | |||
end | end | ||
if spirit_scale and spirit_scale > 0 then | if spirit_scale and spirit_scale > 0 then | ||
table.insert(tooltip_lines, string.format("Spirit: +%s per point", spirit_scale)) | table.insert(tooltip_lines, string.format("Spirit: +%s per point", spirit_scale)) | ||
has_scaling = true | |||
end | end | ||
end | end | ||
| Line 761: | Line 763: | ||
) | ) | ||
-- Build cell with tooltip wrapper | -- Build cell with tooltip wrapper ONLY if there is scaling | ||
local cell_inner = string.format( | local cell_inner | ||
if has_scaling then | |||
cell_inner = string.format( | |||
'<span class="tooltip-container">' .. | |||
'<span class="tooltip-trigger" tabindex="0"><span class="stat-num">%s</span></span>' .. | |||
'<span class="tooltip-content" role="tooltip">%s</span>' .. | |||
'</span>', | |||
) | stat_value, | ||
tooltip_text | |||
) | |||
else | |||
cell_inner = string.format('<span class="stat-num">%s</span>', stat_value) | |||
end | |||
-- Add it to the row with data attributes and span wrapper | -- Add it to the row with data attributes and span wrapper | ||