- Portals
- The Current Year
- ED in the News
- Admins
- Help ED Rebuild
- Archive
- ED Bookmarklet
- Donate Bitcoin
Contact an admin on Discord or EDF if you want an account. Also fuck bots.
Encyclopedia Dramatica:Collapsing Objects: Difference between revisions
imported>TKN |
imported>TabbyGarf update, thanks jacob lol |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[Image:Wtc_005.jpg|thumb|right|Collapsing objects.]] | [[Image:Wtc_005.jpg|thumb|right|upright|Collapsing objects.]] | ||
Encyclopedia Dramatica uses [[mediawikiwiki:Manual:Collapsible_elements#jQuery.makeCollapsible|MediaWiki's jQuery.makeCollapsible module]] and [[MediaWiki:Common.js|custom scripts]] in order to produce collapsing objects. | |||
==Adding classes to elements== | |||
===mw-collapsible=== | |||
Elements with the class <code>mw-collapsible</code> will be collapse, like so: | |||
== | <pre style="white-space:pre-wrap;"> | ||
<div class="mw-collapsible" style="max-width:300px;">Content!</div> | |||
</pre> | |||
<div class="mw-collapsible" style="max-width:300px;">Content!</div> | |||
===mw-collapsed=== | |||
Elements with the <code>mw-collapsible</code> class alone will initially be non-collapsed by default. In order to have an element be initially collapsed by default, the element must possess the <code>mw-collapsed</code> class in addition to the <code>mw-collapsible</code> class. | |||
<pre> | <pre style="white-space:pre-wrap;"> | ||
< | <div class="mw-collapsible mw-collapsed" style="max-width:300px;">Content!</div> | ||
</pre> | </pre> | ||
: | <div class="mw-collapsible mw-collapsed" style="max-width:300px;">Content!</div> | ||
===mw-collapsible-content=== | |||
In order to have a particular element within the element with the <code>mw-collapsible</code> class be collapsible instead of all the contents within the element with the <code>mw-collapsible</code> class, add the <code>mw-collapsible-content</code> class to the element you wish to be collapsible. | |||
<pre style="white-space:pre-wrap;"> | |||
<div class="mw-collapsible" style="max-width:300px; border:1px #000 solid; padding:5px;"> | |||
Non-collapsible content | |||
<div class="mw-collapsible-content" style="border:1px #000 solid; padding:5px;">Collapsible content</div> | |||
<div class=" | </div> | ||
</pre> | </pre> | ||
== | <div class="mw-collapsible" style="max-width:300px; border:1px #000 solid; padding:5px;"> | ||
Non-collapsible content | |||
< | <div class="mw-collapsible-content" style="border:1px #000 solid; padding:5px;">Collapsible content</div> | ||
</div> | |||
==Toggle links== | |||
A couple of options are available when customizing the toggle link for collapsible objects. | |||
< | ===data-collapsetext and data-expandtext=== | ||
< | One method of adding custom text for the toggle text replies on using two special data attributes: <code>data-collapsetext</code> and <code>data-expandtext</code>: | ||
< | <pre style="white-space:pre-wrap;"> | ||
<div class="mw-collapsible mw-collapsed" style="max-width:300px;" data-expandtext="Show" data-collapsetext="Hide">Content!</div> | |||
</pre> | </pre> | ||
== | <div class="mw-collapsible mw-collapsed" style="max-width:300px;" data-expandtext="Show" data-collapsetext="Hide">Content!</div> | ||
However, this method has its shortcomings: | |||
*The location of the toggle link is restricted. | |||
*The style of the toggle link cannot be changed. | |||
< | ===mw-customtoggle=== | ||
< | Another method replies on adding a customized <code>mw-customtoggle-</code> class to the element serving as a toggle link or button and add a customized <code>mw-customcollapsible-</code> id to the collapsible content. This method allow the toggle link to be anywhere on the webpage and to be stylized by users. | ||
<span class=" | <pre style="white-space:pre-wrap;"> | ||
<span class="mw-customtoggle-customtoggle01" style="color:hotpink; font-weight:bold; cursor:pointer;">[Toggle link]</span> | |||
< | <div id="mw-customcollapsible-customtoggle01" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Content</div> | ||
</pre> | </pre> | ||
= | <span class="mw-customtoggle-customtoggle01" style="color:hotpink; font-weight:bold; cursor:pointer;">[Toggle link]</span> | ||
<div id="mw-customcollapsible-customtoggle01" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Content</div> | |||
====Custom toggle link with toggleable text==== | |||
In order to have the toggle link or button change with each click, have a separate element for the "show" link and a separate element for the "hide" link and add the <code>collapsibletoggletext</code> to them. If you want the content to be initially non-collapsed by default, add the <code>hiddentext</code> class to the "show" link. If you want the content to be initially collapsed by default, add the <code>hiddentext</code> class to the "hide" link and add the <code>mw-collapsed</code> class to the content that is initially collapsed. Have a container element with the <code>collapsibletoggle</code> surround the "show" and "hide" links. | |||
The following is an example of a collapsible object that is initially non-collapsed by default: | |||
<pre style="white-space:pre-wrap;"> | |||
<span class="mw-customtoggle-customtoggle02 collapsibletoggle" style="color:hotpink; font-weight:bold; cursor:pointer;"><span class="collapsibletoggletext hiddentext">[Show content]</span><span class="collapsibletoggletext">[Hide content]</span></span> | |||
< | <div id="mw-customcollapsible-customtoggle02" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div> | ||
</pre> | </pre> | ||
= | <span class="mw-customtoggle-customtoggle02 collapsibletoggle" style="color:hotpink; font-weight:bold; cursor:pointer;"><span class="collapsibletoggletext hiddentext">[Show content]</span><span class="collapsibletoggletext">[Hide content]</span></span> | ||
< | <div id="mw-customcollapsible-customtoggle02" class="mw-collapsible" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div> | ||
The following is an example of a collapsible object that is initially collapsed by default: | |||
<span class=" | <pre style="white-space:pre-wrap;"> | ||
<span class="mw-customtoggle-customtoggle03 collapsibletoggle" style="color:hotpink; font-weight:bold; cursor:pointer;"><span class="collapsibletoggletext">[Show content]</span><span class="collapsibletoggletext hiddentext">[Hide content]</span></span> | |||
< | <div id="mw-customcollapsible-customtoggle03" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div> | ||
</pre> | </pre> | ||
== | <span class="mw-customtoggle-customtoggle03 collapsibletoggle" style="color:hotpink; font-weight:bold; cursor:pointer;"><span class="collapsibletoggletext">[Show content]</span><span class="collapsibletoggletext hiddentext">[Hide content]</span></span> | ||
<span class=" | |||
<div id="mw-customcollapsible-customtoggle03" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div> | |||
< | |||
</ | |||
==Using Templates== | ==Using Templates== | ||
Line 249: | Line 231: | ||
== See Also == | == See Also == | ||
* [[Encyclopedia Dramatica:Cycling Objects|Cycling Objects]] | |||
* [[Encyclopedia Dramatica:Morphing Objects|Morphing Objects]] | * [[Encyclopedia Dramatica:Morphing Objects|Morphing Objects]] | ||
[[Category:Encyclopedia Dramatica]] | [[Category:Encyclopedia Dramatica]] |
Latest revision as of 01:12, 16 March 2021
Encyclopedia Dramatica uses MediaWiki's jQuery.makeCollapsible module and custom scripts in order to produce collapsing objects.
Adding classes to elements
mw-collapsible
Elements with the class mw-collapsible
will be collapse, like so:
<div class="mw-collapsible" style="max-width:300px;">Content!</div>
mw-collapsed
Elements with the mw-collapsible
class alone will initially be non-collapsed by default. In order to have an element be initially collapsed by default, the element must possess the mw-collapsed
class in addition to the mw-collapsible
class.
<div class="mw-collapsible mw-collapsed" style="max-width:300px;">Content!</div>
mw-collapsible-content
In order to have a particular element within the element with the mw-collapsible
class be collapsible instead of all the contents within the element with the mw-collapsible
class, add the mw-collapsible-content
class to the element you wish to be collapsible.
<div class="mw-collapsible" style="max-width:300px; border:1px #000 solid; padding:5px;"> Non-collapsible content <div class="mw-collapsible-content" style="border:1px #000 solid; padding:5px;">Collapsible content</div> </div>
Non-collapsible content
Toggle links
A couple of options are available when customizing the toggle link for collapsible objects.
data-collapsetext and data-expandtext
One method of adding custom text for the toggle text replies on using two special data attributes: data-collapsetext
and data-expandtext
:
<div class="mw-collapsible mw-collapsed" style="max-width:300px;" data-expandtext="Show" data-collapsetext="Hide">Content!</div>
However, this method has its shortcomings:
- The location of the toggle link is restricted.
- The style of the toggle link cannot be changed.
mw-customtoggle
Another method replies on adding a customized mw-customtoggle-
class to the element serving as a toggle link or button and add a customized mw-customcollapsible-
id to the collapsible content. This method allow the toggle link to be anywhere on the webpage and to be stylized by users.
<span class="mw-customtoggle-customtoggle01" style="color:hotpink; font-weight:bold; cursor:pointer;">[Toggle link]</span> <div id="mw-customcollapsible-customtoggle01" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Content</div>
[Toggle link]
Custom toggle link with toggleable text
In order to have the toggle link or button change with each click, have a separate element for the "show" link and a separate element for the "hide" link and add the collapsibletoggletext
to them. If you want the content to be initially non-collapsed by default, add the hiddentext
class to the "show" link. If you want the content to be initially collapsed by default, add the hiddentext
class to the "hide" link and add the mw-collapsed
class to the content that is initially collapsed. Have a container element with the collapsibletoggle
surround the "show" and "hide" links.
The following is an example of a collapsible object that is initially non-collapsed by default:
<span class="mw-customtoggle-customtoggle02 collapsibletoggle" style="color:hotpink; font-weight:bold; cursor:pointer;"><span class="collapsibletoggletext hiddentext">[Show content]</span><span class="collapsibletoggletext">[Hide content]</span></span> <div id="mw-customcollapsible-customtoggle02" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div>
[Hide content]
The following is an example of a collapsible object that is initially collapsed by default:
<span class="mw-customtoggle-customtoggle03 collapsibletoggle" style="color:hotpink; font-weight:bold; cursor:pointer;"><span class="collapsibletoggletext">[Show content]</span><span class="collapsibletoggletext hiddentext">[Hide content]</span></span> <div id="mw-customcollapsible-customtoggle03" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div>
[Show content]
Using Templates
The templates require you to specify a target class name. This allows you to extend the functionality of each template by adding more links or content regions to suit your need. A target class name must be unique to the page and contain no spaces.
{{co}}: Object
Generic collapsing object. More or less the same as writing out the one-to-one code by hand.
{{co|A|B|C|D|E|F}} A: Unique name to the page, no spaces. B: The text to be displayed on the collapse link. C: The text to be displayed on the expand lnk. D: The initial state. 0 = collapsed, anything else = expanded. E: The content to collapse and expand. F: Style information for the collapsing content.
For instance,
{{co|qwerty|[Collapse Me]|[Expand Me]|1|Here's some stuff.|color: red; background-color: black; padding: 5px;}}
gives you:
[[Collapse Me]]
{{cs}}: Section
Level 2 collapsing section header.
{{cs|A|B|C|D}} A: Unique name to the page, no spaces. Hint: The section name with no spaces works. B: The section name. C: The section content. May contain nested collapsable sections. D: The initial state. 0 = collapsed, anything else = expanded.
For instance,
{{cs|testSectionOne|Test Section One|Here's some sample content under a large header.|0}}
gives you:
[+]Test Section One
{{cs2}}: Subsection
Level 3 collapsing section header.
{{cs2|A|B|C|D}} A: Unique name to the page, no spaces. Hint: The section name with no spaces works. B: The section name. C: The section content. May contain nested collapsable sections. D: The initial state. 0 = collapsed, anything else = expanded.
For instance,
{{cs2|testSectionTwo|Test Section Two|Here's some sample content under a small header.|0}}
gives you:
[+]Test Section Two
{{cg}}: Gallery
{{cg|A|B|C|D|E}} A: Gallery title to be displayed in the black box B: Unique name to the page. Hint: The gallery title with no spaces works fine. C: Horizontal alignment of gallery on page. "left", "right", or "center". D: Teaser gallery images. Must be enclosed in <gallery></gallery> tags and should be a multiple of four images. E: Remaining gallery images. Must be enclosed in <gallery></gallery> tags.
Example:
{{cg|Raid Propaganda|raidPropaganda|center|<gallery> <gallery widths="110px" heights="150" perrow="5"> File:EndOfFailIcon.png|original image File:Op-eof.png|Another propaganda img File:propoganda.png| propaganda image File:123496873881.png| propaganda </gallery>|<gallery> File:At-v2.png |moar propaganda File:At-v3.png |moar propaganda File:At-v4.png |moar propaganda File:AnonResistance.png |original original image File:AnonAsOneAnonymousAndFree.jpg |moar propaganda File:AnonAsOneAnonAndFree.png |alt original File:DefendYouChans.png |moar propaganda File:LiberateOurChans.png |moar propaganda File:AThousandAnonDescentUponYou.jpg |moar propaganda </gallery>}} </gallery>}}
gives you:
-
original image
-
Another propaganda img
-
propaganda image
-
propaganda
-
moar propaganda
-
moar propaganda
-
moar propaganda
-
original original image
-
moar propaganda
-
alt original
-
moar propaganda
-
moar propaganda
-
moar propaganda