572
edits
(Add support for Township resources) |
(Add CSS class support (for Township stats Population, Workers, Storage)) |
||
Line 314: | Line 314: | ||
['Siren'] = true, | ['Siren'] = true, | ||
['Lightning Spirit'] = true, | ['Lightning Spirit'] = true, | ||
} | |||
--When calling for an icon for Key, add a css class | |||
local imgClassOverrides = { | |||
['Population'] = 'township-colortoggle', | |||
['Workers'] = 'township-colortoggle', | |||
['Storage'] = 'township-colortoggle', | |||
} | } | ||
Line 329: | Line 335: | ||
local qty = args.qty | local qty = args.qty | ||
local img = args.img ~= nil and args.img ~= '' and args.img or link | local img = args.img ~= nil and args.img ~= '' and args.img or link | ||
local class = args.class ~= nil and args.class ~= '' and args.class or '' | |||
link = fixPagename(link) | link = fixPagename(link) | ||
Line 355: | Line 362: | ||
end | end | ||
end | end | ||
local ovrClass = imgClassOverrides[link] | |||
-- Type & extension overrides must be after adjustments have been made | -- Type & extension overrides must be after adjustments have been made | ||
-- for any image overrides | -- for any image overrides | ||
Line 385: | Line 393: | ||
iconType = ovrType | iconType = ovrType | ||
end | end | ||
if ovrClass ~= nil then | |||
class = ovrClass | |||
end | |||
class = class ~= nil and class ~= '' and ' class="'..class..'"' or '' | |||
-- There are a couple specific double overrides to be included that don't fit in the above lists | -- There are a couple specific double overrides to be included that don't fit in the above lists | ||
if ambiguousOverrides[link] then | if ambiguousOverrides[link] then | ||
Line 422: | Line 434: | ||
return '{| class="articletable" style="display:inline-block;vertical-align:middle;"\r\n|-\r\n|' .. resultText .. '\r\n|}' | return '{| class="articletable" style="display:inline-block;vertical-align:middle;"\r\n|-\r\n|' .. resultText .. '\r\n|}' | ||
elseif not noicon then | elseif not noicon then | ||
return '<span style="display:inline-block">' .. resultText .. '</span>' | return '<span style="display:inline-block"'..class..'>' .. resultText .. '</span>' | ||
else | else | ||
return resultText | return resultText |
edits