Fortnite Esports Wiki

Power Rankings of Brazil and Oceania at the moment are not updated to the last two competitive seasons, so the current positions of the players are not 100% accurate.

READ MORE

Fortnite Esports Wiki
Advertisement

To edit the documentation or categories for this module, click here.


-- this is handled separately so that it can be easily cloned between wikis
local wiki = require('Module:Wiki')
local sep = '%s*,%s*'

local SETTINGS = {
	order = { 'site', 'website', 'askfm', 'discord', 'facebook', 'gapo', 'esl', 'lolpros', 'instagram', 'reddit', 'subreddit', 'snapchat', 'stream', 'tiktok', 'twitch-team', 'twitter', 'vk', 'weibo', 'youtube', 'videoarchive', 'fanpage' },
	data = {
		site = { display = 'Homepage', prefix = '' },
		website = { display = 'Homepage', prefix = '' },
		askfm = { display = 'ask.fm', prefix = 'https://ask.fm/' },
		discord = { display = 'Discord Server', prefix = '' },
		facebook = { display = 'Facebook Fanpage', prefix = '' },
		instagram = { display = 'Instagram', prefix = 'https://instagram.com/' },
		irc = { display = 'IRC Channel', prefix = '' },
		lolpros = { display = 'LOLPros', prefix = '' },
		subreddit = { display = 'Subreddit', prefix = 'http://www.reddit.com/r/' },
		reddit = { display = 'reddit', prefix = 'https://www.reddit.com/user/' },
		snapchat = { display = 'Snapchat', prefix = 'https://www.snapchat.com/add/' },
		stream = { display = '', prefix = '' },
		tiktok = { display = 'TikTok', prefix = 'https://tiktok.com/@',  },
		['twitch-team'] = { display = 'Twitch Team', prefix = '' },
		twitter = { display = 'Twitter', prefix = 'https://www.twitter.com/' },
		vk = { display = 'VKontakte', prefix = '' },
		weibo = { display = 'Weibo', prefix = '' },
		youtube = { display = 'Youtube', prefix = '' },
		videoarchive = { display = 'Video Archive', prefix = '' },
		fanpage = { display = 'Fan Page', prefix = '' },
		esl = { display = 'ESL', prefix = '' },
		gapo = { display = 'Gapo', prefix = 'https://gapo.vn/' },
		tiktok = { display = 'TikTok', prefix = 'https://tiktok.com/@' },
	}
}

local STREAMLIST = {
	['twitch.tv/'] = 'Twitch',
	['azubu.tv/'] = 'Azubu',
	['hitbox.tv/'] = 'Hitbox',
	['afreecatv.com/'] = 'Afreeca',
	['douyu.com/'] = 'Douyu',
	['cube.tv/'] = 'CubeTV',
	['mobcrush.com/'] = 'Mobcrush',
	['gaming.youtube.tv/'] = 'Youtube Gaming',
	['openrec.tv'] = 'OPENREC',
	['fb.gg'] = 'Facebook Gaming',
	['facebook'] = 'Facebook Gaming',
	['nimo.tv'] = 'NimoTV',
}

local p = {}
local h = {}

function p.makeSocialSection(args)
	tbl = {}
	for k, v in ipairs(SETTINGS.order) do
		if args[v] then
			local data = SETTINGS.data[v]
			if v == 'stream' then
				tbl[#tbl+1] = h.stream(args.stream)
			elseif data.hover then
				tbl[#tbl+1] = tostring(h.makeHoverIcon(args, data, v))
			else
				tbl[#tbl+1] = h.makeStandardIcon(data.display, data.display, data.prefix, args[v])
			end
		end
	end
	if args.otherwikis then
		for _, v in ipairs(mw.text.split(args.otherwikis,sep)) do
			tbl[#tbl+1] = wiki.onlyimagelinked(v, { titletarget = args.id })
		end
	end
	return tbl
end

function h.stream(link)
	local platform = 'Livestream'
	for k, v in pairs(STREAMLIST) do
		if string.find(link, k, 1, true) then
			platform = v
			break
		end
	end
	return h.makeStandardIcon('Stream', platform, '', link)
end

function h.makeStandardIcon(name, image, prefix, link)
	return string.format(
		'<span title="%s">[[File:Infobox %slogo std.png|link=%s%s]]</span>',
		name,
		image,
		prefix,
		link:gsub(' ', '_')
	)
end

function h.makeHoverIcon(args, data, v)
	local span = mw.html.create('span')
		:attr('title',data.display)
	local outer = span:tag('div')
		:addClass('popup-content-outer')
		:css('margin-left','0')
		:wikitext(h.makeStandardIcon(data.display, data.display, data.prefix, ''))
	local inner = outer:tag('div')
		:addClass('popup-content-inner')
		:addClass('popup-content-inner-pretty')
		:addClass('toggle-section-hidden')
		:css({
			['margin-left'] = '-56px',
			width = '120px'
		})
		:wikitext(args[v])
	return span
end

return p
Advertisement