Module:Infobox: Difference between revisions

Undo last 2 edits, mw.html doesn't seem to support select tags
No edit summary
Tag: Reverted
(Undo last 2 edits, mw.html doesn't seem to support select tags)
Tag: Manual revert
Line 423:
:addClass('infobox-buttons')
:attr('data-default-version', self.default_version)
-- Dropdown list instead of buttons if too many versions
if self.versions > self.max_buttons then
buttons:addClass('infobox-buttons-select')
-- Dropdown list instead of buttons if too many versions
end
local select = buttons:tag('select')
-- Create all the buttons
:addClass('infobox-buttons-select')
for version=1, self.versions do
:attr('id', 'infobox-'..self.infobox_name)
local select = buttons:tag('selectspan')
:attr('name', 'infobox-'..self.infobox_name)
:attr('data-switch-index', version)
for version=1, self.versions do
:attr('data-switch-anchor', '#'..self.version_names[version])
select:tag('option')
:attraddClass('valuebutton', version)
:attrwikitext('data-switch-index', self.version_names[version])
:attr('data-switch-anchor', '#'..self.version_names[version])
:wikitext(self.version_names[version])
end
else
-- Individual buttons if not too many versions
for version=1, self.versions do
buttons:tag('span')
:attr('data-switch-index', version)
:attr('data-switch-anchor', '#'..self.version_names[version])
:addClass('button')
:wikitext(self.version_names[version])
end
end
end