Template:Mbox: Difference between revisions
m (Changed it to show/hide) |
(doc: added protection notice) |
||
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
{{Documentation/sandbox|doc = | {{Documentation/sandbox|doc = | ||
{{Protection}} | |||
This template is used to create a collapsible {{ll|PZwiki:Mboxes|mbox}}. | This template is used to create a collapsible {{ll|PZwiki:Mboxes|mbox}}. | ||
Line 8: | Line 9: | ||
==Usage== | ==Usage== | ||
Do not use this template directly, | Do not use this template directly, use one of the types listed in {{ll|PZwiki:Mboxes}} instead. | ||
===Syntax=== | |||
<pre> | |||
{{Mbox | |||
| background = | |||
| color = | |||
| sign = | |||
| title = | |||
| content = | |||
| note = | |||
| cat = | |||
| id = | |||
| collapsed = | |||
}} | |||
</pre> | |||
===Parameters=== | ===Parameters=== | ||
;<code>background</code> | ;<code>background</code> | ||
:Background color. Default | :Background color. Default to <code>#f8f9fa</code>. | ||
;<code>color</code> | ;<code>color</code> | ||
:Left bar color. Default | :Left bar color. Default to <code>#eaecf0</code>. | ||
;<code>sign</code> | ;<code>sign</code> | ||
:Mbox image. Default | :Mbox image. Default to <code><nowiki>[[File:Imbox content.png|link=]]</nowiki></code>. | ||
;<code>title</code> | ;<code>title</code> | ||
:Mbox title. Displayed in bold and large font. | :Mbox title. Displayed in bold and large font. | ||
Line 26: | Line 42: | ||
:Category name, omit <code>Category:</code> prefix. | :Category name, omit <code>Category:</code> prefix. | ||
;<code>id</code> | ;<code>id</code> | ||
:Id for each Mbox to collapse the content. Should be unique. Recommended to use | :Id for each Mbox to collapse the content. Should be unique. Recommended to use the template name. The mbox will not be collapsible if not specified. | ||
;<code>collapsed</code> | ;<code>collapsed</code> | ||
:Initial state of the content. Will be collapsed if | :Initial state of the content. Will be collapsed if set to <code>true</code>. Only works when <code>id</code> is specified. | ||
==Example== | ==Example== | ||
<pre> | <pre> | ||
{{Mbox | {{Mbox | ||
| title = This is an Mbox. | | title = This is an Mbox. | ||
| content = This is content of the Mbox. | | content = This is content of the Mbox. | ||
| note = This is a note of the Mbox. | | note = This is a note of the Mbox. | ||
| id = | | id = example | ||
| collapsed = true | | collapsed = true | ||
}} | }} | ||
</pre> | </pre> | ||
{{Mbox | {{Mbox | ||
| title = This is an Mbox. | | title = This is an Mbox. | ||
| content = This is content of the Mbox. | | content = This is content of the Mbox. | ||
| note = This is a note of the Mbox. | | note = This is a note of the Mbox. | ||
| id = | | id = example | ||
| collapsed = true | | collapsed = true | ||
}} | }} | ||
Line 58: | Line 68: | ||
==See also== | ==See also== | ||
*{{ll|PZwiki:Mboxes}} | *{{ll|PZwiki:Mboxes}} | ||
*[https://oxygennotincluded.fandom.com/zh/wiki/Template:%E9%80%9A%E7%9F%A5%E6%A1%86 Mbox on Chinese Oxygen Not Included Wiki] | |||
==Attribution== | |||
*[https://oxygennotincluded.fandom.com/zh/wiki/Template:%E9%80%9A%E7%9F%A5%E6%A1%86 Mbox on Chinese Oxygen Not Included Wiki] | |||
}} | }} | ||
{{ll|Category:Metatemplates}} | {{ll|Category:Metatemplates}} | ||
{{ll|Category:Mbox | {{ll|Category:Mbox}} | ||
</noinclude><includeonly><div class="mbox" {{#if:{{{background|}}}|style="background-color: {{{background}}};"}}> | </noinclude><includeonly><div class="mbox" {{#if:{{{background|}}}|style="background-color: {{{background}}};"}}> | ||
<div {{#if:{{{color|}}}|style="background-color: {{{color}}};"}}></div> | <div {{#if:{{{color|}}}|style="background-color: {{{color}}};"}}></div> | ||
<div {{#if:{{{id|}}} | <div {{#if:{{{id|}}} | ||
| class="mw-collapsible {{ | | class="mw-collapsible {{yesno|{{{collapsed|}}}|yes=mw-collapsed|def=[[Category:Incorrect template usage]]}}" id="mw-customcollapsible-mbox-{{{id}}}" | ||
}}>{{#if:{{{sign|}}}|{{{sign}}}|[[File:Imbox content.png|link=]]}}</div> | }}>{{#if:{{{sign|}}}|{{{sign}}}|[[File:Imbox content.png|link=]]}}</div> | ||
{{#if:{{{id|}}} | {{#if:{{{id|}}} | ||
| <div class=" | | <div class="toggle mw-customtoggle-mbox-{{{id}}}" title="{{int:show}}/{{int:hide}}"></div> | ||
}} | }} | ||
<div> | <div> | ||
{{#if:{{{title|}}} | {{#if:{{{title|}}} | ||
| <div style="font-size: 120%; font-weight: bold;">{{{title}}}</div> | | <div style="font-size: 120%; font-weight: bold; padding-right: 1em;">{{{title}}}</div> | ||
}} | }} | ||
<div {{#if:{{{id|}}} | <div {{#if:{{{id|}}} | ||
| class="mw-collapsible {{ | | class="mw-collapsible {{yesno|{{{collapsed|}}}|yes=mw-collapsed|def=}}" id="mw-customcollapsible-mbox-{{{id}}}" | ||
}}>{{#if:{{{content|}}}|{{{content}}}}}</div> | }}>{{#if:{{{content|}}}|{{{content}}}}}</div> | ||
{{#if: {{{note|}}} | {{#if: {{{note|}}} | ||
| <div {{#if:{{{id|}}} | | <div {{#if:{{{id|}}} | ||
| class="mw-collapsible {{ | | class="mw-collapsible {{yesno|{{{collapsed|}}}|yes=mw-collapsed|def=}}" id="mw-customcollapsible-mbox-{{{id}}}" | ||
}} style="font-size: 80%; font-style: italic;">{{{note}}}</div> | }} style="font-size: 80%; font-style: italic;">{{{note}}}</div> | ||
}} | }} | ||
</div> | </div> | ||
</div>{{#if:{{{cat|}}}|[[Category:{{{cat}}}]]}}</includeonly> | </div>{{#if:{{{cat|}}}|[[Category:{{{cat}}}]]}}</includeonly> |
Revision as of 02:07, 10 February 2024
This template is used to create a collapsible mbox.
This is a collapsible element. You can toggle it by clicking the "◥" sign on the top-right corner.
When collapsed, the image, content and note will be hidden, only the title will be displayed.
Usage
Do not use this template directly, use one of the types listed in PZwiki:Mboxes instead.
Syntax
{{Mbox | background = | color = | sign = | title = | content = | note = | cat = | id = | collapsed = }}
Parameters
background
- Background color. Default to
#f8f9fa
. color
- Left bar color. Default to
#eaecf0
. sign
- Mbox image. Default to
[[File:Imbox content.png|link=]]
. title
- Mbox title. Displayed in bold and large font.
content
- Normal text.
note
- Bottom text. Displayed in italic and small font.
cat
- Category name, omit
Category:
prefix. id
- Id for each Mbox to collapse the content. Should be unique. Recommended to use the template name. The mbox will not be collapsible if not specified.
collapsed
- Initial state of the content. Will be collapsed if set to
true
. Only works whenid
is specified.
Example
{{Mbox | title = This is an Mbox. | content = This is content of the Mbox. | note = This is a note of the Mbox. | id = example | collapsed = true }}
How to translate
This template doesn't need to/shouldn't be translated, but you can translate the documentation of this template with the following steps:
- Create a subpage of this template with the language code of the language you want to translate to.
- Copy the code wrapped in the
<noinclude>
tag in this template into the page you created.{{Translation guide}}
template should be removed from the translated documentation.
- Translate the page according to the translation requirements of normal pages.