FANDOM


-- Implements {{tl|CollapsedCodebox}} and associated layout.
-- NEEDS SERIOUS cleanup, too much spaghetti code!
local Codebox = {}
local HF = mw.InfoboxBuilderHF
local getArgs = require('Dev:Arguments').getArgs
 
function Codebox.main(frame) -- Implements {{CollapsedCodebox}}
	local args = getArgs(frame)
	return Codebox._codebox(args)
end
 
function Codebox._codebox( args )
    if args['multiline'] then end
    local navframe = mw.html.create('div'):addClass('codebox'):addClass('mw-collapsible')
    if HF.isempty( args['expanded'] ) then
        navframe:addClass('mw-collapsed')
    end
    navframe:addClass(args['class'] or ''):css('border', args['border'] or 'none')
      :css(args['style'] or args['css'] or '')
    if args['showhide'] == 'left' or args['toggle'] == 'left' then
        navframe:css('position','relative'):css('width','100%')
    end
    navframe:tag('div'):addClass('codebox-title')
    if args['showhide'] == 'left' or args['toggle'] == 'left' then
        navframe:css('position','absolute'):css('width','3.2em')
        :css('background', args['bg1'] or 'transparent'):done()
         :tag('div')
         :css('font-size','100%'):css('height','1.6em'):css('padding-left','2.8em')
    end
    navframe:css('background', args['bg1'] or 'transparent')
      :css('text-align', args['ta1'] or 'center')
      :css(args['extra1'] or '')
    if args['multiline'] or args['multi-line'] then
        navframe:css(args['multiline'] or args['multi-line'] or '')
    else 
        navframe:css('height','auto') 
    end
    navframe:css('font-weight', args['fw1'] or 'bold')
    navframe:css(args['titlestyle'] or args['headercss'] or '')
    if args['multiline'] or args['multi-line'] then
        navframe:tag('div'):addClass('codebox-multiline')
        :css('margin-right','4em'):css('line-height','125%'):css('height','auto')
    end
    navframe:wikitext(args['title'] or args['header'] or args[1] or ' '):done()
    navframe:tag('div'):addClass('codebox-content'):addClass('mw-collapsible-content')
      :css('background', args['bg2'] or 'transparent')
      :css('text-align', args['ta2'] or 'left')
      :wikitext(args['content'] or args['contents'] or args[2] or ' ')
    if args['showhide'] == 'left' or args['toggle'] == 'left' then
        navframe:css('padding-left:','0.3em')
    end
    navframe:css(args['extra2'] or '')
      :css('font-weight', args['fw2'] or 'normal')
      :css(args['bodystyle'] or args['contentstyle'] or args['contentcss'] or '')
 
    :done()
	:allDone()
	return tostring(navframe)
end
return Codebox

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.