Module:Infobox/Social

-- 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', 'bestgg', 'discord', 'facebook', 'instagram', 'irc', 'reddit', 'subreddit', 'snapchat', 'stream', '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/' }, bestgg = { display = 'BestGG', prefix = '' }, discord = { display = 'Discord Server', prefix = '' }, facebook = { display = 'Facebook Fanpage', prefix = '' }, instagram = { display = 'Instagram', prefix = 'https://instagram.com/' }, irc = { display = 'IRC Channel', prefix = '' }, subreddit = { display = 'Subreddit', prefix = 'http://www.reddit.com/r/' }, reddit = { display = 'reddit', prefix = 'https://www.reddit.com/user/' }, snapchat = { display = 'Snapchat', prefix = '', hover = true }, stream = { display = , prefix =  }, ['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 = '' }, } }

local STREAMLIST = { ['twitch.tv/'] = 'Twitch', ['azubu.tv/'] = 'Azubu', ['hitbox.tv/'] = 'Hitbox', ['afreecatv.com/'] = 'Afreeca', ['douyu.com/'] = 'Douyu', ['cubetv.sg/'] = 'CubeTV', ['mobcrush.com/'] = 'Mobcrush', ['gaming.youtube.tv/'] = 'Youtube Gaming', ['openrec.tv'] = 'OPENREC' }

function 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 makeStandardIcon('Stream', platform, '', link) end

function makeStandardIcon(name, image, prefix, link) return string.format(		' ',		name,		image,		prefix,		link	) end

local p = {}

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] = stream(args.stream) elseif data.hover then local div = mw.html.create div:tag('span') :attr('title',data.display) :tag('div') :addClass('match-row') :css('margin-left','0') :tag('div') :addClass('bracket-game-details') :css({								['margin-left'] = '-56px',								width = '120px'							}) :wikitext(args[v]) :done :wikitext(makeStandardIcon(data.display, data.display, data.prefix, '')) tbl[#tbl+1] = tostring(div) else tbl[#tbl+1] = 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

return p