Module:Large category TOC: Difference between revisions
Richardpruen (talk | contribs) m 1 revision imported  | 
				 glad I sandboxed it. we do still want the bold weight here but not necessarily whatever the default for strong is (which may be font-weight: bolder rather than bold)  | 
				||
| Line 28: | Line 28: | ||
				:addClass('toc')  | 				:addClass('toc')  | ||
				-- :attr('id','toc')  | 				-- :attr('id','toc')  | ||
				:css({ display = 'block   | 				:css({  | ||
					display = 'block',  | |||
					background = 'WhiteSmoke',  | |||
					clear = 'both',  | |||
					width = '98%'  | |||
				})  | |||
	-- Contains "Content: Top 0-9 A - Z"  | 	-- Contains "Content: Top 0-9 A - Z"  | ||
	local header = toc_frame:tag('div')  | 	local header = toc_frame:tag('div')  | ||
		:attr('id', 'toctitle')  | |||
		:attr('class', 'toctitle')  | |||
	-- Contains all the rest  | 	-- Contains all the rest  | ||
	local body_wrapper  | 	local body_wrapper  | ||
	local body = toc_frame:tag('div')  | 	local body = toc_frame:tag('div')  | ||
		:css('text-align', 'center')  | |||
	local jumpy_collapse = mw.html.create('div')  | |||
		:cssText('margin: 0 4em')  | |||
	if toc_type == 'collapsible' then  | 	if toc_type == 'collapsible' then  | ||
		toc_frame:addClass('  | 		toc_frame:addClass('mw-collapsible mw-collapsed')  | ||
		header:  | 			:cssText('padding: 4px; text-align: center; border: 1px solid #a2a9b1; font-size: 95%')  | ||
		body:addClass('  | 		header:cssText('font-weight: bold; line-height: 1.6em')  | ||
			:css({ background = 'white'  | 		body:addClass('mw-collapsible-content')  | ||
			:css({  | |||
				background = 'white'  | |||
			})  | |||
	elseif toc_type == 'scrollable' then  | 	elseif toc_type == 'scrollable' then  | ||
		body:css({ ['overflow-x'] = 'scroll',  | 		body:css({ ['overflow-x'] = 'scroll',  | ||
| Line 56: | Line 62: | ||
	end  | 	end  | ||
	local header_content = {'<  | 	local header_content = {'<span style="font-weight: bold">',toc,':</span>',  | ||
						' [',pageurl,' Top]',  | 						' [',pageurl,' Top]',  | ||
						' [',pageurl,'?from=0 0–9]' }  | 						' [',pageurl,'?from=0 0–9]' }  | ||
| Line 63: | Line 69: | ||
		table.insert(header_content,string.format(' [%s?from=%s %s]',pageurl,v,v))  | 		table.insert(header_content,string.format(' [%s?from=%s %s]',pageurl,v,v))  | ||
	end  | 	end  | ||
	header:wikitext(table.concat(header_content))  | |||
	if toc_type == 'collapsible' then  | |||
		jumpy_collapse:wikitext(table.concat(header_content))  | |||
		header:node(jumpy_collapse)  | |||
	else  | |||
		header:wikitext(table.concat(header_content))  | |||
	end  | |||
	local body_content = {}  | 	local body_content = {}  | ||