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:Game/Teams
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 Flags = require('Module:Flags') local p = {} local VariablesLua = mw.ext.VariablesLua local cargo = mw.ext.cargo local limit = 25 function p.main(frame) local game = mw.text.split(mw.title.getCurrentTitle().text, '/')[1] local tables = 'Teams' local fields = '_pageName, region, org' local cargoArgs = { where = '_pageName LIKE"' .. game .. '/%" AND inactive IS NULL', orderBy = 'region' } local results = cargo.query(tables, fields, cargoArgs) local container = mw.html.create('div') if #results > 0 then local region = results[1].region local tableContainer = mw.html.create('table'):addClass('teams__table') local headerRow = mw.html.create('tr'):node(mw.html.create('th'):attr('colspan', 2):node(mw.html.create('div'):addClass('teams__region'):node(Flags.icon(region)):node(mw.html.create('div'):wikitext(Flags.CountryName(region))))) tableContainer:node(headerRow) for i = 1, #results do local result = results[i] local currentDate = os.date('%Y-%m-%d') local newRegion = results[i].region if region ~= newRegion then local clone = mw.clone(tableContainer) container:node(clone) region = newRegion tableContainer = mw.html.create('table'):addClass('teams__table') headerRow = mw.html.create('tr'):node(mw.html.create('th'):attr('colspan', 2):node(mw.html.create('div'):addClass('teams__region'):node(Flags.icon(region)):node(mw.html.create('div'):wikitext(Flags.CountryName(region))))) tableContainer:node(headerRow) end tables = "Logos" fields = "logoAll, logoLight, logoDark, iconAll, iconLight, iconDark" local org = result.org or '' cargoArgs = { where = '(_pageName="' .. result._pageName .. '" OR _pageName="' .. org .. '") AND (start IS NULL OR start < "' .. currentDate .. '") AND (end IS NULL OR end > "' .. currentDate .. '")' } -- Perform the join query local teamResults = cargo.query(tables, fields, cargoArgs) local team = mw.html.create('td') local teamName = result._pageName if #teamResults > 0 then local logoAll = teamResults[1].logoAll local logoLight = teamResults[1].logoLight local logoDark = teamResults[1].logoDark local iconAll = teamResults[1].iconAll local iconLight = teamResults[1].iconLight local iconDark = teamResults[1].iconDark if iconAll then team:node(p.createLogo(iconAll, teamName, nil, game, size)) elseif iconLight and iconDark then team:node(mw.html.create('div'):node(p.createLogo(iconLight, teamName, 'light', game, size)):node(p.createLogo(iconDark, teamName, 'dark', game, size))) elseif logoAll then team:node(p.createLogo(logoAll, teamName, nil, game, size)) elseif logoLight and logoDark then team:node(mw.html.create('div'):node(p.createLogo(logoLight, teamName, 'light', game, size)):node(p.createLogo(logoDark, teamName, 'dark', game, size))) else local logo = iconLight or iconDark or logoLight or logoDark team:node(p.createLogo(logo, teamName, nil, game, size)) end else team:node(mw.html.create('div'):node(p.createLogo(nil, teamName, 'light', game, size)):node(p.createLogo(nil, teamName, 'dark', game, size))) end local playerRow = mw.html.create('tr'):node(team):node(mw.html.create('td'):wikitext('[[' .. result._pageName .. ']]')) tableContainer:node(playerRow) end container:node(tableContainer) end return container end function p.createLogo(url, teamPage, class, game, size) size = size or '20px' local className = class and class .. ' h-100' or 'h-100' local logoURL = url and url or 'Team_placeholder_' .. class .. '.png' local logoContainer = mw.html.create('div'):addClass(className) local logo = mw.html.create('div') :addClass('team-list-logo') :node('[[File:' .. logoURL .. '|' .. size .. '|link=' .. teamPage .. '|' .. string.gsub(teamPage, game .. '/', '') .. ']]') logoContainer:node(logo) return logoContainer end return p
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:Game/Teams/doc
(
edit
)
No categories
Edit