Zelda Wiki

Want to contribute to this wiki?
Sign up for an account, and get started!

Come join the Zelda Wiki community Discord server!

READ MORE

Zelda Wiki
Advertisement

local p = {}

local utilsString = require("Module:UtilsString")

local SMALLEST_DESKTOP_SIZE = 600

function p.CreateNavbox(content, title, options)
	local collapsed = options and options.collapsed
	local thick = options and options.thick
	local class = "navbox mw-collapsible"
	if thick then
		class = class .. " navbox-thick"
	end
	if collapsed ~= false then --collapsed is the default unless explicitly set to false.
		class = class .. " mw-collapsed"
	end
	result = mw.html.create("div")
		:addClass(class)
		:node(mw.html.create("div")
			:addClass("navbox-title")
			:wikitext(title))
		:node(mw.html.create("div")
			:addClass("navbox-links mw-collapsible-content")
			:wikitext(content))
	return tostring(result)
end

function p.CreateRowNavbox(rows, title, options)
	local result = mw.html.create("table")
		:addClass("navbox-table")
	for key, row in ipairs(rows) do
		if not utilsString.isEmpty(row["content"]) then
			result:node(mw.html.create("tr")
				:node(mw.html.create("th")
					:wikitext(row["title"])
				:node(mw.html.create("td")
					:wikitext(row["content"]))))
		end
	end
	
	return p.CreateNavbox(tostring(result), title, options)
end
	
return p
Advertisement