Module:OOO/Variants: Difference between revisions
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
-- Renders a TabberNeue block of OOOInfoBox variants, wrapped so it aligns with the infobox. | -- Renders a TabberNeue block of OOOInfoBox variants, wrapped so it aligns with the infobox. | ||
-- Usage: | -- Usage: | ||
-- {{OOOVariants|400162|400163|400113|400169|400170}} | -- {{OOOVariants|400162|400163|400113|400169|400170}} -- scroll is default | ||
-- {{OOOVariants | label1=2 m | art1=400162 | -- {{OOOVariants|400162|400163|...|mode=wrap}} -- opt-in wrap | ||
-- {{OOOVariants | label1=2 m | art1=400162 | width=300 | align=left }} -- still works | |||
-- | -- | ||
-- Global params: | -- Global params: | ||
-- |domain=Buildings -- bucket | -- |domain=Buildings -- bucket (default: Buildings) | ||
-- |align=right|left|none|center | -- |align=right|left|none|center | ||
-- |width=300 -- px; applies to wrapper + OOOInfoBox (240–600) | -- |width=300 -- px; applies to wrapper + OOOInfoBox (240–600) | ||
-- |mode=wrap | -- |mode=scroll|wrap -- default: scroll (adds class used by gadget) | ||
-- | -- | ||
-- Per-tab overrides (append N): | -- Per-tab overrides (append N): | ||
Line 43: | Line 44: | ||
local domain = tostring_or_nil(args.domain or args.type) or 'Buildings' | local domain = tostring_or_nil(args.domain or args.type) or 'Buildings' | ||
local align = tostring_or_nil(args.align) or 'right' | local align = tostring_or_nil(args.align) or 'right' | ||
local mode = tostring_or_nil(args.mode) or ' | local mode = tostring_or_nil(args.mode) or 'scroll' -- DEFAULT: scroll | ||
local width = tonumber(args.width) | local width = tonumber(args.width) | ||
Line 91: | Line 92: | ||
wrap:addClass('ooo-infobox-tabwrap--center') | wrap:addClass('ooo-infobox-tabwrap--center') | ||
end | end | ||
if mode | |||
-- Scroll is default; only skip when explicitly |mode=wrap | |||
if mode ~= 'wrap' then | |||
wrap:addClass('ooo-infobox-tabwrap--scroll') | wrap:addClass('ooo-infobox-tabwrap--scroll') | ||
end | end | ||
if width and width >= 240 and width <= 600 then | if width and width >= 240 and width <= 600 then | ||
wrap:css('width', tostring(width) .. 'px') | wrap:css('width', tostring(width) .. 'px') |