Template:Spoiler: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
(recode; had an error, and it looks broken when done in all white)
(update doc to match code change)
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<span class="spoiler" title="Highlight/select the spoiler material to see it.">{{#if:{{{2|}}}|{{{2}}}|Spoiler}}: <span style="color:{{{color|#EEEEEE}}}; background:{{{color|#EEEEEE}}};">{{{1|{{{content|<noinclude>Sample text here.</noinclude>}}}}}}</span></span><noinclude>
<span class="spoiler" title="Highlight/select the spoiler material to see it."><span style="font-variant: small-caps; color: #777777;">{{#if:{{{2|}}}|{{{2}}}|spoiler}}:</span> <span style="color:{{{color|#EEEEEE}}}; background:{{{color|#EEEEEE}}};">{{{1|{{{content|<noinclude>Sample text here.</noinclude>}}}}}}</span></span><noinclude>


== Documentation ==
== Documentation ==
This "hides" spoiler material by making it white like the page background, so that one must highlight it to read it.
This "hides" spoiler material by making the same color as the background, so that one must highlight it to read it. (The background and text are made a light grey, since doing it as white, to match the whole-page background, made it look like some kind of error.)


'''Usage:'''
'''Usage:'''
Line 10: Line 10:
The <code>1=</code> (which can also be given as <code>content=</code>) is optional, but safest to include, since the template will break if the content include a <code>=</code> character anywhere in it.
The <code>1=</code> (which can also be given as <code>content=</code>) is optional, but safest to include, since the template will break if the content include a <code>=</code> character anywhere in it.


You can change "Spoiler" wording (which gives a note when you over over it) to something else:
You can change the <span style="font-variant: small-caps; color: #777777;">spoiler</span> wording (which gives a note when you over over it) to something else:


<code><nowiki>{{spoiler|1=The text to hide here. |Major spoiler}}</nowiki></code>
<code><nowiki>{{spoiler|1=The text to hide here. |major spoiler}}</nowiki></code>


If different colors are wanted (e.g. inside a colorful sidebar), you can specify a hex color ({{em|with}} the <code>#</code> prefix) or a named CSS color, for the text and its background:
If different colors are wanted (e.g. inside a colorful sidebar), you can specify a hex color ({{em|with}} the <code>#</code> prefix) or a named CSS color, for the text and its background:


<code><nowiki>{{spoiler|1=The text to hide here. |Major spoiler |color=#A9C633}}</nowiki></code>
<code><nowiki>{{spoiler|1=The text to hide here. |major spoiler |color=#A9C633}}</nowiki></code>
 
=== Adding links ===
Because the site-wide CSS will style links (internal or external) with color, they will not be hidden by this template. The solution is to replace:
: <code><nowiki>[http:</nowiki><var>//site.tld/path/</var><nowiki> ...]</nowiki></code>
with
: <code><nowiki>... [http:</nowiki><var>//site.tld/path/</var><nowiki>]</nowiki></code>
 
 
and
: <code><nowiki>[[</nowiki><var>Pagename</var><nowiki>|...]]</nowiki></code>
with
: <code><nowiki>... [https://wiki.openmw.org/index.php?title=</nowiki><var>Pagname</var><nowiki>]]</nowiki></code>


[[Category:Templates]]
[[Category:Templates]]
</noinclude>
</noinclude>

Latest revision as of 16:24, 16 August 2017

spoiler: Sample text here.

Documentation

This "hides" spoiler material by making the same color as the background, so that one must highlight it to read it. (The background and text are made a light grey, since doing it as white, to match the whole-page background, made it look like some kind of error.)

Usage:

{{spoiler|1=The text to hide here}}

The 1= (which can also be given as content=) is optional, but safest to include, since the template will break if the content include a = character anywhere in it.

You can change the spoiler wording (which gives a note when you over over it) to something else:

{{spoiler|1=The text to hide here. |major spoiler}}

If different colors are wanted (e.g. inside a colorful sidebar), you can specify a hex color (with the # prefix) or a named CSS color, for the text and its background:

{{spoiler|1=The text to hide here. |major spoiler |color=#A9C633}}

Adding links

Because the site-wide CSS will style links (internal or external) with color, they will not be hidden by this template. The solution is to replace:

[http://site.tld/path/ ...]

with

... [http://site.tld/path/]


and

[[Pagename|...]]

with

... [https://wiki.openmw.org/index.php?title=Pagname]]