Module:MovementTabs: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) background image |
No edit summary |
||
| (One intermediate revision by one other user not shown) | |||
| Line 8: | Line 8: | ||
local current = mw.title.getCurrentTitle().fullText | local current = mw.title.getCurrentTitle().fullText | ||
local rootPage = args[1] or current | local rootPage = args[1] or current | ||
local lang_code = lang_module.get_lang_code() | local lang_code = lang_module.get_lang_code() | ||
local lang_suffix = (lang_code ~= "en") and ("/" .. lang_code) or "" | local lang_suffix = (lang_code ~= "en") and ("/" .. lang_code) or "" | ||
| Line 20: | Line 17: | ||
end | end | ||
local html = mw.html.create("div") | -- Create outer container using your new CSS class | ||
local html = mw.html.create("div"):addClass("hero-tabs") | |||
for _, tab in ipairs(tabs) do | for _, tab in ipairs(tabs) do | ||
| Line 46: | Line 31: | ||
local active = current == pagePlain or current == pagePlain .. lang_suffix | local active = current == pagePlain or current == pagePlain .. lang_suffix | ||
local div = html:tag("div") | local div = html:tag("div"):addClass("hero-tab") | ||
if active then | if active then | ||
div:wikitext(string.format('[[:%s| | div:addClass("hero-tab-active") | ||
div:wikitext(string.format('[[:%s|%s]]', pageTarget, tab)) | |||
else | else | ||
div:wikitext(string.format('[[:%s|<span | div:wikitext(string.format('[[:%s|<span class="hero-tab-inactive">%s</span>]]', pageTarget, tab)) | ||
end | end | ||
end | end | ||