Module:Top icons: Difference between revisions

Created page with "--<nowiki> local p = {} local sites = { gsm = { format = 'You can find the Game here.', params = { 'gem', 'game', 'gs' }, abbr = 'gs', title = 'You can find the Game..."
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 4: Line 4:
local sites = {
local sites = {
gsm = {
gsm = {
format = 'You can find the Game here.',
format = ('https://geministation.com/ship'),
params = { 'gem', 'game', 'gs' },
params = { 'gem', 'game', 'gs', 'gsm' },
abbr = 'gs',
abbr = 'gs',
title = 'You can find the Game here.',
title = 'Return to ship.',
},
},
gsf = {
gsf = {
format = 'Visit the Gemini Station Forum.',
format = ('https://forum.geministation.com/'),
params = { 'gsf', 'gf' },
params = { 'gsf', 'gf' },
abbr = 'Forum',
abbr = 'Forum',
title = 'Visit the Gemini Station Forum.',
title = 'Visit the Gemini Station Forum',
},
},
wp = {  
wp = {  
Line 23: Line 23:
}
}


local order = { 'os', 'rsc', 'wp', 'wg' }
local order = { 'gsm', 'gsf', 'wp' }


local allparams = {}
local allparams = {}
Line 57: Line 57:
local ret = mw.html.create('div')
local ret = mw.html.create('div')
ret:addClass('rs-external-header-links'):css('display', 'none')
ret:addClass('gs-external-header-links'):css('display', 'none')
for _,v in ipairs(order) do
for _,v in ipairs(order) do
if vals[v] then
if vals[v] then
local span = ret:tag('span')
local span = ret:tag('span')
span:wikitext(string.format(sites[v].format, vals[v]))
span:wikitext(string.format(sites[v].format, vals[v]))
:addClass('rs-header-icon rs-header-icon-'..v)
:addClass('gs-header-icon gs-header-icon-'..v)
:attr({
:attr({
['data-title'] = string.format(sites[v].title, vals[v]),
['data-title'] = string.format(sites[v].title, vals[v]),