ElEditors, Interface administrators, Administrators
70,975
edits
m (Protected "Module:InfoboxProto": Easily broken pages ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
No edit summary |
||
Line 12: | Line 12: | ||
local infobox = mw.html.create('div'):addClass('infobox-new'); | local infobox = mw.html.create('div'):addClass('infobox-new'); | ||
infobox:tag('div'):addClass('infobox-new-header'):css('background-color', args.color:gsub("%#", "#") | infobox:tag('div'):addClass('infobox-new-header'):css('background-color', args.color:gsub("%#", "#")):wikitext(title); | ||
local img = args.image; | local img = args.image; | ||
if args.image == nil then | if args.image == nil then | ||
Line 21: | Line 20: | ||
-- Adds a normal row | -- Adds a normal row | ||
function addField(param, field_name, double) | function addField(param, field_name, double, field_value) | ||
if args[param] ~= nil then | if args[param] ~= nil or field_value ~= nil then | ||
local row = infobox:tag('div'):addClass('infobox-row'); | local row = infobox:tag('div'):addClass('infobox-row'); | ||
if field_name == nil then | if field_name == nil then | ||
field_name = titleCase(param); | field_name = titleCase(param); | ||
end | |||
if field_value == nil then | |||
field_value = args[param]; | |||
end | end | ||
row:tag('div'):addClass('infobox-row-title'):tag('span'):wikitext(field_name); | row:tag('div'):addClass('infobox-row-title'):tag('span'):wikitext(field_name); | ||
if (param == 'video' or param == 'tree' or param == 'stats') then | if (param == 'video' or param == 'tree' or param == 'stats') then | ||
row:tag('div'):addClass('infobox-row-content'):wikitext( | row:tag('div'):addClass('infobox-row-content'):wikitext(field_value); | ||
else | else | ||
row:tag('div'):addClass('infobox-row-content'):tag('span'):wikitext( | row:tag('div'):addClass('infobox-row-content'):tag('span'):wikitext(field_value); | ||
end | end | ||
end | end |