Module:Navbar
Fiji Hindi editions of Wiki, an online encyclopedia
![]() | This Lua module is used on 2,150,000 pages. To avoid large-scale disruption and unnecessary server load, any changes to this module should first be tested in its /sandbox or /testcases subpages. The tested changes can then be added to this page in one single edit. Please consider discussing any changes on the talk page before implementing them. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
![]() | This template's documentation is missing or does not accurately describe its functionality or the parameters in its code. Please help improve it. |
This is a Lua implementation of {{navbar}}. It is used in Module:Navbox.
local p = {}local getArgslocal ulfunction p.addItem (mini, full, link, descrip, args, url)local lif url thenl = {'[', '', ']'}elsel = {'[[', '|', ']]'}endul:tag('li'):addClass('nv-'..full):wikitext(l[1] .. link .. l[2]):tag(args.mini and 'abbr' or 'span'):attr('title', descrip..' this template'):cssText(args.fontstyle):wikitext(args.mini and mini or full):done():wikitext(l[3])endfunction p.brackets (position, c, args, div)if args.brackets thendiv:tag('span'):css('margin-'..position, '-0.125em'):cssText(args.fontstyle):wikitext(c)endendfunction p._navbar(args)local show = {true, true, true, false, false, false}local titleArg = 1if args.collapsible thentitleArg = 2if not args.plain then args.mini = 1 endif args.fontcolor thenargs.fontstyle = 'color:' .. args.fontcolor .. ';'endargs.style = 'float:left; text-align:left'endif args.template thentitleArg = 'template'show = {true, false, false, false, false, false}local index = {t = 2, d = 2, e = 3, h = 4, m = 5, w = 6, talk = 2, edit = 3, hist = 4, move = 5, watch = 6}for k,v in ipairs(require ('Module:TableTools').compressSparseArray(args)) dolocal num = index[v]if num then show[num] = true endendendif args.noedit then show[3] = false endlocal titleText = args[titleArg] or (':' .. mw.getCurrentFrame():getParent():getTitle())local title = mw.title.new(mw.text.trim(titleText), 'Template')if not title thenerror('Invalid title ' .. titleText)endlocal talkpage = title.talkPageTitle and title.talkPageTitle.fullText or ''local div = mw.html.create():tag('div')div:addClass('plainlinks'):addClass('hlist'):addClass('navbar'):cssText(args.style)if args.mini then div:addClass('mini') endif not (args.mini or args.plain) thendiv:tag('span'):css('word-spacing', 0):cssText(args.fontstyle):wikitext(args.text or 'Ii baakas:'):wikitext(' ')endp.brackets('right', '[ ', args, div)ul = div:tag('ul')if show[1] then p.addItem('v', 'view', title.fullText, 'dekho', args) endif show[2] then p.addItem('t', 'talk', talkpage, 'Discuss', args) endif show[3] then p.addItem('e', 'edit', title:fullUrl('action=edit'), 'Edit', args, true) endif show[4] then p.addItem('h', 'hist', title:fullUrl('action=history'), 'History of', args, true) endif show[5] thenlocal move = mw.title.new ('Special:Movepage')p.addItem('m', 'move', move:fullUrl('target='..title.fullText), 'Move', args, true) endif show[6] then p.addItem('w', 'watch', title:fullUrl('action=watch'), 'Watch', args, true) endp.brackets('left', ' ]', args, div)if args.collapsible thendiv:done():tag('div'):css('font-size', '114%'):css('margin', args.mini and '0 4em' or '0 7em'):cssText(args.fontstyle):wikitext(args[1])endreturn tostring(div:done())endfunction p.navbar(frame)if not getArgs thengetArgs = require('Module:Arguments').getArgsendreturn p._navbar(getArgs(frame))endreturn p
This article uses material from the Wikipedia article Module:Navbar, which is released under the Creative Commons Attribution-ShareAlike 3.0 license ("CC BY-SA 3.0"); additional terms may apply. (view authors). Content is available under CC BY-SA 3.0 unless otherwise noted. Images, videos and audio are available under their respective licenses.
#Wikipedia® is a registered trademark of the Wikimedia Foundation, Inc. Wiki (duhoctrungquoc.vn) is an independent company and has no affiliation with Wikimedia Foundation.
🌐 Wiki languages: 1,000,000+ articlesEnglishРусскийDeutschItalianoPortuguês日本語Français中文العربيةEspañol한국어NederlandsSvenskaPolskiУкраїнськаمصرى粵語DanskفارسیTiếng ViệtไทWinaraySinugboanong Binisaya