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:NewsLanding/Sponsors
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 getArgs = require('Module:Arguments').getArgs local cargo = mw.ext.cargo local p = {} function p.main(frame) local args = getArgs(frame) local hotItems = mw.html.create('div'):addClass('news-hot-items') local container = mw.html.create('div'):addClass('news-hot'):node(mw.html.create('h3'):addClass('tc'):wikitext('Sponsor Pages')):node(hotItems) local tables = 'Sponsors, _pageData' local fields = 'Sponsors.id=id' local cargoArgs = { join = 'Sponsors._pageName = _pageData._pageName', orderBy = "_pageData._modificationDate DESC", groupBy = 'Sponsors.id', limit = 8 } local results = cargo.query(tables, fields, cargoArgs) if #results > 0 then for i = 1, #results do local result = results[i] local title = mw.html.create('div'):wikitext('[[' .. result.id .. '|' .. mw.ext.displaytitle.get(result.id) .. ']]') -- local date = mw.html.create('div'):wikitext('Last edit: ' .. page.date) -- local textDiv = mw.html.create('div'):node(title):node(date) local newsItem = mw.html.create('div'):attr('style', 'display: flex; flex-direction: column; align-items: center; gap: 0.5rem;'):node(title) local logoDiv = mw.html.create('div') local title = mw.html.create('div'):wikitext('[[' .. result.id .. '|' .. string.gsub(result.id, 'Companies/', '') .. ']]') -- local date = mw.html.create('div'):wikitext('Last edit: ' .. page.date) -- local textDiv = mw.html.create('div'):node(title):node(date) local newsItem = mw.html.create('div'):attr('style', 'display: flex; flex-direction: column; align-items: center; gap: 0.5rem;'):node(title):node(logoDiv) hotItems:node(newsItem) local tables = 'Logos' local fields = '_pageName, logoAll, logoDark, logoLight, iconAll, iconLight, iconDark' local cargoArgs = { where = '_pageName = "' .. result.id .. '"' } local logoResults = cargo.query(tables, fields, cargoArgs) if #logoResults > 0 then local result = logoResults[1] if logoResults[1].iconAll then logoDiv:node(createLogo(result._pageName, logoResults[1].iconAll)) elseif logoResults[1].iconLight and logoResults[1].iconDark then logoDiv:node(createLogo(result._pageName, logoResults[1].iconLight, 'light')):node(createLogo(result._pageName, logoResults[1].iconDark, 'dark')) elseif logoResults[1].logoAll then logoDiv:node(createLogo(result._pageName, logoResults[1].logoAll)) elseif logoResults[1].logoLight and logoResults[1].logoDark then logoDiv:node(createLogo(result._pageName, logoResults[1].logoLight, 'light')):node(createLogo(result._pageName, logoResults[1].logoDark, 'dark')) else local logo = logoResults[1].iconLight or logoResults[1].iconDark or logoResults[1].logoLight or logoResults[1].logoDark logoDiv:node(createLogo(result._pageName, logo)) end else logoDiv:node(createLogo(result.id, 'Team_placeholder_dark.png', 'dark')):node(createLogo(result.id, 'Team_placeholder_light.png', 'light')) end end end return container end function createLogo(page, url, class) local className = class and class .. ' h-100' or 'h-100' local logoURL = url and url or 'Team_placeholder_dark.png' local logoContainer = mw.html.create('div') :addClass(className) local logo = mw.html.create('div') :addClass('team-list-logo') :node('[[File:' .. logoURL .. '|80x80px|link=' .. page .. ']]') logoContainer:node(logo) return logoContainer end function getFirstImage(pageContent) -- List of parameters to check for image names local imageParameters = {"image", "logoAll", "logoLight", "logoDark"} -- Iterate through the parameters and find the first one with a value for _, paramName in ipairs(imageParameters) do local imageValue = string.match(pageContent, "|%s*" .. paramName .. "%s*=%s*([^|\n}]+)") if imageValue then -- Return the extracted image file name return imageValue end end return nil 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:NewsLanding/Sponsors/doc
(
edit
)
No categories
Edit