"मोड्युल:Userbox" का संशोधनहरू बिचको अन्तर

Jump to navigation Jump to search
track bad colour contrast and userboxes in mainspace per protected edit request by User:Kephir
(performance tweaks - avoid looking up every single parameter in the frame object, and only load Module:Arguments when necessary)
(track bad colour contrast and userboxes in mainspace per protected edit request by User:Kephir)
-- Get table tag values.
data.backgroundColor = args['info-background'] or args[2] or args['info-c'] or '#eee'
 
-- Get info values.
data.info = args.info or args[4] or "''<code>{{{info''}}}</code>"
data.infoTextAlign = args['info-a'] or 'left'
data.infoFontSize = checkNumAndAddSuffix(args['info-size'] or args['info-s'], 8, 'pt')
data.infoHeight = checkNumAndAddSuffix(args['logo-height'] or args['id-h'], 45, 'px')
data.infoPadding = args['info-padding'] or args['info-p'] or '0 4px 0 4px'
data.infoLineHeight = args['info-line-height'] or args['info-lh'] or '1.25em'
data.infoColor = args['info-color'] or args['info-fc'] or 'black'
data.infoOtherParams = args['info-other-param'] or args['info-op']
data.infoClass = args['info-class']
 
-- Get id values.
data.idTextAlign = args['id-a'] or 'center'
data.idFontSize = checkNumAndAddSuffix(args['logo-size'] or args[5] or args['id-s'], 14, 'pt')
data.idColor = args['logo-color'] or args['id-fc'] or 'black'data.infoColor
data.idPadding = args['logo-padding'] or args['id-p'] or '0 1px 0 0'
data.idLineHeight = args['logo-line-height'] or args['id-lh'] or '1.25em'
data.idOtherParams = args['logo-other-param'] or args['id-op']
data.idClass = args['id-class']
 
-- Get info values.
data.info = args.info or args[4] or "''info''"
data.infoTextAlign = args['info-a'] or 'left'
data.infoFontSize = checkNumAndAddSuffix(args['info-size'] or args['info-s'], 8, 'pt')
data.infoHeight = checkNumAndAddSuffix(args['logo-height'] or args['id-h'], 45, 'px')
data.infoPadding = args['info-padding'] or args['info-p'] or '0 4px 0 4px'
data.infoLineHeight = args['info-line-height'] or args['info-lh'] or '1.25em'
data.infoColor = args['info-color'] or args['info-fc'] or 'black'
data.infoOtherParams = args['info-other-param'] or args['info-op']
data.infoClass = args['info-class']
 
return data
-- Get table tag values.
data.backgroundColor = args[2] or args['info-c'] or '#eeeeee'
 
-- Get info values.
data.info = args[4] or args.info or "''<code>{{{info''}}}</code>"
data.infoTextAlign = args['info-a'] or 'left'
data.infoFontSize = checkNumAndAddSuffix(args['info-s'], 8, 'pt')
data.infoColor = args[8] or args['info-fc'] or 'black'
data.infoPadding = args['info-p'] or '0 4px 0 4px'
data.infoLineHeight = args['info-lh'] or '1.25em'
data.infoOtherParams = args['info-op']
 
-- Get id values.
data.idFontSize = checkNumAndAddSuffix(args['id1-s'], 14, 'pt')
data.idLineHeight = args['id1-lh'] or '1.25em'
data.idColor = args['id1-fc'] or 'black'data.infoColor
data.idPadding = args['id1-p'] or '0 1px 0 0'
data.idOtherParams = args['id1-op']
 
-- Get info values.
data.info = args[4] or args.info or "''info''"
data.infoTextAlign = args['info-a'] or 'left'
data.infoFontSize = checkNumAndAddSuffix(args['info-s'], 8, 'pt')
data.infoColor = args[8] or args['info-fc'] or 'black'
data.infoPadding = args['info-p'] or '0 4px 0 4px'
data.infoLineHeight = args['info-lh'] or '1.25em'
data.infoOtherParams = args['info-op']
 
-- Get id2 values.
data.id2FontSize = checkNumAndAddSuffix(args['id2-s'], 14, 'pt')
data.id2LineHeight = args['id2-lh'] or '1.25em'
data.id2Color = args['id2-fc'] or 'black'data.infoColor
data.id2Padding = args['id2-p'] or '0 0 0 1px'
data.id2OtherParams = args['id2-op']
 
-- Get info values.
data.info = args.info or args[4] or "''<code>{{{info''}}}</code>"
data.infoTextAlign = args['info-align'] or args['info-a'] or 'left'
data.infoFontSize = checkNumAndAddSuffix(args['info-size'] or args['info-s'], 8, 'pt')
data.id2TextAlign = args['id-a'] or 'center'
data.id2FontSize = checkNumAndAddSuffix(args['logo-size'] or args[5] or args['id-s'], 14, 'pt')
data.id2Color = args['logo-color'] or args['id-fc'] or 'black'data.infoColor
data.id2Padding = args['logo-padding'] or args['id-p'] or '0 0 0 1px'
data.id2LineHeight = args['logo-line-height'] or args['id-lh'] or '1.25em'
 
function p.render(data)
local legible = true
local contrast = require('Module:Color contrast')._ratio
 
-- Renders the userbox html using the content of the data table.
-- Render the div tag html.
:addClass(data.idClass)
:wikitext(data.id)
 
if contrast { data.idColor, data.idBackgroundColor, error = 0 } < 4.5 then
legible = false
end
end
 
:addClass(data.infoClass)
:wikitext(data.info)
 
if contrast { data.infoColor, data.backgroundColor, error = 0 } < 4.5 then
legible = false
end
-- Render the second id html.
:cssText(data.id2OtherParams)
:wikitext(data.id2)
if contrast { data.id2Color, data.id2BackgroundColor, error = 0 } < 4.5 then
legible = false
end
end
if not legible then
root:wikitext('[[Category:Potentially illegible userboxes]]')
end
 
chargs.page = page
chargs.nocat = args.nocat
chargs.main = '[[Category:Pages with misplaced templates]]'
if args.notcatsubpages then
chargs.subpage = 'no'
"https://ne.wikipedia.org/wiki/विशेष:MobileDiff/580193" बाट अनुप्रेषित

पथप्रदर्शन विकल्प