Registration has been disabled and the moderation extension has been turned off.
Contact an admin on Discord or EDF if you want an account. Also fuck bots.

Encyclopedia Dramatica:Collapsing Objects: Difference between revisions

From Encyclopedia Dramatica
Jump to navigation Jump to search
imported>TabbyGarf
imported>TabbyGarf
update, thanks jacob lol
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Image:Wtc_005.jpg|thumb|right|Collapsing objects.]]
[[Image:Wtc_005.jpg|thumb|right|upright|Collapsing objects.]]


__NOTOC__
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.


The ED wiki is now using the latest version of the Collapsing Objects code originally developed for [[ED:Encyclopedia Dramatica:Collapsing Objects|ED]].  You will see some familiar concepts, but the syntax and end results have been changed around a great deal.  Just like before, you can either write the code yourself (much easier than version 1) or use a template.
==Adding classes to elements==
===mw-collapsible===
Elements with the class <code>mw-collapsible</code> will be collapse, like so:


==Writing the Code==
<pre style="white-space:pre-wrap;">
<div class="mw-collapsible" style="max-width:300px;">Content!</div>
</pre>


In the previous version of the code, there was a one-to-one ratio between links and collapsing content.  This new release allows for greater flexibility in four different ratios.
<div class="mw-collapsible" style="max-width:300px;">Content!</div>


You pass information to the script using the class tag of the container that will hold the link. Arguments are separated by semicolons and the ordering is mandatory. For instance:
===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;">
<span class="co;ctext;etext;state;classname;linkcolor"></span>
<div class="mw-collapsible mw-collapsed" style="max-width:300px;">Content!</div>
</pre>
</pre>


:'''co''' - This designates a collapsing object.  It is mandatory and case sensitive.
<div class="mw-collapsible mw-collapsed" style="max-width:300px;">Content!</div>
:'''ctext''' - This is the collapsing link text.  It can contain any special characters or spaces except a semicolon.
 
:'''etext''' - This is the expanding link text.  It can contain any special characters or spaces except a semicolon.
===mw-collapsible-content===
:'''state''' - This is the initial state.  0 is collapsed; 1 is expanded.  God help you if you put a 2.
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.
:'''classname''' - The target class of this link.  See the following sections for an explanation.
:'''linkcolor''' - Optional parameter that lets you customize the link's color.  Don't include the preceeding semicolon if you're not changing the color.


You mark the target object(s) by setting the class equal to '''classname'''. For example:
<pre style="white-space:pre-wrap;">
<div class="mw-collapsible" style="max-width:300px; border:1px #000 solid; padding:5px;">
Non-collapsible content


<pre>
<div class="mw-collapsible-content" style="border:1px #000 solid; padding:5px;">Collapsible content</div>
<div class="classname">Content!</div>
</div>
</pre>
</pre>


===One-to-One===
<div class="mw-collapsible" style="max-width:300px; border:1px #000 solid; padding:5px;">
 
Non-collapsible content
This is the standard one link to one content region relationship.
 
Example:


<span class="co;[Collapse];[Expand];0;test1"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test1" style="background-color: red; color: white; padding: 5px;">What's up?</span>
<div class="mw-collapsible-content" style="border:1px #000 solid; padding:5px;">Collapsible content</div>
</div>


Code:
==Toggle links==
A couple of options are available when customizing the toggle link for collapsible objects.


<pre>
===data-collapsetext and data-expandtext===
<span class="co;[Collapse];[Expand];0;test1"></span>
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>:


<span class="test1">What's up?</span>
<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>


===One-to-Many===
<div class="mw-collapsible mw-collapsed" style="max-width:300px;" data-expandtext="Show" data-collapsetext="Hide">Content!</div>


This is one link to multiple content regions.
However, this method has its shortcomings:


Example:
*The location of the toggle link is restricted.
 
*The style of the toggle link cannot be changed.
<span class="co;[Collapse];[Expand];0;test2"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test2" style="background-color: red; color: white; padding: 5px;">What's up?</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test2" style="background-color: blue; color: white; padding: 5px;">What's up?</span>
 
Code:


<pre>
===mw-customtoggle===
<span class="co;[Collapse];[Expand];0;test2"></span>
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="test2">What's up?</span>
<pre style="white-space:pre-wrap;">
<span class="mw-customtoggle-customtoggle01" style="color:hotpink; font-weight:bold; cursor:pointer;">[Toggle link]</span>


<span class="test2">What's up?</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>


===Many-to-One===
<span class="mw-customtoggle-customtoggle01" style="color:hotpink; font-weight:bold; cursor:pointer;">[Toggle link]</span>


This is multiple links to one content region.
<div id="mw-customcollapsible-customtoggle01" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Content</div>


Example:
====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.


<span class="co;[Collapse];[Expand];0;test3"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test3" style="background-color: red; color: white; padding: 5px;">What's up?</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="co;[Collapse];[Expand];0;test3"></span>
The following is an example of a collapsible object that is initially non-collapsed by default:


Code:
<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>


<pre>
<div id="mw-customcollapsible-customtoggle02" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div>
<span class="co;[Collapse];[Expand];0;test3"></span>
 
<span class="test3">What's up?</span>
 
<span class="co;[Collapse];[Expand];0;test3"></span>
</pre>
</pre>


===Many-to-Many===
<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>
 
This is multiple links to multiple content regions.
 
Example:


<span class="co;[Collapse];[Expand];0;test4"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test4" style="background-color: red; color: white; padding: 5px;">What's up?</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test4" style="background-color: blue; color: white; padding: 5px;">What's up?</span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="co;[Collapse];[Expand];0;test4"></span>
<div id="mw-customcollapsible-customtoggle02" class="mw-collapsible" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div>
 
Code:
 
<pre>
<span class="co;[Collapse];[Expand];0;test4"></span>


<span class="test4">What's up?</span>
The following is an example of a collapsible object that is initially collapsed by default:


<span class="test4">What's up?</span>
<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>


<span class="co;[Collapse];[Expand];0;test4"></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>


===Changing Link Color===
<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>
 
This collapsing link is green.
 
Example:
 
<span class="co;[Collapse];[Expand];0;test5;green"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test5">My link is green.</span>


Code:
<div id="mw-customcollapsible-customtoggle03" class="mw-collapsible mw-collapsed" style="max-width:300px; border:1px #000 solid; padding:5px;">Collapsible content</div>
 
<pre>
<span class="co;[Collapse];[Expand];0;test5;green"></span>&nbsp;&nbsp;&nbsp;&nbsp;<span class="test5">My link is green.</span>
</pre>


==Using Templates==
==Using Templates==
Line 195: Line 177:
B: Unique name to the page.  Hint: The gallery title with no spaces works fine.
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".
C: Horizontal alignment of gallery on page.  "left", "right", or "center".
D: gallery images.  Must be enclosed in <gallery></gallery> tags.
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.
</pre>
</pre>


Line 207: Line 190:
File:propoganda.png| propaganda image
File:propoganda.png| propaganda image
File:123496873881.png| propaganda
File:123496873881.png| propaganda
</gallery>|<gallery>
File:At-v2.png |moar propaganda
File:At-v2.png |moar propaganda
File:At-v3.png |moar propaganda
File:At-v3.png |moar propaganda
Line 229: Line 213:
File:propoganda.png| propaganda image
File:propoganda.png| propaganda image
File:123496873881.png| propaganda
File:123496873881.png| propaganda
</gallery>|<gallery>
File:At-v2.png |moar propaganda
File:At-v2.png |moar propaganda
File:At-v3.png |moar propaganda
File:At-v3.png |moar propaganda
Line 246: 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

Collapsing objects.

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>
Content!

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>
Content!

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

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>
Content!

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]

Content

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>

[Show content][Hide content]

Collapsible 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][Hide content]

Collapsible 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][Expand Me]]

Here's some stuff.


{{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


Here's some sample content under a large header.

{{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

Here's some sample content under a small header.

{{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:

Raid Propaganda About missing Pics
[Collapse GalleryExpand Gallery]



See Also