This page, or parts of it, are still untranslated. Please translate it to the appropriate language (русский).
NavboxBuilder — это модуль для создания навбоксов.
Функции[]
- Неограниченное количество строк и секций;
- Возможность сворачивания навбокса или любой его секции;
- Возможность настраивания параметров;
- Документация параметров может быть импортирована из Dev Wiki, включая настроенные названия параметров.
Installation[]
CSS[]
Здесь нужно выполнить две вещи. Во-первых, импортировать стиль, придающий структуру навбоксу. Для этого добавьте следующий код в самую верхнюю часть в Common.css:
@import url("/load.php?mode=articles&articles=u:dev:MediaWiki:Global_Lua_Modules/NavboxBuilder.css&only=styles");
Во-вторых, изменить внешний вид шаблонов. Подробная информация в разделе о дизайне.
Шаблон ===[]
Модуль используется так же, как и обычный шаблон. Нужно создать шаблон (например: Шаблон:Навбокс) со следующим кодом:
<onlyinclude>{{#invoke:NavboxBuilder|create}}</onlyinclude>
== Parameters ==
{{#invoke:NavboxBuilder|documentation}}
Теперь созданный шаблон примет параметры, описанные ниже.
Эти параметры также могут быть переданы прямо вызову #invoke и будут действовать по умолчанию. Их значения будут перекрыты теми, что переданы шаблону.
Исключением являются параметры стиля. В этом случае будут использоваться оба параметра.
Пример выше также включает в себя часть, которая добавит документацию с параметрами на вашу вики.
{{#invoke:NavboxBuilder|documentation}}
Документация будет на языке вашей вики (если перевод существует) и отобразит установленные параметры.
Можно изменить язык документации, уточнив его в дополнительном параметре
{{#invoke:NavboxBuilder|documentation|<lang code>}}
Параметры[]
Below is the list of all available parameters. At least one list is required for the navbox to show up. Apart from that, all other parameters are optional.
Main
Title– main title of the navbox.Links– links that appear on left side of the title bar.- You can put any wikisyntax here.
Titleis required for it to work.
State– should the navbox be collapsed or expanded by default- Values:
collapsedorexpanded(case insensitive) - Empty or unrecognized values will disable collapsing.
Titleis required for it to work
- Values:
AboveandBelow– fields above and below sections and images.Left imageandRight image– fields beside sections, most commonly used to add images.- You can put any content here, not only images.
Sections
Sections include all lists with the same or higher number up to the next section.
Header n– heading of a section- n – any positive integer
- Requires at least one list to be included to show up
State n– should the section be collapsed or expanded by default- n – number of an existing header
- Values:
collapsedorexpanded(case insensitive) - Empty or unrecognized values will disable collapsing.
Header state– same as above, but affects all headers- Values:
collapsedorexpanded(case insensitive) - Empty or unrecognized values will disable collapsing.
- Can be overridden by
State n
- Values:
Layout n– selects layout for that section- n – any positive integer
- Can be used without
Header nto create a separate section without a header - Values:
tableorhorizontal(case insensitive) - Empty or unrecognized values will use default (
table).
Table layout (table)
Standard layout with lists and sublists.
Left image nandRight image n– fields beside sections lists in that section, most commonly used to add images.- n – number of an existing header
- You can put any content here, not only images.
Horizontal layout (horizontal)
Horizontal layout with lists forming columns. Sublists are not supported and will be treated as regular lists.
Per row n– maximum number of lists per row.- n – number of an existing section.
- Value: any number above 1.
- Number of columns is still limited by space needed. You can't go higher than flexbox allows.
Span n– how many columns should the list span.- n – number of an existing list.
- Value: any number between 0 and corresponding
Per row n
Lists
List n– single row with a list of links- n – any positive integer
Group n– heading of a list- n – number of an existing list or sublist
Sublists will appear as sub entries of the group with same n.
List n.m– single row with a list of links- n and m – any positive integers
Group n.m– heading of a sublist- n and m – numbers of an existing sublist
Styling
Navbox classandNavbox style– applied to the main navbox elementTitle classandTitle style– applied to the title barBase classandBase style– applied to all groups, subgroups, headers, above and below fieldsAbove classandAbove style– applied to the above fieldBelow classandBelow style– applied to the below fieldImage classandImage style– applied to all image fieldsLeft image classandLeft image style– applied to the main left image fieldRight image classandRight image style– applied to the main right image fieldHeader classandHeader style– applied to all headersHeader n classandHeader n style– applied to the header specified with nLeft image n classandLeft image n style– applied to the left image field in the section specified with nRight image n classandRight image n style– applied to the right image field in the section specified with nGroup classandGroup style– applied to all groupsSubgroup classandSubgroup style– applied to all subgroupsGroup n classandGroup n style– applied to the group specified with nGroup n.m classandGroup n.m style– applied to the subgroup specified with n and mList classandList style– applied to all listsList n classandList n style– applied to the list specified with nList n.m classandList n.m style– applied to the list specified with n and m
Установка параметров[]
Импортируя модуль, скопируйте это и вставьте свои параметры:
return require('Dev:NavboxBuilder').changeParameters{
-- Settings
links = 'Links',
state = 'State',
-- Fields
title = 'Title',
above = 'Above',
below = 'Below',
limage = 'Left image',
rimage = 'Right image',
-- Sections
header_n = 'Header #',
layout_n = 'Layout #',
state_n = 'State #',
header_state = 'Header state',
-- Table layout
limage_n = 'Left image #',
rimage_n = 'Right image #',
-- Horizontal layout
perrow_n = 'Per row #',
span_n = 'Span #',
-- Groups
group_n = 'Group #',
group_n_m = 'Group #.#',
list_n = 'List #',
list_n_m = 'List #.#',
-- CSS
navbox_class = 'Navbox class',
navbox_style = 'Navbox style',
title_class = 'Title class',
title_style = 'Title style',
base_class = 'Base class',
base_style = 'Base style',
above_class = 'Above class',
above_style = 'Above style',
below_class = 'Below class',
below_style = 'Below style',
image_class = 'Image class',
image_style = 'Image style',
limage_class = 'Left image class',
limage_style = 'Left image style',
rimage_class = 'Right image class',
rimage_style = 'Right image style',
header_class = 'Header class',
header_style = 'Header style',
header_n_class = 'Header # class',
header_n_style = 'Header # style',
limage_n_class = 'Left image # class',
limage_n_style = 'Left image # style',
rimage_n_class = 'Right image # class',
rimage_n_style = 'Right image # style',
group_class = 'Group class',
group_style = 'Group style',
subgroup_class = 'Subgroup class',
subgroup_style = 'Subgroup style',
group_n_class = 'Group # class',
group_n_style = 'Group # style',
group_n_m_class = 'Group #.# class',
group_n_m_style = 'Group #.# style',
list_class = 'List class',
list_style = 'List style',
list_n_class = 'List # class',
list_n_style = 'List # style',
list_n_m_class = 'List #.# class',
list_n_m_style = 'List #.# style',
-- Values
value_expanded = 'expanded',
value_collapsed = 'collapsed',
value_table_layout = 'table',
value_horizontal_layout = 'horizontal',
}
Examples[]
Ниже находятся несколько примеров, демонстрирующих то, на что способен этот модуль и как этого добиться.
Примечание: образцы используют {{NavboxBuilder}} для стиля.
Заголовок и несколько строк[]
{{Navbox
| Title = Lorem ipsum
| Group 1 = Dolor
| List 1 = Consectetur · adipiscing · elit
| Group 2 = Sit
| List 2 = Sed · commodo · quam · sed · orci · varius · bibendum
}}
Сворачиваемый навбокс[]
{{Navbox
| Title = Lorem ipsum
| State = collapsed
...
}}
Ссылки шаблонов[]
{{Navbox
| Title = Lorem ipsum
| Links = [[Template:NavboxBuilder|v]] · [[Template talk:NavboxBuilder|d]]
...
}}
Название и группы необязательны[]
{{Navbox
| Group 1 = Dolor
| List 1 = Consectetur · adipiscing · elit
| List 2 = Sed · commodo · quam · sed · orci · varius · bibendum
}}
Верхнее и нижнее поля[]
{{Navbox
...
| Above = In pellentesque sapien justo
| Below = Vel accumsan justo pulvinar non
...
}}
Разделы[]
{{Navbox
...
| Group 1 = Dolor
| List 1 = Consectetur · adipiscing · elit
| Header 2 = Mauris scelerisque
| Group 2 = Sit
| List 2 = Sed · commodo · quam · sed · orci · varius · bibendum
| Header 10 = Duis ornare aliquet
| Group 11 = Curabitur sem ex
| List 11 = faucibus · eu maximus · sit · amet
| Group 12 = Vestibulum
| List 12 = Cras · laoreet · ex · at · efficitur · auctor
}}
Сворачиваемые разделы ===[]
{{Navbox
...
| Header 1 = Mauris scelerisque
| State 1 = expanded
| Group 1 = Sit
| List 1 = Sed · commodo · quam · sed · orci · varius · bibendum
| Header 2 = Duis ornare aliquet
| State 2 = collapsed
| Group 2 = Curabitur sem ex
| List 2 = faucibus · eu maximus · sit · amet
| Group 3 = Vestibulum
| List 3 = Cras · laoreet · ex · at · efficitur · auctor
}}
Изображения[]
{{Navbox
...
| Left image = [[File:Example.jpg|x166px]]
...
| Header 2 = Mauris scelerisque
| Right image 2 = [[File:Example.jpg|x25px]]
...
| Header 10 = Duis ornare aliquet
| Right image 10 = [[File:Example.jpg|x53px]]
...
}}
Подгруппы[]
{{Navbox
| Title = Lorem ipsum
| Group 1 = Dolor
| Group 1.1 = Sit
| List 1.1 = Consectetur · adipiscing · elit
| Group 1.2 = Amet
| List 1.2 = Sed · commodo · quam · sed · orci · varius · bibendum
| Group 2 = Quisque
| List 2.1 = Mauris · facilisis · condimentum · pretium
| List 2.2 = Proin · dictum · dui · felis
}}
Horizontal layout[]
{{Navbox
...
| Group 1 = Dolor
| List 1 = Consectetur · adipiscing · elit
| Header 2 = Mauris scelerisque
| Layout 2 = horizontal
| Group 2 = Sit
| List 2 = Sed · commodo · quam · sed · orci · varius · bibendum
| Header 10 = Duis ornare aliquet
| Layout 10 = horizontal
| Group 11 = Curabitur sem ex
| List 11 = faucibus<br />eu maximus<br />sit<br />amet
| Group 12 = Vestibulum
| List 12 = Cras<br />laoreet<br />ex<br />at<br />efficitur<br />auctor
}}
[]
{{Navbox
...
| Title class = neutral
| Group style = color: red;
| List style = color: blue;
| List 12 style = color: green;
}}
Общий пример[]
{{Navbox
| Title = Lorem ipsum
| State = collapsed
| Links = [[Template:NavboxBuilder|v]] · [[Template talk:NavboxBuilder|d]]
| Above = Cras laoreet, ex at efficitur auctor
| Below = Nunc vel condimentum tellus
| Group 1 = Dolor
| List 1 = Consectetur · adipiscing · elit
| Group 2 = Sit
| List 2 = Sed · commodo · quam · sed · orci · varius · bibendum
| Header 10 = Bibendum
| State 10 = expanded
| Right image 10 = [[File:Example.jpg|x43px]]
| Group 10 = Curabitur
| Group 10.1 = Dolor
| List 10.1 = Consectetur · adipiscing · elit
| Group 10.2 = Sit
| List 10.2 = Sed · commodo · quam · sed · orci · varius · bibendum
| Header 20 = Aenean est lectus
| State 20 = collapsed
| List 20 = Vestibulum · ante · ipsum · primis in faucibus · orci · luctus · et ultrices · posuere · cubilia · Curae
| Group style = width: 75px
| Base style = color: navy
}}
Дополнительные настройки[]
Эти настройки влияют на то, как импортируется модуль:
local NBB = require('Dev:NavboxBuilder')
Здесь расположены ваши настройки
return NBB
N и M[]
Если вам хочется изменить N и M в документации, это делается таким способом:
NBB.n = "ваша замена букве N"
NBB.m = "ваша замена букве M"
Note: Шаблоны и функции парсера не будут работать. Только HTML-синтаксис, например, курсив и теги.
Horizontal and vertical lists[]
Depending on the layout, there will be a different class used for layouts with horizontal and vertical lists. By default, it's hlist and vlist respectively. You can set your own classes with:
NBB.hlist = "class for horizontal lists"
NBB.vlist = "class for vertical lists"
Or disable by setting to nil:
NBB.hlist = nil
NBB.vlist = nil
Дизайн[]
Если вам хочется оформить навбокс, у вас есть несколько способов. Во-первых, можно использовать параметры, желательно с их передачей вызову #invoke в качестве параметров по умолчанию. Существует также несколько классов, взятых из темы вики, таких как color1 и accent. По умолчанию ими можно оформить навбокс следующим образом:
With as little as this in your navbox template:
{{#invoke:NavboxBuilder|create
| Navbox class = toc
| Title class = color1
| Base class = accent
| List class = color2
}}
Другой способ изменения стиля — это использование Common.css или Wikia.css. Ниже — инструкция по классам.
- Основной элемент навбокса
.navbox.mw-collapsible– если сворачивается.mw-collapsed– если свёрнут
- Название
.navbox-title.mw-collapsible-toggle– если навбокс сворачивается.mw-collapsible-toggle-expanded– если навбокс открыт.mw-collapsible-toggle-collapsed– если навбокс свёрнут
- Above and below
.navbox-aboveand.navbox-below
- Левое и правое изображения (и основные, и в секциях)
.navbox-image
- Заголовок разделов
.navbox-header.mw-collapsible-toggle– если раздел сворачивается.mw-collapsible-toggle-expanded– если раздел открыт.mw-collapsible-toggle-collapsed– если раздел свёрнут
- Строки
.navbox-odd– для строк с нечётными номерами.navbox-even– для строк с чётными номерами
- Группы
.navbox-group
- Подгруппы
.navbox-subgroup
- Списки
.navbox-list.navbox-nogroup– если строки расположены вне группы
- Дополнительные классы
.navbox-padding– оформление отступов между элементами. Применяется ко всем спискам, группам, подгруппам и верхним/нижним полям. Но не к заголовкам и названию..navbox-base– выделяет заголовки. Применяется ко всем группам, подгруппам, заголовкам и верхним/нижним полям.
Пространство[]
Если вам хочется изменить пространство между строками, то нужно изменить следующее:
.navbox-table-wrapper,
.navbox-table-layout {
margin-left: -3px;
margin-right: -3px;
margin-bottom: -3px;
}
.navbox-table-wrapper:first-child,
.navbox-section-wrapper:first-child {
margin-top: -3px;
}
.navbox-table {
border-spacing: 3px;
}
.navbox-section {
margin: 3px 0;
}
.navbox-horizontal-layout {
margin-right: -3px;
}
.navbox-col {
margin-top: 3px;
}
.navbox-col .navbox-group {
margin-bottom: 3px;
margin-right: 3px;
}
.navbox-col .navbox-list {
margin-right: 3px;
}

