Editing
Module:Tnavbar
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
-- <nowiki> -- -- Implements {{tnavbar}} and variants -- -- @todo move the hardcoded css to [[MediaWiki:Common.css]] given how many pages it's found on -- require('strict') local p = {} local yesno = require( 'Module:Yesno' ) function p._navbar( args ) local navbarstyle = args.style or '' local fontstyle = args.fontstyle or '' local view, talk, edit = (args.view or true), (args.talk or true), (args.edit or true) local desc = { view = 'view', talk = 'talk', edit = 'edit' } local tag = mw.html.create( 'div' ) :addClass( 'navbar' ) :addClass( 'plainlinks' ) :addClass( 'noprint' ) :css( { ['white-space'] = 'nowrap', ['font-weight'] = 'normal', ['font-size'] = 'x-small' } ) :cssText( navbarstyle ) if yesno( args.mini ) then desc = { view = 'v', talk = 't', edit = 'e' } tag:addClass( 'navbar-mini' ) end local viewSpan = mw.html.create( 'span' ) :attr( 'title', 'View this template' ) :cssText( fontstyle ) :wikitext( desc.view ) local talkSpan = mw.html.create( 'span' ) :attr( 'title', 'Discussion about this template' ) :cssText( fontstyle ) :wikitext( desc.talk ) local editSpan = mw.html.create( 'span' ) :attr( 'title', 'Edit this template' ) :cssText( fontstyle ) :wikitext( desc.edit ) local title = args[1] and mw.text.trim( args[1] ) or error('No page title given') local ns, titleTbl, pagelink, talklink if mw.ustring.sub( title, 1, 1 ) == ':' then -- mainspace title = mw.ustring.sub( title, 2 ) pagelink = title talklink = 'Talk:' .. title elseif mw.ustring.match( title, ':' ) then -- split title to see if it has a valid namespace titleTbl = mw.text.split( title, ':' ) ns = mw.site.namespaces[titleTbl[1]] if ns ~= nil then pagelink = ns.name .. ':' .. table.concat( titleTbl, '', 2 ) if ns.isTalk then talklink = page else talklink = ns.talk.name .. ':' .. table.concat( titleTbl, '', 2 ) end end end -- this happens if there's no semi-colons in title -- or if there is semi-colons but it didn't have valid ns name if not pagelink then pagelink = 'Template:' .. title talklink = 'Template talk:' .. title end tag:wikitext( '[[' .. pagelink .. '|' .. tostring( viewSpan ) .. ']]' ) :wikitext( ' ' ) :tag( 'span' ) :css( 'font-size', '80%' ) :wikitext( '•' ) :done() :wikitext( ' ' ) if talk == 'autoconfirmed' then tag :tag( 'span' ) :addClass( 'autoconfirmed-show' ) :css( 'display', 'none' ) :wikitext( '[' .. tostring( mw.uri.fullUrl( talklink ) ) .. ' ' .. tostring( talkSpan ) .. ']' ) :wikitext( ' ' ) :tag( 'span' ) :css( 'font-size', '80%' ) :wikitext( '•' ) :done() :wikitext( ' ' ) :done() elseif yesno(talk) then tag:wikitext( '[' .. tostring( mw.uri.fullUrl( talklink ) ) .. ' ' .. tostring( talkSpan ) .. ']' ) :wikitext( ' ' ) :tag( 'span' ) :css( 'font-size', '80%' ) :wikitext( '•' ) :done() :wikitext( ' ' ) :done() end tag:wikitext( '[' .. tostring( mw.uri.fullUrl( pagelink, 'action=edit' ) ) .. ' ' .. tostring( editSpan ) .. ']' ) return tostring( tag ) end function p.navbar( frame ) return p._navbar( frame:getParent().args ) end return p
Summary:
Please note that all contributions to OtherX may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
OtherX:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Documentation
(
edit
)
Template:T
(
edit
)
Module:Array
(
edit
)
Module:DPLlua
(
edit
)
Module:DependencyList
(
edit
)
Module:Documentation
(
edit
)
Module:Paramtest
(
edit
)
Module:T
(
edit
)
Module:Tnavbar
(
edit
)
Module:Tnavbar/doc
(
edit
)
Module:Tooltip
(
edit
)
Module:Yesno
(
edit
)
This page is a member of a hidden category:
Category:Pages with broken file links
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Purge cache
Search
Discord
Discord
Navigation
Main page
About us
Random page
Otherside
Legends of the Mara
Otherside Trips
Otherside Test Events
LOTM Guides & Info
Basics Guide
Hunting Guide
Farming Guide
Enchanting Guide
Game Updates
Oda Information
Quick References
Koda Weapons
Oda Abilities Table
Oda Stats Table
Tools
What links here
Related changes
Special pages
Page information
Page values