Template:Checkbox: Difference between revisions

From Imagisphere
Jump to navigation Jump to search
mNo edit summary
(Fixed broken "Tweak_Generic_Button.png" file link)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<includeonly><div id="{{{id|cb}}}" data-id="checkbox" data-checked="{{{check|yes}}}" data-hideYes="{{{hideYes|}}}" data-hideNo="{{{hideNo|}}}" data-showYes="{{{showYes|}}}" data-showNo="{{{showNo|}}}" class="image-{{{color|black}}}" style="display:inline-flex; cursor: pointer; -webkit-user-select: none; -ms-user-select: none; user-select: none;"><div style="pointer-events: none; display:contents; width:28px; height:14px"><span style="margin-left:-6px; margin-top:-8px">[[File:Tweak_Generic_Button.png|link=|30px]]</span><span id="check-{{{id|cb}}}" style="position:absolute; display: {{#ifeq: {{lc:{{{check|yes}}}}} | yes | ruby | none }}; margin-top:-5px">[[File:Tweak_GenericSetting_Yes.png|link=|18px]]</span><span id="uncheck-{{{id|cb}}}" style="position:absolute; display: {{#ifeq: {{lc:{{{check|yes}}}}} | no | ruby | none }}; margin-top:-5px">[[File:Tweak_GenericSetting_No.png|link=|18px]]</span></div><div style="margin-left: -2px; padding-right: 4px; margin-top:-5px">{{{title|}}}</div></span></div></div></includeonly><noinclude>
<includeonly><div id="{{{id|cb}}}" data-id="checkbox" data-checked="{{{check|yes}}}" data-hideYes="{{{hideYes|}}}" data-hideNo="{{{hideNo|}}}" data-showYes="{{{showYes|}}}" data-showNo="{{{showNo|}}}" class="image-{{{color|black}}}" style="display:inline-flex; cursor: pointer; -webkit-user-select: none; -ms-user-select: none; user-select: none;"><div style="pointer-events: none; display:contents; width:28px; height:14px"><span style="margin-left:-6px; margin-top:-8px">[[File:UI_Generic_Checkbox.png|link=|30px]]</span><span id="check-{{{id|cb}}}" style="position:absolute; display: {{#ifeq: {{lc:{{{check|yes}}}}} | yes | ruby | none }}; margin-top:-5px">[[File:Tweak_GenericSetting_Yes.png|link=|18px]]</span><span id="uncheck-{{{id|cb}}}" style="position:absolute; display: {{#ifeq: {{lc:{{{check|yes}}}}} | no | ruby | none }}; margin-top:-5px">[[File:Tweak_GenericSetting_No.png|link=|18px]]</span></div><div style="margin-left: -2px; padding-right: 4px; margin-top:-5px">{{{title|}}}</div></span></div></div></includeonly><noinclude>
<span style="background:white; padding-top:5px; padding-bottom:6px;">{{checkbox|color=black|check=yes|title=Title1|id=cb1|hideYes=1,2,3,4|hideNo=|showYes=|showNo=}}{{checkbox|color=black|check=no|title=Title2|id=cb2|hideYes=|hideNo=|showYes=|showNo=}}</span>
<span style="background:white; padding-top:5px; padding-bottom:6px;">{{checkbox|color=black|check=yes|title=Title1|id=cb1|hideYes=1,2,3,4|hideNo=|showYes=|showNo=}}{{checkbox|color=black|check=no|title=Title2|id=cb2|hideYes=|hideNo=|showYes=|showNo=}}</span>
<span style="background:black; padding-top:5px; padding-bottom:6px; padding-left:4px;">{{checkbox|color=white|check=yes|title=Title3|id=cb3|hideYes=|hideNo=|showYes=|showNo=}}{{checkbox|color=white|check=no|title=Title4|id=cb4|hideYes=|hideNo=|showYes=|showNo=}}</span>
<span style="background:black; padding-top:5px; padding-bottom:6px; padding-left:4px;">{{checkbox|color=white|check=yes|title=Title3|id=cb3|hideYes=|hideNo=|showYes=|showNo=}}{{checkbox|color=white|check=no|title=Title4|id=cb4|hideYes=|hideNo=|showYes=|showNo=}}</span>
Line 11: Line 11:
</pre>
</pre>


color - Text and checkbox color
color - Optional, text and checkbox color


check - If it's checked by default (yes/no)
check - Optional, if it's checked by default (yes/no)


title - Optional text next to checkbox
title - Optional, text next to checkbox


id - Optional, needed when more than one checkboxes are present. Each needs a unique id.
id - Optional, needed when more than one checkboxes are present. Each needs a unique id.

Latest revision as of 08:34, 22 June 2024

UI Generic Checkbox.pngTweak GenericSetting Yes.png
Title1
UI Generic Checkbox.pngTweak GenericSetting No.png
Title2
UI Generic Checkbox.pngTweak GenericSetting Yes.png
Title3
UI Generic Checkbox.pngTweak GenericSetting No.png
Title4

Checkboxes can be used to hide & show different elements.

Usage

{{checkbox|color=black|check=Yes|title=Title1|id=cb1|hideYes=|hideNo=|showYes=|showNo=}}
{{checkbox|color=black|check=No|title=Title2|id=cb2|hideYes=|hideNo=|showYes=|showNo=}}
{{checkbox|color=white|check=Yes|title=Title3|id=cb3|hideYes=|hideNo=|showYes=|showNo=}}
{{checkbox|color=white|check=No|title=Title4|id=cb4|hideYes=|hideNo=|showYes=|showNo=}}

color - Optional, text and checkbox color

check - Optional, if it's checked by default (yes/no)

title - Optional, text next to checkbox

id - Optional, needed when more than one checkboxes are present. Each needs a unique id.


The following are optional, use a list of classes to show/hide with the respective conditions:

hideYes - hide when checked

hideNo - hide when unchecked

showYes - show when checked

showNo - show when unchecked


This is the syntax for the list of class names of the elements you want to show/hide, each class name needs to be separated by a comma like this:

hideYes=class1,class2,class3

Note: you should put these class names on a separate <span> that goes over your elements, because the checkbox changes the style="display:*" attribute and will overwrite if the span already has an existing display attribute.