Module:Mbox: Difference between revisions

From Polcompball Wiki
Jump to navigationJump to search
no edit summary
(Undo revision 101011 by Vizdun (talk))
Tags: Undo Reverted
No edit summary
Tag: Manual revert
Line 1:
-- This Module is used for making templates based in the Lua language.
-- <nowiki>
-- See more details about Lua in [[Help:Lua]].
local Mbox = {}
-- The Fandom Developer's Wiki hosts Global Lua Modules that can be imported and locally overridden.
-- The next line imports the Mbox module from the [[w:c:dev:Global Lua Modules]].
local Mbox = require('Module:Mbox2')
-- See more details about this module at [[w:c:dev:Global_Lua_Modules/Mbox]]
 
-- The imported Module is overwritten locally to include default styling.
-- For a more flexible Mbox experience, delete the function below and import
-- https://dev.fandom.com/wiki/MediaWiki:Global_Lua_Modules/Mbox.css
-- or paste (and modify as you like) its contents in your wiki's
-- [[MediaWiki:Wikia.css]] (see [[Help:Including_additional_CSS_and_JS]])
-- or look at https://dev.fandom.com/wiki/Global_Lua_Modules/Mbox
-- for more customization inspiration
 
--
-- BEGIN DELETION HERE
--
 
local getArgs = require('Module:Arguments').getArgs
local i18nlocalCSS = requiremw.loadData('Module:I18nMbox/data').loadMessages('Mbox')localStyle
 
function Mbox.main(frame)
Line 9 ⟶ 26:
-- styles
local styles = {}
styles['border-left-color']if = i18n:parameter('args.bordercolor', args)then
styles['backgroundborder-left-color'] = i18n:parameter('bgcolor', args).bordercolor
ifelseif args.imageadjusttype then
styles['border-left-color'] = 'var(--type-' .. args.type .. ')'
end
 
--if imagesargs.bgcolor then
local image = i18n:parameter( styles['imagebackground-color',] = args) or ''.bgcolor
local imageadjust = ''
if args.imageadjust then
imageadjust = '|' .. args.imageadjust
end
 
local imagewidth = i18n:parameter('imagewidth', args) or '80px'
-- images
local imagelink = '|link='
local imagelinkargimage = i18n:parameter(args.image or 'imagelink', args)
local imagewidth = i18n:parameter('imagewidth', args).imagewidth or '80px'
if imagelinkarg then
local imagelink = imagelink .. imagelinkarg''
localif args.imagelink = '|link='then
imageadjustimagelink = '|link=' .. args.imageadjustimagelink
end
 
local imagewikitext = ('[[File%sFile:%s|%s%s' .. image .. '|]]'):format('[[', ..image, imagewidth .. imageadjust .., imagelink .. ']]')
 
-- id for closure
local id = i18n:parameter('id', args).id or 'mbox'
local typeclass = i18n:parameter('type', args)
 
local container = mw.html.create('div')
:addClass('mbox')
:addClass(typeclass and ('mbox-type-' args.. typeclass)class)
:addClass(i18n:parameter('class', args))
:css(styles)
:cssText(i18n:parametercss(localCSS['stylembox', args)])
:cssText(args.style)
 
local content = container:tag('div')
:addClass('mbox__content')
:css(localCSS['mbox__content'])
local collapsed = i18n:parameter('collapsed', args)
 
if args.image ~= '' then
local image = content:tag('div')
:addClass('mbox__content__image')
:addClass('mw-collapsible')
:attr('id', 'mw-customcollapsible-' .. id)
:css(localCSS['mbox__content__image'])
:wikitext(imagewikitext)
if args.collapsed then
image:addClass('mw-collapsed')
end
Line 55 ⟶ 74:
local contentwrapper = content:tag('div')
:addClass('mbox__content__wrapper')
:css(localCSS['mbox__content__wrapper'])
local header = i18n:parameter('header', args)
 
if args.header then
contentwrapper:tag('div')
:addClass('mbox__content__header')
:wikitextcss(headerlocalCSS['mbox__content__header'])
:wikitext(args.header)
end
 
localif textarg = i18n:parameter('args.text', args)then
if textarg then
local text = contentwrapper:tag('div')
:addClass('mbox__content__text')
:addClass('mw-collapsible')
:attr('id', 'mw-customcollapsible-' .. id)
:wikitextcss(textarglocalCSS['mbox__content__text'])
if collapsed then:wikitext(args.text)
if commentargs.collapsed then
text:addClass('mw-collapsed')
end
 
localif args.comment = i18n:parameter('comment', args)then
if comment then
text:tag('div')
:addClass('mbox__content__text__comment')
:wikitextcss(commentlocalCSS['mbox__content__text__comment'])
:wikitext(args.comment)
end
end
Line 85 ⟶ 105:
:addClass('mbox__close')
:addClass('mw-customtoggle-' .. id)
:attrcss(localCSS['titlembox__close', i18n:msg('dismiss')])
:attr('title', 'Dismiss')
 
localif asidearg = i18n:parameter('args.aside', args)then
if asidearg then
local aside = content:tag('div')
:addClass('mbox__content__aside')
:addClass('mw-collapsible')
:attr('id', 'mw-customcollapsible-' .. id)
:wikitextcss(asidearglocalCSS['mbox__content__aside'])
if collapsed then:wikitext(args.aside)
if args.collapsed then
aside:addClass('mw-collapsed')
end
Line 102 ⟶ 123:
end
 
--
-- END DELETION HERE
--
 
-- The last line produces the output for the template
return Mbox
8,926

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu