Module:Navbox: Difference between revisions

From Polyphasic Sleep Wiki
suppress images inside navboxes showing up in Media Viewer
 
Created page with "-- -- This module implements {{Navbox}} -- local p = {} local navbar = require('Module:Navbar')._navbar local getArgs -- lazily initialized local args local border local li..."
Line 115: Line 115:
if args.titlegroup then
if args.titlegroup then
titleCell
titleCell
:css('border-left', '2px solid #fdfdfd')
:addClass('navbox-title1')
:css('width', '100%')
end
end


Line 192: Line 191:
row
row
:tag('td')
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass('navbox-image')
:addClass(args.imageclass)
:addClass(args.imageclass)
Line 229: Line 227:
if args['group' .. listnum] then
if args['group' .. listnum] then
listCell
listCell
:css('text-align', 'left')
:addClass('navbox-list1')
:css('border-left-width', '2px')
:css('border-left-style', 'solid')
else
else
listCell:attr('colspan', 2)
listCell:attr('colspan', 2)
Line 269: Line 265:
row
row
:tag('td')
:tag('td')
:addClass('noviewer')
:addClass('navbox-image')
:addClass('navbox-image')
:addClass(args.imageclass)
:addClass(args.imageclass)
Line 315: Line 310:


local function isIllegible()
local function isIllegible()
local styleratio = require('Module:Color contrast')._styleratio
local success, styleratio = pcall(function() return require('Module:Color contrast')._styleratio end)
 
if not success then return false end
for key, style in pairs(args) do
for key, style in pairs(args) do
if tostring(key):match("style$") then
if tostring(key):match("style$") then
Line 453: Line 448:
getArgs = require('Module:Arguments').getArgs
getArgs = require('Module:Arguments').getArgs
end
end
args = getArgs(frame, {wrappers = {'Template:Navbox'}})
args = getArgs(frame, {wrappers = {'Template:Navbox', 'Template:Navbox subgroup'}})
if frame.args.border then
-- This allows Template:Navbox_subgroup to use {{#invoke:Navbox|navbox|border=...}}.
args.border = frame.args.border
end


-- Read the arguments in the order they'll be output in, to make references number in the right order.
-- Read the arguments in the order they'll be output in, to make references number in the right order.