Homepage
Games
News
News βΎ
All
Transfers
Drama
Business
Sponsors
Mergers
Investors
Hires
Companies
More
People
Tournaments
Brands
Brands βΎ
Companies
Organizations
Sponsors
Other
Locations
Search
Editing
Module:Infobox/Widget/Links
From TwogPedia
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local UtilLinks = require('Module:Links') local Table = require('Module:Table') local Links = {} local _ICON_KEYS_TO_RENAME = { ['bilibili-stream'] = 'bilibili', daumcafe = 'cafe-daum', ['esea-d'] = 'esea-league', ['faceit-c'] = 'faceit', ['faceit-c2'] = 'faceit', ['faceit-hub'] = 'faceit', ['faceit-org'] = 'faceit', matcherinolink = 'matcherino', playlist = 'music', privsteam = 'steam', pubsteam = 'steam', steamalternative = 'steam', tlpdint = 'tlpd', tlpdkr = 'tlpd-wol-korea', tlpdsospa = 'tlpd-sospa', } local _PRIORITY_GROUPS = { core = { 'home', 'site', 'website' }, league = { '5ewin', 'abiosgaming', 'aligulac', 'battlefy', 'b5csgo', 'challengermode', 'challonge', 'cybergamer', 'datdota', 'dotabuff', 'esea', 'esea-d', 'esl', 'esportal', 'faceit', 'faceit-c', 'faceit-hub', 'faceit-org', 'factor', 'gamersclub', 'halodatahive', 'letsplaylive', 'matcherino', 'matcherinolink', 'siege-gg', 'sk', 'smash-gg', 'sostronk', 'stratz', 'toornament', 'trackmania-io', 'vlr', 'bracket', 'rules', 'rulebook', }, social = { 'discord', 'facebook', 'instagram', 'privsteam', 'pubsteam', 'reddit', 'snapchat', 'steam', 'steamalternative', 'telegram', 'tiktok', 'twitter', 'vk', 'weibo', 'email', 'linkedin' }, streams = { 'twitch', 'youtube', 'stream', 'afreeca', 'dlive', 'facebook-gaming', 'vidio', 'booyah', 'douyu', 'huyatv', 'zhangyutv', 'bilibili-stream', 'kuaishou', } } function Links.make(links, variant) if _isTableEmpty(links) then return nil end local infoboxLinks = mw.html.create('div') infoboxLinks :addClass('ib-links') for _, group in Table.iter.spairs(_PRIORITY_GROUPS) do for _, key in ipairs(group) do if links[key] ~= nil then infoboxLinks:wikitext(' ' .. _makeLink(key, links[key], variant)) -- Remove link from the collection links[key] = nil local index = 2 while links[key .. index] ~= nil do infoboxLinks:wikitext(' ' .. _makeLink(key, links[key .. index], variant)) -- Remove link from the collection links[key .. index] = nil index = index + 1 end end end end for key, value in Table.iter.spairs(links) do infoboxLinks:wikitext(' ' .. _makeLink(key, value, variant)) end return mw.html.create('div'):node(infoboxLinks) end function _makeLink(key, value, variant) key = _removeAppendedNumber(key) local link = UtilLinks.makeFullLink(key, value, variant) return '[[Image:' .. (_ICON_KEYS_TO_RENAME[key] or key) .. '.png|40px|link=' .. link[1] .. '|' .. (link[2] or '' ) .. ']]' -- ' <i class="lp-icon lp-' .. (_ICON_KEYS_TO_RENAME[key] or key) .. '></i>]' end --remove appended number --needed because the link icons require e.g. 'esl' instead of 'esl2' function _removeAppendedNumber(key) return string.gsub(key, '%d$', '') end function _isTableEmpty(tbl) for key, value in pairs(tbl) do return false end return true end return Links
Summary:
Please note that all contributions to TwogPedia may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
TwogPedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:Infobox/Widget/Links/doc
(
edit
)
No categories
Edit