Call of Duty Esports Wiki
Register
Advertisement

Documentation for this module may be created at Module:PopupButton/doc

-- <nowiki>
local util_args = require('Module:ArgsUtil')
local util_toggle = require("Module:ToggleUtil")

local h = {}

local p = {}
function p.main(frame)
	local args = util_args.merge()
	if args.type == 'standings' then
		return p.standings(nil, args.page)
	elseif args.type == 'tth' then
		return p.tth(nil, args.link, args.display, args.team)
	end
end

function p.tth(tbl, link, display, team)
	local button = util_toggle.popupButtonLazy(
		tbl,
		'tth',
		h.getTthAttr(link, display, team)
	)
	return tbl
end

function h.getTthAttr(link, display, team)
	if not link or not display or not team then return '' end
	return ('MatchListTournamentTeam|page=%s|team=%s|display=%s'):format(
		link,
		team,
		display
	)
end

function p.standings(tbl, page)
	local button = util_toggle.popupButtonLazy(
		tbl,
		'tth',
		h.getStandingsAttr(page)
	)
	return button.tbl
end

function h.getStandingsAttr(page)
	return ('PopupStandings|page=%s'):format(page)
end

return p
-- </nowiki>
Advertisement