VOOZH about

URL: https://minecraft.wiki/w/Template:Simplecalc_ifenabled

⇱ Template:Simplecalc ifenabled – Minecraft Wiki


Template:Simplecalc ifenabled

From Minecraft Wiki
Jump to navigation Jump to search
Documentation[view] [edit] [history] [purge]

This template is borrowed from Wikipedia Template:Calculator ifenabled.

Allows you to detect if the calculator gadget is enabled and provide fallback content for cases where it is not such as when printing. See w:Template:Calculator for details on the simplecalc template system.

{{simplecalc ifenabled|enabled=Lets show a calculator widget {{simplecalc|type=number|size=4}}|disabled=Calculator widgets are not supported}}

Which outputs:

Lets show a calculator widget
Calculator widgets are not supported

If you add the scoped parameter, then calculators inside the enabled branch do not affect other calculators on the page. There is also a refreshonload parameter to force a refresh on first page load instead of first interaction as usual (this only works if scoped is set). For example:

{{simplecalc ifenabled|scoped=true|enabled=Lets show a calculator widget: {{simplecalc|type=number|id=x|size=2}}. The value of X is: {{simplecalc|type=text|readonly=1|formula=x|default=0|size=2}}.}} The X over here ( {{simplecalc|type=text|readonly=1|formula=x|default=0|size=2}} ) does not get updated, as the previous {{tl|simplecalc ifenabled}} is scoped.
Lets show a calculator widget: . The value of X is: 0.
{{{disabled}}}
The X over here ( 0 ) does not get updated, as the previous {{}} is scoped.

Template data

[edit source]

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
enabledenabled 1

Text to show if simplecalc is supported

Example
Some text {{simplecalc|type=text}}
Contentrequired
scopedscoped

Mark the calculators inside the enabled branch as isolated from the rest of the page

Booleanoptional
classclass

Extra css classes for the enabled branch

Stringoptional
refreshonloadrefreshonload

Refresh the calculators on the initial page load before any user interaction (required scoped to be set)

Booleanoptional
disableddisabled 2

Text to show if simplecalc is not enabled (for example during print)

Example
Calculator is not supported
Contentsuggested
class disabledclass disabled

Extra css classes for the disabled branch

Stringoptional
[view] [edit] [history] [purge]The above documentation is transcluded from Template:Simplecalc ifenabled/doc.
Retrieved from "https://minecraft.wiki/w/Template:Simplecalc_ifenabled?oldid=2826869"

Navigation menu