Changes

Jump to: navigation, search

Module:Message box

1,955 bytes added, 17:56, 20 September 2013
add imbox
local htmlBuilder = require('Module:HtmlBuilder')
local yesno = require('Module:Yesno')
local p = {}
function p.build(data, args)
-- Process config data.
local isSmall = args.small == 'yes' or args.small == true
local typeData = data.types[args.type]
local invalidType = args.type and not typeData and true or false
typeData = typeData or data.types[data.default]
local isSmall = (args.small == 'yes' or args.small == true) and true or false
local image, imageRight, text, imageSize
if isSmall then
imageRight = args.smallimageright or args.imageright
text = args.smalltext or args.text
imageSize = data.imageSizeSmall or data.imageSizeor '40x40px'
else
image = args.image
imageRight = args.imageright
text = args.text
imageSize = data.imageSizeLarge or data.imageSizeor '40x40px'
end
end
box
.addClass(isSmall and 'mbox-small')
.addClass(data.classPlainlinksYesno and yesno(args.plainlinks or true) and 'plainlinks')
.addClass(typeData.class)
.addClass(args.class)
elseif data.imageEmptyCell then
row.tag('td')
.addClass('mbox-empty-cell')-- No image. Cell with some width or padding necessary for text cell to have 100% width.
end
-- Add the right-hand image.
if imageRight and not (data.imageRightNone and imageRight == 'none') then
row.tag('td')
.addClass('mbox-imageright')
.wikitext(imageRight)
end
 
-- Add the below row.
if data.below and args.below then
box.tag('tr')
.tag('td')
.attr('colspan', args.imageright and '3' or '2')
.addClass('mbox-text')
.cssText(args.textstyle)
.wikitext(args.below)
end
data.default = 'system'
data.classes = { 'plainlinks', 'fmbox' }
data.imageSize = '40x40px'
data.imageEmptyCell = false
data.imageRightNone = false
return p.build(data, args)
end
data.imageSizeSmall = '30x30px'
data.imageEmptyCell = true
data.imageRightNone = true
return p.build(data, args)
end
 
function p._imbox(args)
local data = {}
data.types = {
speedy = {
class = 'imbox-speedy',
image = 'Imbox speedy deletion.png'
},
delete = {
class = 'imbox-delete',
image = 'Imbox deletion.png'
},
content = {
class = 'imbox-content',
image = 'Imbox content.png'
},
style = {
class = 'imbox-style',
image = 'Edit-clear.svg'
},
move = {
class = 'imbox-move',
image = 'Imbox move.png'
},
protection = {
class = 'imbox-protection',
image = 'Imbox protection.png'
},
license = {
class = 'imbox-license',
image = 'Imbox license.png'
},
featured = {
class = 'imbox-featured',
image = 'Imbox featured.png'
},
notice = {
class = 'imbox-notice',
image = 'Imbox notice.png'
}
}
data.default = 'notice'
data.classes = {'imbox'}
data.classPlainlinksYesno = true
data.imageEmptyCell = true
data.below = true
return p.build(data, args)
end
p.fmbox = makeWrapper(p._fmbox)
p.imbox = makeWrapper(p._imbox)
p.ombox = makeWrapper(p._ombox)
return p
Anonymous user

Navigation menu