Module:Navbar/styles.css: Difference between revisions

From BoyWiki
No edit summary
Tag: Reverted
(Change to Wikipedia standard)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
/* {{pp|small=yes}} */
.navbar {
display: inline;
font-size: 88%;
font-weight: normal;
}


local getArgs
.navbar-collapse {
float: left;
text-align: left;
}


function p._navbar(args)
.navbar-boxtext {
local titleArg = 1
word-spacing: 0;
}


if args.collapsible then
.navbar ul {
titleArg = 2
display: inline-block;
if not args.plain then
white-space: nowrap;
args.mini = 1
line-height: inherit;
end
}
if args.fontcolor then
args.fontstyle = 'color:' .. args.fontcolor .. ';'
end
args.style = 'float:left; text-align:left'
end


local titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle())
.navbar-brackets::before {
local title = mw.title.new(mw.text.trim(titleText), 'Template');
margin-right: -0.125em;
content: '[ ';
}


if not title then
.navbar-brackets::after {
error('Invalid title ' .. titleText)
margin-left: -0.125em;
end
content: ' ]';
}


local talkpage = title.talkPageTitle and title.talkPageTitle.fullText or '';
.navbar li {
word-spacing: -0.125em;
}


local div = mw.html.create():tag('div')
.navbar a > span,
div
.navbar a > abbr {
:addClass('plainlinks')
text-decoration: inherit;
:addClass('hlist')
}
:addClass('navbar')
:cssText(args.style)


if args.mini then div:addClass('mini') end
.navbar-mini abbr {
font-variant: small-caps;
border-bottom: none;
text-decoration: none;
cursor: inherit;
}


if not (args.mini or args.plain) then
.navbar-ct-full {
div
font-size: 114%;
:tag('span')
margin: 0 7em;
:css('word-spacing', 0)
}
:cssText(args.fontstyle)
:wikitext(args.text or 'This box:')
:wikitext(' ')
end


if args.brackets then
.navbar-ct-mini {
div
font-size: 114%;
:tag('span')
margin: 0 4em;
:css('margin-right', '-0.125em')
}
:cssText(args.fontstyle)
:wikitext('[')
:newline();
end
 
local ul = div:tag('ul');
 
ul
:tag('li')
:addClass('nv-view')
:wikitext('[[' .. title.fullText .. '|')
:tag(args.mini and 'abbr' or 'span')
:attr('title', 'View this template')
:cssText(args.fontstyle)
:wikitext(args.mini and 'v' or 'view')
:done()
:wikitext(']]')
:done()
:tag('li')
:addClass('nv-talk')
:wikitext('[[' .. talkpage .. '|')
:tag(args.mini and 'abbr' or 'span')
:attr('title', 'Discuss this template')
:cssText(args.fontstyle)
:wikitext(args.mini and 't' or 'talk')
:done()
:wikitext(']]');
 
if not args.noedit then
ul
:tag('li')
:addClass('nv-edit')
:wikitext('[' .. title:fullUrl('action=edit') .. ' ')
:tag(args.mini and 'abbr' or 'span')
:attr('title', 'Edit this template')
:cssText(args.fontstyle)
:wikitext(args.mini and 'e' or 'edit')
:done()
:wikitext(']');
end
 
if args.brackets then
div
:tag('span')
:css('margin-left', '-0.125em')
:cssText(args.fontstyle)
:wikitext(']')
:newline();
end
 
if args.collapsible then
div
:done()
:tag('div')
:css('font-size', '114%')
:css('margin', args.mini and '0 4em' or '0 7em')
:cssText(args.fontstyle)
:wikitext(args[1])
end
 
return tostring(div:done())
end
 
function p.navbar(frame)
if not getArgs then
getArgs = require('Module:Arguments').getArgs
end
return p._navbar(getArgs(frame))
end
 
return p

Latest revision as of 22:14, 1 June 2022

/* {{pp|small=yes}} */
.navbar {
	display: inline;
	font-size: 88%;
	font-weight: normal;
}

.navbar-collapse {
	float: left;
	text-align: left;
}

.navbar-boxtext {
	word-spacing: 0;
}

.navbar ul {
	display: inline-block;
	white-space: nowrap;
	line-height: inherit;
}

.navbar-brackets::before {
	margin-right: -0.125em;
	content: '[ ';
}

.navbar-brackets::after {
	margin-left: -0.125em;
	content: ' ]';
}

.navbar li {
	word-spacing: -0.125em;
}

.navbar a > span,
.navbar a > abbr {
	text-decoration: inherit;
}

.navbar-mini abbr {
	font-variant: small-caps;
	border-bottom: none;
	text-decoration: none;
	cursor: inherit;
}

.navbar-ct-full {
	font-size: 114%;
	margin: 0 7em;
}

.navbar-ct-mini {
	font-size: 114%;
	margin: 0 4em;
}