Difference between revisions of "User:Tsutomu25/sandbox/Cover2"

From Detective Conan Wiki
 
(14 intermediate revisions by the same user not shown)
Line 11: Line 11:
  
 
/* Styles for the buttons */
 
/* Styles for the buttons */
button-{{{1}}}{
+
.button-{{{1}}}{
 
  position: absolute;
 
  position: absolute;
 
  top: 0px;
 
  top: 0px;
Line 36: Line 36:
 
  opacity: 0;
 
  opacity: 0;
 
  transition: 0.3s;
 
  transition: 0.3s;
  -webkit-user-select: none; /* Safari */
+
  -webkit-user-select: none;
  -ms-user-select: none; /* IE 10 and IE 11 */
+
  -ms-user-select: none;
  user-select: none; /* Standard syntax */
+
  user-select: none;
 
}
 
}
  
 
/* Styles to reveal the spoiler text */
 
/* Styles to reveal the spoiler text */
#spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target){
+
#spoiler-box-{{{1}}}:hover{
 +
background-color: #70717a;
 +
}
 +
#spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target), #spoiler-box:has(#spoiler-target:target){
 
  background-color: #e3e3e5;
 
  background-color: #e3e3e5;
 
}
 
}
#spoiler-target-{{{1}}}:target ~ #spoiler-text-{{{1}}}{
+
#spoiler-target-{{{1}}}:target ~ #spoiler-text-{{{1}}}, #spoiler-target:target ~ #spoiler-text{
 
  opacity: 1;
 
  opacity: 1;
 
  background-color: #e3e3e5;
 
  background-color: #e3e3e5;
Line 54: Line 57:
  
 
/* Styles to hide the show button and reveal the hide button */
 
/* Styles to hide the show button and reveal the hide button */
#spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target) #show-button-{{{1}}}{
+
#spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target) #show-button-{{{1}}}, #spoiler-box:has(#spoiler-target:target) #show-button{
 
  display: none;
 
  display: none;
 
  z-index: 0;
 
  z-index: 0;
 
}
 
}
#spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target) #hide-button-{{{1}}}{
+
#spoiler-box-{{{1}}}:has(#spoiler-target-{{{1}}}:target) #hide-button-{{{1}}}, #spoiler-box:has(#spoiler-target:target) #hide-button{
 
  display: inline-block;
 
  display: inline-block;
 
  z-index: 5;
 
  z-index: 5;
 
}
 
}
 +
 
}}
 
}}
</includeonly>
+
</includeonly><noinclude>
<noinclude>
+
It hides the given input of spoiler text and reveals them when the user clicks on them. It takes two values. One is the name of the spoiler and another one is the actual spoiler text. Every time the template is used, every element has to have a unique id and class. Hence spoiler name is required.
 +
 
 +
== Usage ==
 +
The following is a list of required parameters:
 +
<pre>
 +
{{User:Tsutomu25/sandbox/Cover2|<spoiler name>|<spoiler text>}}
 +
</pre>
  
<pre>{{User:Tsutomu25/sandbox/Cover2|The culprit is Gosho Aoyama}}</pre>
+
== Limitations ==
 +
* When the template is used multiple times on the same page, only one spoiler can remain visible at a time. If the user reveals another spoiler, the previously opened one will automatically be hidden.
 +
* The hyperlinks are not clickable when used inside the template.
 +
* If the page is refreshed while a spoiler is revealed, that spoiler will remain open even after the page reloads.
  
Results in {{User:Tsutomu25/sandbox/Cover2|culprit|The culprit is Gosho Aoyama}}
+
== Examples==
Results in {{User:Tsutomu25/sandbox/Cover2|motive|The motive is Love}}
+
Result: {{User:Tsutomu25/sandbox/Cover2|weapon|The weapon is Knife}}
Results in {{User:Tsutomu25/sandbox/Cover2|weapon|The weapon is Knife}}
+
Result: {{User:Tsutomu25/sandbox/Cover2|motive|The culprit wore {{font color|#ffa500|Orange}} clothes}}
 +
Result: {{User:Tsutomu25/sandbox/Cover2|culprit|The culprit is [[Gosho Aoyama]]}}
  
 +
[[Category:Templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 10:38, 23 August 2025

It hides the given input of spoiler text and reveals them when the user clicks on them. It takes two values. One is the name of the spoiler and another one is the actual spoiler text. Every time the template is used, every element has to have a unique id and class. Hence spoiler name is required.

Usage

The following is a list of required parameters:

{{User:Tsutomu25/sandbox/Cover2|<spoiler name>|<spoiler text>}}

Limitations

  • When the template is used multiple times on the same page, only one spoiler can remain visible at a time. If the user reveals another spoiler, the previously opened one will automatically be hidden.
  • The hyperlinks are not clickable when used inside the template.
  • If the page is refreshed while a spoiler is revealed, that spoiler will remain open even after the page reloads.

Examples

Result: The weapon is Knife

Result: The culprit wore Orange clothes

Result: The culprit is Gosho Aoyama