Spoiler text walkthroughs!
Site Updates forum
Posted on Feb. 7, 2015, 6:10 p.m. by Epochalyptik
This is a relatively minor update, but the content will be useful to those of you working on long deck descriptions or bios. Credit goes to Femme_Fatale, ChiefBell, and hyperlocke for popularizing these methods around the site.
The formatting page now contains walkthroughs for creating spoiler text. The walkthroughs are also provided below for your convenience.
You can use spoiler text to hide large amounts of text until the reader is ready to view it. This technique is perfect for long deck descriptions!
- Text in orange indicates any text that will be visible when the code is implemented. You may customize this text. If this text is the summary or content, it must be contained within <p> and </p> tags. You may add additional paragraphs of text by beginning a new set of <p> and </p> tags.
- Text in light green indicates code that corresponds to the text that must be clicked to reveal the spoiler text. You must change this text for each time you implement the code, and each instance of this text within an implementation of code must be the same. This text must not be the same as the text in yellow.
- Text in yellow indicates code that corresponds to the text that must be clicked to hide the spoiler text. You must change this text for each time you implement the code, and each instance of this text within an implementation of code must be the same. This text may not be the same as the text in light green.
Method 1:
This method is more complicated, but it works on all major browsers.
To use, copy and paste the following code verbatim.
<a id="show_id1" onclick="document.getElementById('spoiler_id1').style.display=''; document.getElementById('show_id1').style.display='none';">
<b>SHOW</b></a>
<div id="spoiler_id1" style="display: none">
<a onclick="document.getElementById('spoiler_id1').style.display='none'; document.getElementById('show_id1').style.display='';">
<b>HIDE</b></a>
<br /><br />
<p>Content goes here. The content will be hidden until the "SHOW" text is clicked.</p>
<br />
</div>
Sample:
SHOW
Method 2:
This code is like Method 1's code, but it produces buttons instead of link text.
To use, copy and paste the following code verbatim.
<button id="but.1" onclick="document.getElementById('div.1').style.display=''; document.getElementById('but.1').style.display='none';">
Show
</button>
<div id="div.1" style="display: none">
<button onclick="document.getElementById('div.1').style.display='none'; document.getElementById('but.1').style.display='';">
Hide
</button>
<br />
<p>Content goes here. The content will be hidden until the "Show" button is clicked.</p>
</div>
Sample:
Method 3:
This method is simpler, but it works on fewer browsers. Firefox and Internet Explorer don't support this method, so users viewing the site with either browser will see broken formatting and all of the text that is supposed to be hidden.
To use, copy and paste the following code verbatim.
<details>
<summary>
Summary goes here. The summary text will be displayed and may be clicked to reveal the spoiler text
</summary>
<p>Content goes here. The content will be hidden until the summary text is clicked.</p>
</details>
Sample (remember, this code is unsupported in Firefox and IE): Content goes here. The content will be hidden until the summary text is clicked.Summary goes here. The summary text will be displayed and may be clicked to reveal the spoiler text
Go forth and improve your deck descriptions, profile pages, and more! Just try not to use this code unless it's necessary to condense very long content.
dragon_slayer says... #10
Thanks so much, Epochalyptik! This will make my deck descriptions so much neater!
One question though; can you have spoiler text within spoiler text? (For method 3, specifically.)
February 8, 2015 9:11 a.m.
Epochalyptik says... #13
Made a slight modification. I noticed that class="link" isn't necessary because we aren't referring to a defined CSS class.
February 8, 2015 3:08 p.m.
Putting the p tag inside your summary tag causes the arrow to be the line above the text.
February 8, 2015 3:18 p.m.
Now I can help people who regularly ignore me by allowing them to simply not see my comments in the first place. Cool!!
February 11, 2015 7:40 a.m.
Epochalyptik - I was looking at the Format Tips and I noticed that something was wrong.
Look at the middle row:
Should be [ [ symbol:GW ] ]
February 22, 2015 6:28 p.m.
Help! Whenever I try to put the spoiler text stuff into my deck desricptions the text doesn't open, but when I click the button elsewhere it works fine. Is your formatting wrong?
hyperlocke says... #2
Thanks, Epoch. These questions came a lot, lately.
February 7, 2015 6:30 p.m.