Module:Streams

local p = {}

local getArgs

function p.create(frame) if not getArgs then getArgs = require('Module:Arguments').getArgs end return p._create(getArgs(frame),frame) end

function p._create(args,frame) local div_wrapper = mw.html.create('div') :addClass('table-responsive') local wrapper = div_wrapper:tag('table') :addClass('wikitable') :css('text-align', 'center') :css('margin', '0') :css('margin-bottom', (args['margin-bottom'] or '1em')) if(args['title'] ~= nil) then local tr = wrapper:tag('tr') local th = tr:tag('th') :wikitext(args['title']) :attr('colspan', '100') end local tr = wrapper:tag('tr') local th = tr:tag('th') :wikitext('Language') local numLang = 0 local num = 1 while(args['lang' .. tostring(num)] ~= nil) do		num = num + 1 numLang = numLang + 1 end local counter = 1 local td 	while(counter <= numLang) do		td = tr:tag('td') :wikitext(frame:expandTemplate{ title = 'flag/' .. args['lang' .. tostring(counter)], args = {} }) counter = counter + 1 end

local streams tr = wrapper:tag('tr') th = tr:tag('th') :wikitext('Streams') counter = 1 while(counter <= numLang) do		streams = "" td = tr:tag('td') :css('vertical-align', 'top') -- Copy the three next lines to add new stream platform. if(args['twitch' .. tostring(counter)] ~= nil) then streams = streams .. '[https://www.twitch.tv/' .. args['twitch' .. tostring(counter)] .. ' ]' end

if(args['2twitch' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.twitch.tv/' .. args['2twitch' .. tostring(counter)] .. ' ]' end if(args['3twitch' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.twitch.tv/' .. args['3twitch' .. tostring(counter)] .. ' ]' end if(args['youtube' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.youtube.com/' .. args['youtube' .. tostring(counter)] .. '/'			if(args['ytmultiple' .. tostring(counter)] ~= nil) then streams = streams .. 'videos?view=2&live_view=501' else streams = streams .. 'live' end streams = streams .. ' ]'		end		if(args['2youtube' .. tostring(counter)] ~= nil) then			if streams ~= "" then				streams = streams .. ' '			end			streams = streams .. '.. args['2youtube' .. tostring(counter) .. '/'			if(args['ytmultiple' .. tostring(counter)] ~= nil) then				streams = streams .. 'videos?view=2&live_view=501'			else				streams = streams .. 'live'			end			streams = streams .. ' ]' end if(args['mixer' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.mixer.com/' .. args['mixer' .. tostring(counter)] .. ' ]' end if(args['caffeine' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.caffeine.tv/' .. args['caffeine' .. tostring(counter)] .. ' ]' end if(args['facebook' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://facebook.com/' .. args['facebook' .. tostring(counter)] .. '/live' .. ' ]' end if(args['2facebook' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://facebook.com/' .. args['2facebook' .. tostring(counter)] .. '/live' .. ' </i>]' end if(args['vk' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://vk.com/' .. args['vk' .. tostring(counter)] .. '/live' .. ' </i>]' end if(args['douyu' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.douyu.com/' .. args['douyu' .. tostring(counter)] .. ' </i>]' end if(args['huomao' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.huomao.com/' .. args['huomao' .. tostring(counter)] .. ' </i>]' end

if(args['huya' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.huya.com/' .. args['huya' .. tostring(counter)] .. ' </i>]' end

if(args['2huya' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.huya.com/' .. args['2huya' .. tostring(counter)] .. ' </i>]' end if(args['3huya' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.huya.com/' .. args['3huya' .. tostring(counter)] .. ' </i>]' end if(args['bilibili' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://live.bilibili.com/' .. args['bilibili' .. tostring(counter)] .. ' </i>]' end

if(args['cc' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://cc.163.com/' .. args['cc' .. tostring(counter)] .. ' </i>]' end

if(args['steamtv' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://steam.tv/' .. args['steamtv' .. tostring(counter)] .. ' </i>]' end

if(args['garena' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://garena.live/' .. args['garena' .. tostring(counter)] .. ' </i>]' end

if(args['zhanqi' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.zhanqi.tv/' .. args['zhanqi' .. tostring(counter)] .. ' </i>]' end

if(args['afreeca' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://play.afreecatv.com/' .. args['afreeca' .. tostring(counter)] .. ' </i>]' end

if(args['trovo' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://trovo.live/' .. args['trovo' .. tostring(counter)] .. ' </i>]' end

if(args['yandex' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://yandex.ru/efir?stream_channel=' .. args['yandex' .. tostring(counter)] .. ' </i>]' end if(args['mildom' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.mildom.com/' .. args['mildom' .. tostring(counter)] .. ' </i>]' end

if(args['esl' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[' .. args['esl' .. tostring(counter)] .. ' <i class="lp-icon lp-esl" style="margin-bottom:3.0px;"></i>]' end

if(args['openrec' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.openrec.tv/live/' .. args['openrec' .. tostring(counter)] .. ' <i class="lp-icon lp-openrec" style="margin-bottom:3.0px;"></i>]' end

if(args['nimotv' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[https://www.nimo.tv/' .. args['nimotv' .. tostring(counter)] .. ' <i class="lp-icon lp-nimotv" style="margin-bottom:3.0px;"></i>]' end

-- Paste new lines above this comment.

if(args['stream' .. tostring(counter)] ~= nil) then if streams ~= "" then streams = streams .. ' '			end streams = streams .. '[' .. args['stream' .. tostring(counter)] .. ' <i class="lp-icon lp-stream" style="margin-bottom:3.0px;"></i>]' end

td:wikitext(streams) counter = counter + 1 end

return div_wrapper:done end

return p