Module:Top icons: Difference between revisions
Jump to navigation
Jump to search
no edit summary
scape_>Gaz Lloyd m (fix rs3 wiki links) |
scape_>Gaz Lloyd No edit summary |
||
Line 2: | Line 2: | ||
local sites = { | local sites = { | ||
rsc = { | rsc = { | ||
format = '[[ | -- @TODO: update with new url post forking RSC | ||
format = '[[rsw:%s]]', | |||
params = { 'rsc', 'classic', 'c' }, | params = { 'rsc', 'classic', 'c' }, | ||
abbr = ' | abbr = 'CS', | ||
title = 'The RuneScape Classic Wiki also has an article on | title = 'The RuneScape Classic Wiki also has an article on %s.', | ||
}, | }, | ||
rs = { | rs = { | ||
format = '[[ | format = '[[rsw:%s]]', | ||
params = { 'runescape', 'rs', 'rsw', 'rs3' }, | params = { 'runescape', 'rs', 'rsw', 'rs3' }, | ||
abbr = ' | abbr = 'RuneScape', | ||
title = 'The RuneScape Wiki also has an article on {{ | title = 'The RuneScape Wiki also has an article on %s.', | ||
}, | |||
wp = { | |||
format = '[[wikipedia:%s]]', | |||
params = { 'wikipedia', 'wp', 'w' }, | |||
abbr = 'Wikipedia', | |||
title = 'Wikipedia also has an article on %s.', | |||
}, | }, | ||
} | } | ||
local order = { ' | local order = { 'os' } | ||
local allparams = {} | local allparams = {} | ||
Line 56: | Line 57: | ||
local ret = mw.html.create('div') | local ret = mw.html.create('div') | ||
ret:addClass(' | ret:addClass('rs-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 = | local span = ret:tag('span') | ||
span:wikitext(sites[v]. | span:wikitext(string.format(sites[v].format, vals[v])) | ||
:addClass('rs-header-icon rs-header-icon-'..v) | :addClass('rs-header-icon rs-header-icon-'..v) | ||
:attr('title' | :attr({ | ||
['data-title'] = string.format(sites[v].title, vals[v]), | |||
['data-site'] = v, | |||
['data-text'] = sites[v].abbr, | |||
}) | |||
end | end | ||
end | end | ||
Line 69: | Line 73: | ||
return tostring(ret) | return tostring(ret) | ||
end | end | ||
return p | return p |