Module:Large category TOC/sandbox: Difference between revisions

Content deleted Content added
order matters >_>
use tstyles
Line 6:
 
local function main(toc_type)
-- It should be much faster to only process these once, and just re use them as variables
local pageurl = mw.title.getCurrentTitle():fullUrl()
local toc = mw.message.new('Toc'):plain()
-- Highest level div
local toc_frame = mw.html.create('div')
:addClass('large-cat-toc')
:addClass('plainlinks')
:addClass('hlist')
:addClass('toc')
-- :attr('id','toc')
:css({
['box-sizing'] = 'border-box',
display = 'block',
clear = 'both',
width = '100%'
})
 
-- Contains "Content: Top 0-9 A - Z"
local header = toc_frame:tag('div')
:attr('id', 'toctitle')
:attr('class', 'toctitle')
Line 32 ⟶ 19:
local body_wrapper
local body = toc_frame:tag('div')
:cssaddClass('textlarge-align', 'centercat-toc-body')
local jumpy_collapse = mw.html.create('div')
:addClass('large-cat-toc-jumpy-title')
:cssText('margin: 0 4em')
if toc_type == 'collapsible' then
toc_frame:addClass('mw-collapsible mw-collapsed')
:cssText('padding: 4px; text-align: center; border: 1px solid #a2a9b1; font-size: 95%')
header:cssText('font-weight: bold; line-height: 1.6em')
body:addClass('mw-collapsible-content')
:css({
background = 'white'
})
elseif toc_type == 'scrollable' then
bodytoc_frame:cssaddClass({ ['overflowlarge-cat-toc-x'] = 'scroll',)
['overflow-y']= 'hidden',
['white-space'] = 'nowrap' })
end
local pageurl = mw.title.getCurrentTitle():fullUrl()
local header_content = {'<span style="font-weight: bold">',toc,':</span>',
local header_content = {
' [',pageurl,' Top]',
string.format(
' [',pageurl,'?from=0 0–9]' }
'<span class="large-cat-toc-title">%s:</span> [%s Top] [%s?from=0 0–9]',
local toc = mw.message.new('Toc'):plain(),
' [',pageurl,' Top]',
pageurl
})
}
for _, v in ipairs(azupper) do
table.insert(header_content, string.format(
' [%s?from=%s %s]', pageurl, v, v))
}))
end
Line 69 ⟶ 58:
if toc_type == 'collapsible' then
table.insert(body_content,'<bspan class="large-cat-toc-anum">#</bspan> ')
body_wrapper = body:tag('code')
:css('background','White')
else
table.insert(body_content,'<span class="large-cat-toc-anum">['..pageurl..'?from=* <b>*</b>] <b>#</bspan> ')
body_wrapper = body:tag('span')
end
Line 91 ⟶ 79:
if toc_type == 'aejot' or toc_type == 'scrollable' then
table.insert(azlist,' • <bspan class="large-cat-toc-anum">'..letter..'</bspan> ')
else
table.insert(azlist,'<br /><bspan class="large-cat-toc-anum">'..letter..'</bspan> ')
end