Module:NavboxMobile: Difference between revisions

No edit summary
No edit summary
Line 292: Line 292:


         if args[groupKey] then
         if args[groupKey] then
             -- Add custom inline styles for group headings
             -- Add group (heading) row
            local groupInlineStyles = ""
            if parentLevel == 2 then
                groupInlineStyles = "box-shadow: inset 5px 0 #fff, inset -5px 0 #fff;"
            elseif parentLevel == 3 then
                groupInlineStyles = "box-shadow: inset 10px 0 #fff, inset -10px 0 #fff;"
            end
 
            -- Render the group (heading)
             local groupRow = addTableRow(tbl)
             local groupRow = addTableRow(tbl)
             local groupCell = groupRow:tag('th')
             local groupCell = groupRow:tag('th')
Line 306: Line 298:
                 :addClass('navboxMobile-group-content')
                 :addClass('navboxMobile-group-content')
                 :addClass('navboxMobile-group-level' .. parentLevel)
                 :addClass('navboxMobile-group-level' .. parentLevel)
                :attr('data-level', parentLevel)
                :cssText(groupInlineStyles)
                 :wikitext(processItem(args[groupKey]))
                 :wikitext(processItem(args[groupKey]))


             -- Render the list (content)
             -- Add list (content) row
             if args[listKey] then
             if args[listKey] then
                 local listRow = addTableRow(tbl)
                 local listRow = addTableRow(tbl)
Line 319: Line 309:
                     :addClass((i % 2 == 1) and 'navboxMobile-odd' or 'navboxMobile-even')
                     :addClass((i % 2 == 1) and 'navboxMobile-odd' or 'navboxMobile-even')
                     :css('padding', '0 0.25em')
                     :css('padding', '0 0.25em')
                     :css('width', parentLevel == 2 and '95%' or '90%') -- Adjust width for narrowing
                     :css('box-shadow', parentLevel == 2 and "inset 5px 0 #fff, inset -5px 0 #fff" or "inset 10px 0 #fff, inset -10px 0 #fff") -- Apply box shadow dynamically
 
                -- Add box shadow for list contents
                local listInlineStyles = ""
                if parentLevel == 2 then
                    listInlineStyles = "box-shadow: inset 5px 0 #fff, inset -5px 0 #fff;"
                elseif parentLevel == 3 then
                    listInlineStyles = "box-shadow: inset 10px 0 #fff, inset -10px 0 #fff;"
                end
                listCell:cssText(listInlineStyles)


                 if args[listKey] == 'child' then
                 if args[listKey] == 'child' then
Line 342: Line 323:
     end
     end
end
end