Call of Duty Esports Wiki
Advertisement
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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