Content deleted Content added
m sync to live module Tag: Reverted |
Qqkuro66541 (talk | contribs) No edit summary |
||
(41 intermediate revisions by 10 users not shown) | |||
Line 1:
local p = {
RD = {
'Quarter-finals',▼
'Semi-finals',
'Final',
▲ 'Quarter-finals',
'Third place'
},
-- The text and background colors are paired and when you set one, you should set the other (accessibility)
textColor = {head = '#202122', '#202122', '#202122', '#202122', '#202122'},
bgColor = {head = '#f2f2f2', 'gold', 'silver', '#C96', '#f9f9f9'},
reuseStr = {},
Line 175 ⟶ 177:
['text-align'] = 'center',
border = '1px solid #aaa',
['background-color'] = p.bgColor.head,
color = p.textColor.head
}
end
Line 265 ⟶ 268:
end
p.teamBoxPadTab = {padding = '0 ' .. p.teamBoxPadding()}
p.teamBoxNormal = {border = '1px solid #aaa', ['background-color'] = p.bgColor[4], color = p.textColor[4]}
local function teamBox(v, r, f)
if p.flex_tree.merge and not v and f.phase == 2 then
Line 291 ⟶ 294:
else
cell = p.teamBoxPadTab
local text = v or f[1] and '' or ' '
if f.bold then
text = mw.ustring.gsub(text, '(%(%[%[[^%[%]]*%]%]%))', '<span style="font-weight:normal">%1</span>')
end
tab.r = rowNum[r]:tag'td'
Line 296 ⟶ 303:
:css(cell)
:attr{rowspan = 2}
:node(mw.html.create(f.bold and 'b'):wikitext(
end
end
Line 345 ⟶ 352:
for _, v in ipairs({--more args to boolean
'widescore',
'color',
'color_repechage',
'3rdplace',
'omit_blanks',
Line 426 ⟶ 432:
:cssText(table.concat{args.scroll_height and 'padding' or 'margin', ':', fontSize and (math.ceil(fontSize * 10) / 10) or '.9', 'em 2em 1em 1em;border:0;', fontSize and '' or 'font-size:90%;border-collapse:separate;', args.style})
:attr{cellpadding = 0, cellspacing = 0}
:addClass('skin-invert')
if not p.no_column_head then--headings row
newRow()
Line 450 ⟶ 457:
setmetatable(scoreWidth, _scoreWidth)
end
▲ end
local head_br = {
count = 0,
Line 482 ⟶ 485:
or p.RD[#p.RD + k - p.tCols - 1]
or ('Round of ' .. math.pow(2, p.tCols - k + 1))
drawHead(head.wt)
end
end
Line 523 ⟶ 521:
rowNum[1]:node(c < p.cols and
mw.clone(bumpBase):attr{rowspan = bump}
})▼
)
end
Line 533 ⟶ 526:
col.top = m.num
p.span = p.tCols > c and bump * 2 or p.branch_upwards or math.max((bump - 1) / 2, 2)
col.color_repechage = p['color_repechage'] and ((c == p.tCols) or ((c == p.tCols-1) and skipMatch[math.pow(2, p.tCols) - 1]))
col.show3rd = p['3rdplace'] and c == p.tCols and rowNum.third
local colorFinal, bumpMid = p.color and c == p.tCols, p.span > 0 and mw.clone(bumpBase):attr{rowspan = p.span} or nil
Line 651 ⟶ 645:
else
if m.showBox[m.phase] then
if col.color_repechage then
p.teamBoxCSS = colorFinal and▼
col.color_repechage = 2
{border = p.teamBoxNormal.border, background = p.bgColor[m.phase + (col.show3rd or 0)]}▼
if p.bold then
if m.bold.win(m.phase) and (colorFinal or col.color_repechage) then
color_index = 1 + (col.show3rd or 0) + (col.color_repechage or 0)
elseif m.bold.box[#m.nonEmpty] then
color_index = 2 + (col.show3rd or 0) + (col.color_repechage or 0)
else▼
color_index = 4
end
▲ p.teamBoxCSS = (colorFinal or col.color_repechage) and
▲ {border = p.teamBoxNormal.border, ['background-color'] = p.bgColor[
or p.teamBoxNormal
p.teamBoxMedalColor = color_index < 4
else
p.teamBoxCSS = (colorFinal or col.color_repechage) and
{border = p.teamBoxNormal.border, ['background-color'] = p.bgColor[m.phase + (col.show3rd or 0) + (col.color_repechage or 0)], color = p.textColor[m.phase + (col.show3rd or 0) + (col.color_repechage or 0)]}
or p.teamBoxNormal
end
local f = {phase = m.phase, bold = m.bold.win(m.phase)}
teamBox(args[step + nodeArgs.team[m.phase]], m.r, f)
Line 722 ⟶ 733:
end
col.n = 0
col.t2 = nil
for r = bumps + 1, rows, p.unit * 2 do
tab.r = rowNum[r]:tag'td'
Line 730 ⟶ 742:
col.n = col.n + 2
col.t2 = skipMatch[col.tot + col.n / 2 + 1] and 3 or ((skipMatch[col.top + col.n] and 1 or 0) + (skipMatch[col.top + col.n + 1] and 2 or 0))
if col.t == 0 then --draws the ']' when a PAIR of matches needs lines
tab.r
:attr{rowspan = maxSpan(p.unit * 2, r, rows)}
Line 737 ⟶ 749:
['border-left'] = 0
})
else --draws the lines when only top OR bottom match need lines
▲ else
tab.r
:attr{rowspan = maxSpan(p.unit, r, rows)}
:cssText(col.t == 2 and
p:saveStr('topRight', 'border-width:', tab.line[2], ' 0 0;border-style:solid;')
or col.t == 1 and (nodeFunc.bridge.lay[c](col.n - 2) and
p:saveStr('right', ';border-right:', p.reuseStr.solid)
Line 752 ⟶ 764:
:attr{rowspan = maxSpan(p.unit, r + p.unit, rows)}
:cssText(col.t == 1 and
p:saveStr('bttmRght', 'border-width:0 ', tab.line[2], ' 0;border-style:solid;')
or col.t == 2 and (nodeFunc.bridge.lay[c](col.n + 2) and
p:saveStr('right', ';border-right:', p.reuseStr.solid)
Line 775 ⟶ 787:
:attr{rowspan = maxSpan(p.unit * 2, r, rows)}
:css(nodeFunc.bridge.lay[c](col.n) and
{['border-right'] = p.reuseStr.solid
['border-color'] = 'var(--border-color-base)'
or {}
)
Line 835 ⟶ 849:
['background-color'] = p.bgColor.head,
border = '1px solid #aaa',
color = p.textColor.head,
['text-align'] = 'center',
width = width
|