×
Create a new article
Write your page title here:
We currently have 152 articles on Grow Song of The Evertree Wiki. Type your article name above or create one of the articles listed here!



    Grow Song of The Evertree Wiki

    Module:Mbox: Difference between revisions

    Content added Content deleted
    m (1 revision imported)
    (Stealing local Module from fandom)
     
    Line 1:
    -- <nowiki>
    -- This Module is used for making templates based in the Lua language.
    local Mbox = require('Dev:Mbox'){}
    -- See more details about Lua in [[w:Help:Lua]].
    local getArgs = require('DevModule:Arguments').getArgs
    -- The Fandom Developer's Wiki hosts Global Lua Modules that can be imported and locally overridden.
    local i18n = require('Module:I18n').loadMessages('Mbox')
    -- The next line imports the Mbox module from the [[w:c:dev:Global Lua Modules]].
    local Mbox = require('Dev:Mbox')
    -- 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 [[w: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('Dev:Arguments').getArgs
    local localCSS = mw.loadData('Module:Mbox/data').localStyle
     
    function Mbox.main(frame)
    Line 26 ⟶ 9:
    -- styles
    local styles = {}
    ifstyles['border-left-color'] args.= i18n:parameter('bordercolor', thenargs)
    styles['border-leftbackground-color'] = i18n:parameter('bgcolor', args.bordercolor)
    elseif args.type then
    styles['border-left-color'] = 'var(--type-' .. args.type .. ')'
    end
     
    if args.bgcolor then
    styles['background-color'] = args.bgcolor
    end
     
    -- images
    local image = args.i18n:parameter('image', args) or ''
    local imagewidthimageadjust = args.imagewidth or '80px'
    elseifif args.typeimageadjust then
    local imagelink = ''
    imagelinkimageadjust = '|link=' .. args.imagelinkimageadjust
    if args.imagelink then
    end
    imagelink = '|link=' .. args.imagelink
    local imagewidth = i18n:parameter('imagewidth', args) or '80px'
    local imagelink = '|link='
    local imagelinkarg = i18n:parameter('imagelink', args)
    if args.bgcolorimagelinkarg then
    imagelink = imagelink .. imagelinkarg
    end
     
    local imagewikitext = ('%sFile[[File:%s|%s%s' .. image .. ']]|'):format('[[', image,.. imagewidth, .. imageadjust .. imagelink) .. ']]'
     
    -- id for closure
    local id = args.i18n:parameter('id', args) or 'mbox'
    local typeclass = i18n:parameter('type', args)
     
    local container = mw.html.create('div')
    :addClass('mbox')
    :addClass(argstypeclass and ('mbox-type-' .class. typeclass))
    :addClass(i18n:parameter('class', args))
    :css(styles)
    :csscssText(i18n:parameter(localCSS['mboxstyle'], args))
    :cssText(args.style)
     
    local content = container:tag('div')
    :addClass('mbox__content')
    local collapsed = i18n:parameter('collapsed', args)
    :css(localCSS['mbox__content'])
     
    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 74 ⟶ 55:
    local contentwrapper = content:tag('div')
    :addClass('mbox__content__wrapper')
    local header = i18n:parameter('header', args)
    :css(localCSS['mbox__content__wrapper'])
     
    if args.header then
    contentwrapper:tag('div')
    :addClass('mbox__content__header')
    :csswikitext(localCSS['mbox__content__header']header)
    :wikitext(args.header)
    end
     
    iflocal args.textarg = i18n:parameter('text', thenargs)
    if args.imagelinktextarg then
    local text = contentwrapper:tag('div')
    :addClass('mbox__content__text')
    :addClass('mw-collapsible')
    :attr('id', 'mw-customcollapsible-' .. id)
    :csswikitext(localCSS['mbox__content__text']textarg)
    :wikitext(args.text)if collapsed then
    if args.collapsed then
    text:addClass('mw-collapsed')
    end
     
    iflocal args.comment then= i18n:parameter('comment', args)
    if args.collapsedcomment then
    text:tag('div')
    :addClass('mbox__content__text__comment')
    :csswikitext(localCSS['mbox__content__text__comment']comment)
    :wikitext(args.comment)
    end
    end
    Line 105 ⟶ 85:
    :addClass('mbox__close')
    :addClass('mw-customtoggle-' .. id)
    :cssattr(localCSS['mbox__closetitle'], i18n:msg('dismiss'))
    :attr('title', 'Dismiss')
     
    iflocal args.asidearg = i18n:parameter('aside', thenargs)
    if asidearg then
    local aside = content:tag('div')
    :addClass('mbox__content__aside')
    :addClass('mw-collapsible')
    :attr('id', 'mw-customcollapsible-' .. id)
    :csswikitext(localCSS['mbox__content__aside']asidearg)
    :wikitext(args.aside)if collapsed then
    if args.collapsed then
    aside:addClass('mw-collapsed')
    end
    Line 123 ⟶ 102:
    end
     
    --
    -- END DELETION HERE
    --
     
    -- The last line produces the output for the template
    return Mbox

    Latest revision as of 18:39, 20 November 2022

    This module is used by most of the basic Notice templates and is invoked by {{MessageBox}}.


    -- <nowiki>
    local Mbox = {}
    local getArgs = require('Module:Arguments').getArgs
    local i18n = require('Module:I18n').loadMessages('Mbox')
    
    function Mbox.main(frame)
        local args = getArgs(frame)
    
        -- styles
        local styles = {}
        styles['border-left-color'] = i18n:parameter('bordercolor', args)
        styles['background-color'] = i18n:parameter('bgcolor', args)
    
        -- images
        local image = i18n:parameter('image', args) or ''
        local imageadjust = ''
        if args.imageadjust then
            imageadjust = '|' .. args.imageadjust
        end
        local imagewidth = i18n:parameter('imagewidth', args) or '80px'
        local imagelink = '|link='
        local imagelinkarg = i18n:parameter('imagelink', args)
        if imagelinkarg then
            imagelink = imagelink .. imagelinkarg
        end
    
        local imagewikitext = '[[File:' .. image .. '|' .. imagewidth  .. imageadjust .. imagelink .. ']]'
    
        -- id for closure
        local id = i18n:parameter('id', args) or 'mbox'
        local typeclass = i18n:parameter('type', args)
    
        local container = mw.html.create('div')
            :addClass('mbox')
            :addClass(typeclass and ('mbox-type-' .. typeclass))
            :addClass(i18n:parameter('class', args))
            :css(styles)
            :cssText(i18n:parameter('style', args))
    
        local content = container:tag('div')
            :addClass('mbox__content')
        local collapsed = i18n:parameter('collapsed', args)
    
        if image ~= '' then
            local image = content:tag('div')
                :addClass('mbox__content__image')
                :addClass('mw-collapsible')
                :attr('id', 'mw-customcollapsible-' .. id)
                :wikitext(imagewikitext)
                if collapsed then
                    image:addClass('mw-collapsed')
                end
        end
    
        local contentwrapper = content:tag('div')
            :addClass('mbox__content__wrapper')
        local header = i18n:parameter('header', args)
    
        if header then
            contentwrapper:tag('div')
                :addClass('mbox__content__header')
                :wikitext(header)
        end
    
        local textarg = i18n:parameter('text', args)
        if textarg then
            local text = contentwrapper:tag('div')
                :addClass('mbox__content__text')
                :addClass('mw-collapsible')
                :attr('id', 'mw-customcollapsible-' .. id)
                :wikitext(textarg)
                if collapsed then
                    text:addClass('mw-collapsed')
                end
    
            local comment = i18n:parameter('comment', args)
            if comment then
                text:tag('div')
                    :addClass('mbox__content__text__comment')
                    :wikitext(comment)
            end
        end
    
        contentwrapper:tag('span')
            :addClass('mbox__close')
            :addClass('mw-customtoggle-' .. id)
            :attr('title', i18n:msg('dismiss'))
    
        local asidearg = i18n:parameter('aside', args)
        if asidearg then
            local aside = content:tag('div')
                :addClass('mbox__content__aside')
                :addClass('mw-collapsible')
                :attr('id', 'mw-customcollapsible-' .. id)
                :wikitext(asidearg)
                if collapsed then
                    aside:addClass('mw-collapsed')
                end
        end
    
        return container
    end
    
    return Mbox
    
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.