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/Upcoming matches
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 cargo = mw.ext.cargo local Functions = require('Module:Functions') local getTeamLogo = Functions.getTeamLogo local prizeToString = Functions.prizeToString local timeUntil = Functions.timeUntil local stringifyDate = Functions.stringifyDate local p = {} function p.get(tournament, team) local currentDate = os.date('%Y-%m-%d') -- Get live matches local tables = 'AllMatches' local fields = '_pageName, p1, p2, date, bestof' local playerPage = mw.title.getCurrentTitle().text team = team or '' local cargoArgs = { where = '_pageName LIKE "' .. tournament .. '/%" AND (date is NOT NULL AND date <= "' .. currentDate .. '") AND (winner IS NULL OR winner = 0) AND ((p1 = "' .. team .. '" OR p2 = "' .. team .. '") OR (p1 = "' .. playerPage .. '" OR p2 = "' .. playerPage .. '"))', orderBy = 'date' } local results = cargo.query(tables, fields, cargoArgs) local container = mw.html.create('table'):addClass('w-100 tc') if #results > 0 then p.matchHtml(container, results, 'true') end -- Check for upcoming matches cargoArgs.where = '_pageName LIKE "' .. tournament .. '/%" AND (date is NOT NULL AND date > "' .. currentDate .. '") AND (winner IS NULL OR winner = 0) AND ((p1 = "' .. team .. '" OR p2 = "' .. team .. '") OR (p1 = "' .. playerPage .. '" OR p2 = "' .. playerPage .. '"))' results = cargo.query(tables, fields, cargoArgs) if #results > 0 then p.matchHtml(container, results) end return container end function p.matchHtml(container, results, live) local game = mw.text.split(results[1]._pageName, '/')[1] for i = 1, #results do local result = results[i] local row = mw.html.create('tr') local time = mw.html.create('td'):attr('style', 'padding: 4px; font-size: 0.8rem;') local team1 = mw.html.create('td'):attr('style', 'padding: 4px;') local vs = mw.html.create('td'):attr('style', 'padding: 4px;'):node(mw.html.create('abbr'):attr('title', 'Best-of-' .. result.bestof):wikitext('Bo' .. result.bestof)) local team2 = mw.html.create('td'):attr('style', 'padding: 4px;') if live then time:wikitext('LIVE') else time:wikitext(timeUntil(result.date)) end local styleLeft = 'display: flex; column-gap: 0.2rem;justify-content: end; align-items: center;' local styleRight = 'display: flex; column-gap: 0.2rem;justify-content: start; align-items: center;' local size = '20x20px' if result.p1 then team1:node(mw.html.create('div'):attr('style', styleLeft):node('[[' .. result.p1 .. '|<div style="font-size: 0.8rem; text-align: right;">' .. string.gsub(result.p1, game .. '/', '') .. '</div>]]'):node(getTeamLogo(result.p1, game, size))) else team1:node(mw.html.create('div'):attr('style', styleLeft):node('<div style="font-size: 0.8rem; text-align: right;">TBD</div>'):node(getTeamLogo(nil, game, size))) end if result.p2 then team2:node(mw.html.create('div'):attr('style', styleRight):node(getTeamLogo(result.p2, game, size)):node('[[' .. result.p2 .. '|<div style="font-size: 0.8rem;">' .. string.gsub(result.p2, game .. '/', '') .. '</div>]]')) else team2:node(mw.html.create('div'):attr('style', styleRight):node(getTeamLogo(nil, game, size)):node('<div style="font-size: 0.8rem;">TBD</div>')) end row:node(time):node(team1):node(vs):node(team2) container:node(row) end 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:Infobox/Widget/Upcoming matches/doc
(
edit
)
No categories
Edit