Fandom Developers Wiki

NavboxBuilder to moduł ułatwiający tworzenie navboksów.

Funkcje[]

  • Nieograniczona liczba wierszy i sekcji.
  • Zwijanie navboxa i sekcji.
  • Możliwość dostosowania parametrów.
  • Dokumentacja parametrów przechowywana na Dev Wiki i dopasowana do dostosowanych parametrów.

Installation[]

CSS[]

Tutaj są dwie rzeczy do zrobienia. Pierwszą jest import arkusza, który nadaje navboksowi strukturę. Żeby to zrobić wystarczy dodać to na samej górze Common.css społeczności.

@import url("/load.php?mode=articles&articles=u:dev:MediaWiki:Global_Lua_Modules/NavboxBuilder.css&only=styles");

Drugą sprawą jest dostosowanie wyglądu. Więcej informacji na ten temat znajdziesz w sekcji Wygląd poniżej.

Szablon ===[]

Moduł jest zbudowany tak, żeby był stosowany jak zwyczajny szablon. W tym celu utwórz szablon (np: Szablon:Navbox) z taką zawartością:

<onlyinclude>{{#invoke:NavboxBuilder|create}}</onlyinclude>

== Parameters ==
{{#invoke:NavboxBuilder|documentation}}

Teraz szablon będzie przyjmował parametry udokumentowane poniżej.

Podane parametry mogą również zostać podane bezpośrednio do #invoke i będą stanowić wartości domyślne. Będą mogły zostać nadpisane przez podanie ich do szablonu.

Parametry stylów stanowią wyjątek. Wartości z obu zostaną połączone.

Powyższy szablon zawiera również kod, który wstawi dokumentację parametrów.

{{#invoke:NavboxBuilder|documentation}}

Dokumentacja wyświetli się w języku wiki (jeśli tłumaczenie istnieje) oraz dopasuje się do dostosowanych parametrów.

Możesz zmienić język dokumentacji poprzez podanie dodatkowego parametru.

{{#invoke:NavboxBuilder|documentation|<lang code>}}

Parametry[]

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.
    • Title is required for it to work.
  • State – should the navbox be collapsed or expanded by default
    • Values: collapsed or expanded (case insensitive)
    • Empty or unrecognized values will disable collapsing.
    • Title is required for it to work
  • Above and Below – fields above and below sections and images.
  • Left image and Right 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: collapsed or expanded (case insensitive)
    • Empty or unrecognized values will disable collapsing.
  • Header state – same as above, but affects all headers
    • Values: collapsed or expanded (case insensitive)
    • Empty or unrecognized values will disable collapsing.
    • Can be overridden by State n
  • Layout n – selects layout for that section
    • n – any positive integer
    • Can be used without Header n to create a separate section without a header
    • Values: table or horizontal (case insensitive)
    • Empty or unrecognized values will use default (table).

Table layout (table)

Standard layout with lists and sublists.

  • Left image n and Right 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 class and Navbox style – applied to the main navbox element
  • Title class and Title style – applied to the title bar
  • Base class and Base style – applied to all groups, subgroups, headers, above and below fields
  • Above class and Above style – applied to the above field
  • Below class and Below style – applied to the below field
  • Image class and Image style – applied to all image fields
  • Left image class and Left image style – applied to the main left image field
  • Right image class and Right image style – applied to the main right image field
  • Header class and Header style – applied to all headers
  • Header n class and Header n style – applied to the header specified with n
  • Left image n class and Left image n style – applied to the left image field in the section specified with n
  • Right image n class and Right image n style – applied to the right image field in the section specified with n
  • Group class and Group style – applied to all groups
  • Subgroup class and Subgroup style – applied to all subgroups
  • Group n class and Group n style – applied to the group specified with n
  • Group n.m class and Group n.m style – applied to the subgroup specified with n and m
  • List class and List style – applied to all lists
  • List n class and List n style – applied to the list specified with n
  • List n.m class and List n.m style – applied to the list specified with n and m

Własne parametry[]

Przy importowaniu modułu wystarczy, że skopiujesz i wypełnisz to:

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[]

Poniżej znajdziesz kilka przykładów pokazujących co oraz jak można osiągnąć.

Uwaga: poniższe szablony używają szablonu {{NavboxBuilder}} do uzyskania wyglądu.

Tytuł i kilka wierszy[]

{{Navbox
| Title = Lorem ipsum

| Group 1 = Dolor
| List 1 = Consectetur · adipiscing · elit

| Group 2 = Sit
| List 2 = Sed · commodo · quam · sed · orci · varius · bibendum
}}

Zwijany navboks[]

{{Navbox
| Title = Lorem ipsum
| State = collapsed
...
}}

Linki do szablonu[]

{{Navbox
| Title = Lorem ipsum
| Links = [[Template:NavboxBuilder|v]] · [[Template talk:NavboxBuilder|d]]
...
}}

Tytuł i grupy nie są wymagane[]

{{Navbox
| Group 1 = Dolor
| List 1 = Consectetur · adipiscing · elit

| List 2 = Sed · commodo · quam · sed · orci · varius · bibendum
}}

Pola góra i dół[]

{{Navbox
...
| Above = In pellentesque sapien justo
| Below = Vel accumsan justo pulvinar non
...
}}

Sekcje[]

{{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 }}

Zwijane sekcje[]

{{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 }}

Obrazy[]

{{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]]
...
}}

Podgrupy[]

{{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
}}

Układ poziomy[]

{{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 }}

Stylowanie[]

{{Navbox
...
| Title class = neutral
| Group style = color: red;
| List style = color: blue;
| List 12 style = color: green;
}}

Trochę wszystkiego[]

{{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
}}

Dodatkowe opcje[]

Te opcje wymagają zmiany sposobu w jaki jest moduł jest importowany na:

local NBB = require('Dev:NavboxBuilder')

Tutaj dodaj opcje

return NBB

N-ki i M-ki[]

Jeśli chcesz zmienić w jaki sposób są one wyświetlane w dokumentacji, zmień wartość tych zmiennych:

NBB.n = "zamiennik N"
NBB.m = "zamiennik M"

Uwaga: Tylko podstawowa składnia jak kursywa oraz tagi html.

Poziome i pionowe listy[]

Zależnie od układu zostaną zastosowane dwie różne klasy dla układów z listami pionowymi i poziomymi. Domyślnie są to odpowiednio hlist i vlist. Możesz dostosować klasy za pomocą:

NBB.hlist = "class for horizontal lists"
NBB.vlist = "class for vertical lists"

Or disable by setting to nil:

NBB.hlist = nil
NBB.vlist = nil

Wygląd[]

Jeśli chcesz dostosować wygląd swojego navboksa masz kilka opcji. Jedną z nich jest użycie parametrów, najlepiej przez podanie ich do #invoke jako wartości domyślnych. Jest kilka klas, które dopasowują się do motywu wiki, które świetnie się tutaj nadają, jak color1 czy accent. Wygląd taki jak ten:

Można osiągnąć za pomocą tylko czegość takiego:

{{#invoke:NavboxBuilder|create
| Navbox class = toc
| Title class = color1
| Base class = accent
| List class = color2
}}

Inną opcją jest dodanie styli do Common.css na wikii. Poniżej znajduje się lista klas:

    • .navbox
    • .mw-collapsible – kiedy navboks jest zwijany
    • .mw-collapsed – kiedy navboks jest zwinięty
  • Pasek tytułu
    • .navbox-title
    • .mw-collapsible-toggle – kiedy navboks jest zwijany
    • .mw-collapsible-toggle-expanded – kiedy navboks jest rozwinięty
    • .mw-collapsible-toggle-collapsed – kiedy navboks jest zwinięty
  • Above and below
    • .navbox-above and .navbox-below
  • Lewy i prawy obraz (zarówno główne jak i te w sekcjach)
    • .navbox-image
  • Nagłówek sekcji
    • .navbox-header
    • .mw-collapsible-toggle – kiedy sekcja jest zwijana
    • .mw-collapsible-toggle-expanded – kiedy sekcja jest rozwinięta
    • .mw-collapsible-toggle-collapsed – kiedy sekcja jest zwinięta
  • Wiersze
    • .navbox-odd – nieparzyste wierze
    • .navbox-even – parzyste wiersze
  • Grupy
    • .navbox-group
  • Podgrupy
    • .navbox-subgroup
  • Listy
    • .navbox-list
    • .navbox-nogroup – when there's no group for this row
  • Wspólne klasy
    • .navbox-padding – sposób na dostosowanie marginesu wewnętrznego komórek. Stosowana we wszystkich listach, grupach, podgrupach oraz polach powyżej i poniżej zawartości, ale nie w nagłówkach i pasku tytułu.
    • .navbox-base – sposób na wyróżnienie nagłówków. Stosowana we wszystkich grupach, podgrupach, nagłówkach sekcji oraz polach powyżej i poniżej zawartości.

Odstępy[]

Jeśli chcesz zmienić odległość między komórkami, skopiuj to swojego arkusza i dostosuj:

.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;
}