Module:RoundN/sandbox: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
 
(29 intermediate revisions by 7 users not shown)
Line 294:
else
cell = p.teamBoxPadTab
end
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 299 ⟶ 303:
:css(cell)
:attr{rowspan = 2}
:node(mw.html.create(f.bold and 'b'):wikitext(v or f[1] and '' or '&nbsp;'text))
end
end
Line 348 ⟶ 352:
for _, v in ipairs({--more args to boolean
'widescore',
'template',
'article_include',
'color',
'color_repechage',
Line 428 ⟶ 430:
end
tab
:addClass('tbr')
: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('tbrskin-invert')
if not p.no_column_head then--headings row
newRow()
head.row = tab.r
:addClass'tbr-head'
:css{['white-space'] = args.scroll_height and 'nowrap'}
newRow()
Line 456 ⟶ 457:
setmetatable(scoreWidth, _scoreWidth)
end
 
if p.template or p.article_include then
p.template = mw.title.new(args.name)
p.templateFixedName = (p.template.namespace == 0 and not p.article_include and 'Template:' or '') .. p.template.fullText
end
p.template = p.template and mw.title.new(args:clean('name', {pattern = ''}))
local head_br = {
count = 0,
Line 488 ⟶ 485:
or p.RD[#p.RD + k - p.tCols - 1]
or ('Round of ' .. math.pow(2, p.tCols - k + 1))
drawHead(head.wt)
k == 1 and p.template and mw.getCurrentFrame():expandTemplate{
title = 'navbar-header',
args = {head.wt, p.templateFixedName}
} or head.wt
)
end
end
Line 529 ⟶ 521:
rowNum[1]:node(c < p.cols and
mw.clone(bumpBase):attr{rowspan = bump}
or p.no_column_head and p.template and
mw.html.create'td':wikitext(mw.getCurrentFrame():expandTemplate{
title = 'navbar-header',
args = {'', p.templateFixedName}
})
)
end
Line 672 ⟶ 659:
{border = p.teamBoxNormal.border, ['background-color'] = p.bgColor[color_index], color = p.textColor[color_index]}
or p.teamBoxNormal
p.teamBoxMedalColor = color_index < 4
else
p.teamBoxCSS = (colorFinal or col.color_repechage) and
Line 745 ⟶ 733:
end
col.n = 0
col.t2 = nil
for r = bumps + 1, rows, p.unit * 2 do
tab.r = rowNum[r]:tag'td'
Line 753 ⟶ 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 760 ⟶ 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 775 ⟶ 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 798 ⟶ 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 806 ⟶ 797:
end
local lock_height = (head_br.count or 0) + 1
local generatedOutput =return args.scroll_height and
local templatestyles = mw.getCurrentFrame():extensionTag{ name = 'templatestyles', args = { src = 'Module:RoundN/styles.css'} }
local generatedOutput = args.scroll_height and
mw.html.create'div'
:cssText'border-bottom:1px solid #eee;display:inline-block'
:addClass'tbr-scroller'
:node(not (p.scroll_head_unlock or p.no_column_head) and mw.html.create'div'
:addClass'tbr-scroller-head'
:css{
overflow = 'hidden',
-- figure out if this is needed
height = lock_height * 1.4 + 1.6 .. 'em',
['border-bottom'] = 'inherit',
['margin-right'] = '17px'
}
:node(mw.clone(tab))
)
:tag'div'
:addClass'tbr-scroller-body'
:css{
['overflow-y'] = 'scroll',
['max-height'] = tonumber(args.scroll_height, 10) and args.scroll_height .. 'px' or args.scroll_height
}
Line 829 ⟶ 820:
:done()
or tab
return templatestyles .. tostring(generatedOutput)
end