Template:Caption: Difference between revisions

Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
(Updated to Matt's styled box design with more options. (for history, see Template:CommentBox, User:Matt/Sandbox, User:Locke/Sandbox/Template))
(removed ifexist)
Line 1: Line 1:
<onlyinclude>{{#vardefine:CaptionID|{{#if:{{#varexists:CaptionID}}|{{#expr:{{#var:CaptionID}}+1}}|1}}}}
<onlyinclude>{{#vardefine:CaptionID|{{#if:{{#varexists:CaptionID}}|{{#expr:{{#var:CaptionID}}+1}}|1}}}}
{| border=1 style="{{Round|10}} border: 1px solid {{{bordercolor|#000000}}}; background: {{{borderbackground|#5a7eb5}}};"
{| border=1 style="{{Round|10}} border: 1px solid {{{bordercolor|#000000}}}; background: {{{borderbackground|#5a7eb5}}};"
! class="cap{{#var:CaptionID}}col0 _toggler-cap{{#var:CaptionID}}col0 _toggler-cap{{#var:CaptionID}}col1 _toggler-cap{{#var:CaptionID}}col2" title="{{{titleshow|{{{title|}}}}}}" style="{{Round|10}} background: {{{buttonbackgroundshow|{{{buttonbackground|#f2f2f2}}}}}}; {{#ifeq: {{lc:{{{init|show}}}}}|show|display: none;|}}" |{{#ifexist: File:{{{buttonshow|{{{button}}}}}}
! class="cap{{#var:CaptionID}}col0 _toggler-cap{{#var:CaptionID}}col0 _toggler-cap{{#var:CaptionID}}col1 _toggler-cap{{#var:CaptionID}}col2" title="{{{titleshow|{{{title|}}}}}}" style="{{Round|10}} background: {{{buttonbackgroundshow|{{{buttonbackground|#f2f2f2}}}}}}; {{#ifeq: {{lc:{{{init|show}}}}}|show|display: none;|}}" |{{#if: {{{{{{iconshow|{{{icon|{{{buttonshow|{{{button|}}}}}}}}}}}}
   | [[File:{{{buttonshow|{{{button}}}}}}|{{{sizeshow|{{{size|40px}}}}}}|link=]]
   | [[File:{{{buttonshow|{{{button}}}}}}|{{{sizeshow|{{{size|40px}}}}}}|link=]]
   | {{#tag:poem|{{{buttonshow|{{{button}}}}}}}}
   | {{#tag:poem|{{{textshow|{{{text}}}}}}}}
   }}
   }}
! class="cap{{#var:CaptionID}}col1 _toggler-cap{{#var:CaptionID}}col0 _toggler-cap{{#var:CaptionID}}col1 _toggler-cap{{#var:CaptionID}}col2" title="{{{titlehide|{{{title|}}}}}}" style="{{Round|left|10}}; background: {{{buttonbackgroundhide|{{{buttonbackground|#f2f2f2}}}}}}; {{#ifeq: {{lc:{{{init|show}}}}}|hide|display: none;|}}" |{{#ifexist: File:{{{buttonhide|{{{button}}}}}}
! class="cap{{#var:CaptionID}}col1 _toggler-cap{{#var:CaptionID}}col0 _toggler-cap{{#var:CaptionID}}col1 _toggler-cap{{#var:CaptionID}}col2" title="{{{titlehide|{{{title|}}}}}}" style="{{Round|left|10}}; background: {{{buttonbackgroundhide|{{{buttonbackground|#f2f2f2}}}}}}; {{#ifeq: {{lc:{{{init|show}}}}}|hide|display: none;|}}" |{{#if: {{{{{{iconhide|{{{icon|{{{buttonhide|{{{button}}}}}}}}}}}}
   | [[File:{{{buttonhide|{{{button}}}}}}|{{{sizehide|{{{size|40px}}}}}}|link=]]
   | [[File:{{{iconhide|{{{icon|{{{buttonhide|{{{button}}}}}}}}}}}}|{{{sizehide|{{{size|40px}}}}}}|link=]]
   | {{#tag:poem|{{{buttonhide|{{{button}}}}}}}}
   | {{#tag:poem|{{{texthide|{{{text}}}}}}}}
   }}
   }}
| class="cap{{#var:CaptionID}}col2" style="{{Round|right|10}} background: {{{contentbackground|#ffffff}}}; {{#ifeq: {{lc:{{{init|show}}}}}|hide|display: none;|}}" | {{#tag:poem|{{{1}}}}}
| class="cap{{#var:CaptionID}}col2" style="{{Round|right|10}} background: {{{contentbackground|#ffffff}}}; {{#ifeq: {{lc:{{{init|show}}}}}|hide|display: none;|}}" | {{#tag:poem|{{{1}}}}}
Line 17: Line 17:
==Usage==
==Usage==
To use this template, start with this code:
To use this template, start with this code:
{{Usage/Block|anon=content|button|title|size|buttonbackground|contentbackground|bordercolor|borderbackground}}
{{Usage/Block|anon=content|icon|text|title|size|buttonbackground|contentbackground|bordercolor|borderbackground}}
{{Usage/Param|content|The caption itself, which can be hidden by clicking the button.}}
{{Usage/Param|content|The caption itself, which can be hidden by clicking the button.}}
{{Usage/Param|button|Either a filename for an image, or text to display as the 'toggle visibility' button.}}
{{Usage/Param|icon|The name of an image to display as the 'toggle visibility' button. Use this OR "text".}}
{{Usage/Param|text|The text to display as the 'toggle visibility' button. Use this OR "icon".}}
{{Usage/Param|title|Text to appear as a tooltip when hovering over the button.|optional}}
{{Usage/Param|title|Text to appear as a tooltip when hovering over the button.|optional}}
{{Usage/Param|size|If the button is an image, this will define the width of the image.|optional|40px}}
{{Usage/Param|size|If the button is an image, this will define the width of the image.|optional|40px}}
Line 28: Line 29:
{{Clear}}
{{Clear}}


The 'show' button can be defined independently of the 'hide' button by using "buttonhide" and "buttonshow" instead of "button", as with "title", "size", and "buttonbackground":
The 'show' button can be defined independently of the 'hide' button by using "iconhide" and "iconshow" instead of "icon", as with "text", "title", "size", and "buttonbackground":
{{Usage/Block|anon=content|buttonhide|buttonshow|titlehide|titleshow|sizehide|sizeshow|buttonbackgroundhide|buttonbackgroundshow|contentbackground|bordercolor|borderbackground}}
{{Usage/Block|anon=content|iconhide|iconshow|texthide|textshow|titlehide|titleshow|sizehide|sizeshow|buttonbackgroundhide|buttonbackgroundshow|contentbackground|bordercolor|borderbackground}}
{{Usage/Param|buttonhide|Text or filename for the 'hide' button.}}
{{Usage/Param|iconhide|Filename for the 'hide' button.}}
{{Usage/Param|buttonshow|Text or filename for the 'show' button.}}
{{Usage/Param|iconshow|Filename for the 'show' button.}}
{{Usage/Param|texthide|Text for the 'hide' button.}}
{{Usage/Param|textshow|Text for the 'show' button.}}
{{Usage/Param|titlehide|Tooltip for the 'hide' button.|optional}}
{{Usage/Param|titlehide|Tooltip for the 'hide' button.|optional}}
{{Usage/Param|titleshow|Tooltip for the 'show' button.|optional}}
{{Usage/Param|titleshow|Tooltip for the 'show' button.|optional}}