Module:NavboxMobile: Difference between revisions
EnWikiAdmin (talk | contribs) No edit summary |
EnWikiAdmin (talk | contribs) No edit summary |
||
Line 330: | Line 330: | ||
local listRow = addTableRow(tbl) -- Use a different variable name | local listRow = addTableRow(tbl) -- Use a different variable name | ||
local listCell = listRow:tag('td') | local listCell = listRow:tag('td') | ||
-- Determine if the current list is even or odd | |||
local isOdd = (listnum % 2) == 1 | |||
local evenOdd = isOdd and 'odd' or 'even' | |||
listCell | listCell | ||
:attr('colspan', 2) | :attr('colspan', 2) | ||
:addClass('navboxMobile-list-content') | :addClass('navboxMobile-list-content') | ||
:addClass('hlist') | :addClass('hlist') | ||
: | :addClass('navboxMobile-' .. evenOdd) -- **Added Line** | ||
:cssText(args.liststyle) | :cssText(args.liststyle) | ||
:cssText(args['list' .. listnum .. 'style']) | :cssText(args['list' .. listnum .. 'style']) | ||
:wikitext(processItem(args['list' .. listnum], args.nowrapitems)) | |||
-- Handle nested lists (`childX_groupY`, `childX_listY`) | -- Handle nested lists (`childX_groupY`, `childX_listY`) | ||
Line 346: | Line 351: | ||
:css('width', '100%') | :css('width', '100%') | ||
:css('border-spacing', '0') | :css('border-spacing', '0') | ||
:css('padding', args.nestedPadding or '0. | :css('padding', args.nestedPadding or '0.25em') -- **Modified Line** | ||
for i = 1, 10 do -- Assume up to 10 nested groups/lists | for i = 1, 10 do -- Assume up to 10 nested groups/lists | ||
Line 362: | Line 367: | ||
:attr('scope', 'row') | :attr('scope', 'row') | ||
:addClass('navboxMobile-group-content') | :addClass('navboxMobile-group-content') | ||
:addClass('navboxMobile-subgroup-group') -- **Added Line** | |||
:cssText(args.basestyle) | :cssText(args.basestyle) | ||
:cssText(args['child' .. listnum .. '_group' .. i .. 'style']) | :cssText(args['child' .. listnum .. '_group' .. i .. 'style']) | ||
:css('padding-bottom', '0.25em') -- **Added Line** | |||
:wikitext(processItem(nestedGroup)) | :wikitext(processItem(nestedGroup)) | ||
end | end | ||
Line 373: | Line 380: | ||
:attr('colspan', 2) | :attr('colspan', 2) | ||
:addClass('navboxMobile-list-content') | :addClass('navboxMobile-list-content') | ||
:addClass('hlist') -- | :addClass('hlist') | ||
:addClass('navboxMobile-' .. (i % 2 == 1 and 'odd' or 'even')) -- **Optional: Handle nested even/odd** | |||
:cssText(args['child' .. listnum .. '_list' .. i .. 'style']) | :cssText(args['child' .. listnum .. '_list' .. i .. 'style']) | ||
:wikitext(processItem(nestedList)) | :wikitext(processItem(nestedList)) |