Module:HeroData: Difference between revisions

LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
No edit summary
Line 401: Line 401:
end
end
table.sort(sorted_heroes, function(a, b)
table.sort(sorted_heroes, function(a, b)
return (a.data["Name"] or a.key) < (b.data["Name"] or b.key)
    local function getSortName(name)
        return (name:gsub("^The ", ""))
    end
    local nameA = getSortName(a.data["Name"] or a.key)
    local nameB = getSortName(b.data["Name"] or b.key)
    return nameA < nameB
end)
end)


Line 420: Line 425:
template_title = "Template:HeroIcon"
template_title = "Template:HeroIcon"
template_args[1] = hero_name_en
template_args[1] = hero_name_en
template_args[2] = hero_name
template_args["l1"] = hero_name
hero_icon = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args }
hero_icon = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args }
-- First column in each row is hero name (sticky)
-- First column in each row is hero name (sticky)
row_str = row_str .. '<td style="position: sticky; left: 0; z-index: 10; background-color: #202122; isolation: isolate;">' .. hero_icon .. "</td>"
row_str = row_str .. '<td style="position: sticky; left: 0; z-index: 10; background-color: #202122; isolation: isolate; overflow: hidden;">' .. hero_icon .. "</td>"
-- Consecutive columns are then stats
-- Consecutive columns are then stats