Module:HTMLComponents

local p = {}

function p.playerNavbox( frame ) local loops = require( "Module:Loops" ) local common = require( "Module:Common" ) local namedArgs = { [1] = { "player" }, [2] = { "border_color" }, [3] = { "border_radius" }, [4] = { "border_glow" }, [5] = { "header_color" }, [6] = { "header_font_color" }, [7] = { "body_color" }, [8] = { "body_font_color" }, [9] = { "horizontal_rule_color", "hr_color" }, [10] = { "horizontal_rule_glow", "hr_glow" }, [11] = { "active_font_color", "active_color" }, [12] = { "inactive_font_color", "inactive_color" }, [13] = { "deceased_font_color", "deceased_color" }, [14] = { "other_font_color", "other_color" }, [15] = { "separator_color", "sep_color" }, [16] = { "text_shadow" }, [17] = { "text_shadow_offset" }, [18] = { "text_shadow_color" }, [19] = { "tabbed" } }	local parentArgCount, args = common.getNamedArgs( namedArgs, frame.args, frame:getParent.args ) local boxShadow = 'inset 0 1px ' .. args["border_color"] .. ( ( args["border_glow"] == 'true' )			and ( ', 0 0 10px ' .. args["border_color"] )			or '' ) .. '; '

return mw.html.create( 'div' ) :css ( {			['clear'] = 'both',			['background'] = args["body_color"],			['margin'] = '30px 15px 15px 15px',			['border-radius'] = args["border_radius"] .. 'px',		} ) :cssText ( ( ( args["text_shadow"] == 'true' ) and	( 'text-shadow: ' .. args["text_shadow_offset"] .. ' ' .. args["text_shadow_color"] .. '; ' ) or '' ) )		:tag ( 'div' ) :css ( {				['overflow'] = 'hidden',				['border'] = '1px solid ' .. args["border_color"],				['border-radius'] = args["border_radius"] .. 'px',				['margin'] = '1px',				['text-align'] = 'center',			} ) :cssText( common.boxShadow( boxShadow ) ) :tag ( 'div' ) :css ( {					['overflow'] = 'hidden',					['padding'] = '0.2em',					['vertical-align'] = "center",					['font-size'] = '1.1em',					['white-space'] = 'nowrap',					['background'] = args["header_color"],					['border-radius'] = args["border_radius"] .. 'px 0 0',					['color'] = args["header_font_color"]				} ) :wikitext ( 'Played by: ' .. args["player"] ) :done :tag ( 'div' ) :css ( 'padding', '0.2em 0.5em' ) :wikitext ( loops.characterStatusString( frame, args ) ) :allDone end

local function _getTabHtml(wikitext, subpage) return mw.html.create ( 'div' ) :css ( {			['min-width'] = '5em',			['float'] = 'left',			['border'] = '1px solid #00f8b9',			['border-radius'] = '10px',			['padding'] = '0.8em',			['height'] = '50px',			['margin'] = '2px'		} ) :cssText (			subpage and "background-color: #00F8B9;"			or "color: #999;"		) :tag ( 'div' ) :css ( {				['display'] = 'flex',				['align-items'] = 'center',				['justify-content'] = 'center',				['height'] = '100%',				['text-transform'] = 'uppercase'			} ) :cssText (				subpage and "color: #0c0b1f; font-weight: bold;"				or "text-align: center; width: 100%;"			) :wikitext ( wikitext ) :allDone end

function p.tabs(frame) local tabs = {} local tab1Main = frame:getParent.args["tab1_main"] ~= 'false' local currentPage = mw.title.getCurrentTitle local NAMESPACE = currentPage.nsText local SUBPAGENAME = currentPage.subpageText local PAGENAME= currentPage.text local BASEPAGENAME = currentPage.baseText local function _getSubpageWikitext(text) return "" .. text .. "" end

local function _getBasepageWikitext(text) return "" .. text .. "" end local i = 0 local lastIndex = 0 tabs[1] = 'overview' for k, v in pairs(frame:getParent.args) do		if k ~= "tab1_main" then local m = k:match("^tab(%d+)")-- or k:match("") if m then tabs[tonumber(m)] = v				i = i+1 if tonumber(m) > lastIndex then lastIndex = tonumber(m) end end if i > 30 then error(					"More than 30 tabs have been provided..." .. 					"Are you sure you need that many?"				) end end end for i=2, lastIndex do		if not tabs[i] then for j=i+1, lastIndex do				if tabs[j] then tabs[i] = tabs[j] tabs[j] = nil break end end end end

local html = mw.html.create( 'div' ) --css ( {			['clear'] = 'both'		} ) :tag ( 'div' ) :css ( {				['display'] = 'flex',				['justify-content'] = 'center',				['flex-wrap'] = 'wrap',				['margin-bottom'] = '15px'			} ) :tag ( 'div' ) :css ( {					['clear'] = 'both'				} ) --} )	if SUBPAGENAME == ( ( tab1Main ) and tabs[1] or PAGENAME ) then		if not tab1Main and SUBPAGENAME == tabs[1] then			html:node (	_getTabHtml ( tabs[1], true ) )		else			html:node (	_getTabHtml ( _getSubpageWikitext( tabs[1] ), false ) )		end	else		if tab1Main then			html:node ( _getTabHtml(					_getBasepageWikitext( tabs[1] ),					BASEPAGENAME == PAGENAME				) )		else			html:node ( _getTabHtml(					_getSubpageWikitext( tabs[1] ),					SUBPAGENAME == tabs[1]				) )		end	end	for i=2, #tabs do		if SUBPAGENAME == tabs[i] then			html:node ( _getTabHtml( _getSubpageWikitext( tabs[i] ), true ) )		else			html:node ( _getTabHtml( _getSubpageWikitext( tabs[i] ), false ) )		end	end	return html:allDone end

return p