Module:Page tabs and Module:Page tabs/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
fix text color in dark mode; this generally works but may cause problems, in which case revert or try specifying a different CSS value |
NasssaNser (talk | contribs) add back custom tab coloring |
||
Line 15: | Line 15: | ||
local root = mw.html.create() |
local root = mw.html.create() |
||
root:wikitext(yesno(args.NOTOC) and '__NOTOC__' or nil) |
root:wikitext(yesno(args.NOTOC) and '__NOTOC__' or nil) |
||
local row = root:tag('div') |
local row = root:tag('div') |
||
:css('background', args.Background or |
:css('background', args.Background or nil) |
||
:css('color', 'black') |
|||
:cssText(args.style or nil) |
|||
:addClass('template-page-tabs') |
:addClass('template-page-tabs') |
||
:addClass(args.class or nil) |
|||
if not args[1] then |
if not args[1] then |
||
args[1] = '{{{1}}}' |
args[1] = '{{{1}}}' |
||
end |
end |
||
for i, link in ipairs(args) do |
for i, link in ipairs(args) do |
||
makeTab(row, link, args |
makeTab(row, link, tonumber(args.This) == i, |
||
⚫ | |||
end |
end |
||
Line 31: | Line 31: | ||
end |
end |
||
function p.makeTab(root, link, |
function p.makeTab(root, link, selected, tabColor) |
||
local thisPage = (args.This == 'auto' and link:find('[[' .. mw.title.getCurrentTitle().prefixedText .. '|', 1, true)) or tonumber(args.This) == i |
|||
root:tag('span') |
root:tag('span') |
||
:addClass( |
:addClass('template-page-tabs-tab') |
||
:addClass(selected and 'template-page-tabs-tab--selected' or nil) |
|||
⚫ | |||
:css('color', |
:css('background-color', tabColor) |
||
:cssText(thisPage and 'border-bottom:0;font-weight:bold' or 'font-size:95%') |
|||
:cssText(css) |
|||
:wikitext(link) |
:wikitext(link) |
||
:done() |
|||
:wikitext('<span class="spacer ' .. (class or "") .. '"> </span>') |
|||
end |
end |
||