模块:Message box
外观
-- Module:Message box
-- 精简版,仅实现 ombox(橙色消息框),用于沙盒提示
local messageBox = {}
function messageBox.main(boxType, args)
if boxType ~= 'ombox' then
return ''
end
local image = args.image or ''
local text = args.text or ''
local extraClass = args.class or ''
local root = mw.html.create('div')
:addClass('ombox')
:addClass(extraClass)
:css({
['border'] = '1px solid #a2a9b1',
['border-left'] = '10px solid #f28500',
['background-color'] = '#fdf2d5',
['color'] = '#000',
['margin'] = '0.5em 0',
['padding'] = '0.5em 1em',
})
if image ~= '' then
root:tag('div')
:css('float', 'left')
:css('margin', '0 0.5em 0 0')
:css('width', '60px')
:css('text-align', 'center')
:wikitext(image)
end
root:tag('div')
:css('overflow', 'hidden')
:wikitext(text)
return tostring(root)
end
return messageBox