Module:HeroData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Sort hero comparison table alphabetically; minor code cleanup |
Made the hero attribute table hero column and stat row sticky. |
||
| Line 649: | Line 649: | ||
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 | -- First column in each row is hero name (sticky) | ||
row_str = row_str .. | row_str = row_str .. '<td style="position: sticky; left: 0; z-index: 10; background-color: #202122; isolation: isolate;">' .. hero_icon .. "</td>" | ||
-- Consecutive columns are then stats | -- Consecutive columns are then stats | ||
| Line 709: | Line 709: | ||
-- First header is Hero | -- First header is Hero (sticky) | ||
local headers_str = | local headers_str = '<th style="position: sticky; left: 0; top: 0; z-index: 12; background-color: #27292d; isolation: isolate;">Hero</th>' | ||
local header_style = "" | local header_style = "" | ||
local category_data = attribute_module.get_category_data() | local category_data = attribute_module.get_category_data() | ||
| Line 763: | Line 763: | ||
end | end | ||
header_style = ' style="background-color: | header_style = ' style="position: sticky; top: 0; z-index: 3; background-color: rgb(' .. category_rgb .. ');"' | ||
headers_str = headers_str .. "<th" .. header_style .. ">" .. attr_localized .. postfix .. "</th>" | headers_str = headers_str .. "<th" .. header_style .. ">" .. attr_localized .. postfix .. "</th>" | ||
| Line 772: | Line 772: | ||
local table_str = '<table class="wikitable sortable" style="table-layout: auto; width: 100%;">' .. headers_str .. body_str .. "</table>" | local table_str = '<table class="wikitable sortable" style="table-layout: auto; width: 100%;">' .. headers_str .. body_str .. "</table>" | ||
local output_str = '<div style="overflow- | local output_str = '<div style="overflow: auto; max-height: 70vh; width: 100%;">' .. table_str .. '</div>' | ||
return output_str | return output_str | ||
end | end | ||