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:LocationsSearch/Countries
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 CountryData = mw.loadData('Module:Localisation/Data') local p = {} function p.main(frame) local args = getArgs(frame) local tables = 'Locations' local fields = 'country' local cargoArgs = { groupBy = 'Locations.country' } local results = cargo.query(tables, fields, cargoArgs) local container = mw.html.create('div'):addClass('dropdown__content'):attr('id', 'country--dropdown') if #results > 0 then local countries = {} for _, result in ipairs(results) do table.insert(countries, result.country) end local uniqueCountries = {} for _, country in ipairs(countries) do if not uniqueCountries[country] then uniqueCountries[country] = true end end -- Convert unique country values to a list local uniqueCountriesList = {} for country, _ in pairs(uniqueCountries) do table.insert(uniqueCountriesList, country) end if #uniqueCountriesList > 0 then for i = 1, #uniqueCountriesList do local country = CountryData[string.upper(uniqueCountriesList[i])] container:node(mw.html.create('div'):addClass('dropdown__item'):attr('data-country', uniqueCountriesList[i]):wikitext(country)) end return container end 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:LocationsSearch/Countries/doc
(
edit
)
No categories
Edit