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:Morphing Objects: Difference between revisions

From Encyclopedia Dramatica
Jump to navigation Jump to search
imported>JuniusThaddeus
imported>TabbyGarf
lol stolen
 
Line 1: Line 1:
Early in 2008, Encyclopedia Dramatica's [[ED:Collapsing_Objects|Collapsing Objects]] went back in time and raped a Power Ranger.  This unholy union resulted in a terrifying new breed of dynamic content known as Mighty Morphing Power Objects, or Morphing Objects for short.
Early in 2008, Encyclopedia Dramatica's [[ED:Collapsing_Objects|Collapsing Objects]] went back in time and raped a Power Ranger.  This unholy union resulted in a terrifying new breed of dynamic content known as Mighty Morphing Power Objects, or Morphing Objects for short.


<p>Morphing Objects can yield the same results as Collapsing Objects with a little work, but Collapsing Objects do their particular job better and aren't being replaced by this change.
In 2017, ED at long last upgraded from MediaWiki 1.16 to MediaWiki 1.28 and adopted jQuery, causing the old Morphing Objects to cease functioning. A new jQuery-based script was then written to replace it.
</p>


==How Does It Work?==
==How Does It Work?==
<p>Unlike collapsing Objects, there is no rigid structure to follow.  After placing a mandatory "morph master" span on the page, you can make as many link-content pairs as you'd like, as long as you follow a few simple rules.
The new script used for morphing objects is as follows:


</p><p>The morph master span is as such:
<pre style="white-space:pre-wrap;">
</p>
/* Click link to show one item and hide sibling items */
<pre>
 
&lt;span class=&quot;morphMaster&quot; id=&quot;uniqueNameMaster&quot;&gt;&lt;/span&gt;
$(function(){
    $(".morphlink").click(function(){
        $("#"+$(this).data("correspondingcontent")).removeClass("hiddentext").siblings(".morphcontent").addClass("hiddentext");
    });
});
</pre>
</pre>
<p>Simply replace <i>uniqueName</i> with a name unique to the page. See the [[ED:Collapsing Objects]] page if you don't know how this works.  Then, create link-content pairs ordered sequentially starting at 1. The link must be a span or div but the content object can be any type of container object, including spans, divs, tables, etc:


</p>
This basically translates to: When a HTML element with the class <code>morphlink</code> is click, an element with an id corresponding to the <code>data-correspondingcontent</code> attribute of the clicked element has its <code>hiddentext</code> class removed while sibling elements with the <code>morphcontent</code> class has the <code>hiddentext</code> class added to them.
<pre>
&lt;span id=&quot;uniqueNameLink1&quot;&gt;Link to Show uniqueNameContent1&lt;/span&gt;
&lt;span id=&quot;uniqueNameContent1&quot;&gt;Content object 1 is a span!&lt;/span&gt;


&lt;span id=&quot;uniqueNameLink2&quot;&gt;Link to Show uniqueNameContent2&lt;/span&gt;
As such, the toggle links or buttons must have the <code>morphlink</code> class, and the content that is morphed in and out of view must have the <code>morphcontent</code> class. The <code>morphlink</code> element must possess the <code>data-correspondingcontent</code> attribute, and that <code>data-correspondingcontent</code> attribute must correspond to the id of the <code>morphcontent</code> element that is supposed to be showed. The <code>hiddentext</code> class should be added to all <code>morphcontent</code> elements that are not initially displayed by default.


&lt;div id=&quot;uniqueNameContent2&quot;&gt;Content object 2 is a div!&lt;/div&gt;
<pre style="white-space:pre-wrap;">
<span class="morphlink showhidetext" data-correspondingcontent="uniqueNameContent1">Link to Show uniqueNameContent1</span>


&lt;span id=&quot;uniqueNameLink3&quot;&gt;Link to Show uniqueNameContent3&lt;/span&gt;
<p id="uniqueNameContent1" class="morphcontent hiddentext">Content object 1 is a paragraph!</p>
&lt;table id=&quot;uniqueNameContent3&quot;&gt;
  &lt;tr&gt;


    &lt;td&gt;Content object 3 is a table!&lt;/td&gt;
<span class="morphlink showhidetext" data-correspondingcontent="uniqueNameContent2">Link to Show uniqueNameContent2</span>
  &lt;/tr&gt;
 
&lt;/table&gt;
<div id="uniqueNameContent2" class="morphcontent hiddentext">Content object 2 is a div!</div>
</pre>
<p>The Morphing Objects script iterates until it reaches a counter value where a link and content object don't both exist.  To prevent exploits, it will not start looking at higher values, so if you miss a number early on, the rest of the links and content will not be displayed.


</p>
<span class="morphlink showhidetext" data-correspondingcontent="uniqueNameContent3">Link to Show uniqueNameContent3</span>
==Optional: Paging Support==
<p>If desired, the Morphing Objects script can generate paging controls for your Morphing content.  When paging is active, you are no longer required to have a corresponding <i>uniqueNameLink</i> for every <i>uniqueNameContent</i>, BUT the same rules on the script's stopping point for creating the links still apply.  For instance, if you have 10 elements and you create links for 1 to 6 and then 8 to 10, the links for 8 to 10 simply will not display.


</p><p>To add paging support, you must create the pair of paging Objects as such:
<table id="uniqueNameContent3" class="morphcontent hiddentext">Content object 3 is a table!</table>
</p>
    <tr>
<pre>
        <td>Content object 3 is a table!</td>
&lt;span id=&quot;uniqueNameLinkPrev&quot;&gt;Previous Content Pane&lt;/span&gt;
    </tr>
&lt;span id=&quot;uniqueNameLinkNext&quot;&gt;Next Content Pane&lt;/span&gt;
</table>
</pre>
</pre>


<p>Additionally, you must have <i>at least</i> one content pane or the paging controls will not be displayed.
==Important: Newline Issue==
</p>
The <code>morphcontent</code> class can be assigned to <code>span</code> elements, but since the script depends on <code>.siblings</code>, the <code>span</code> elements might be located on the same line or in the same paragraph. This is because the MediaWiki software transforms two newlines into a paragraph.
==Important: Whitespace Issues==
<p>In the examples on this page, the HTML was properly formatted in order to be easy to read and understand.  Different browsers, however, handle whitespace inbetween HTML elements differently. In order to make sure that your fancy new thing looks good on every browser, you should remove extra whitespace between content panes and any containers surrounding the content panes. For example:
</p>
<pre>
&lt;div style=&quot;border: 1px solid black; padding: 5px;&quot;&gt;


&lt;div id=&quot;someContent1&quot;&gt;Here's the first content pane.&lt;/div&gt;
For example:


&lt;div id=&quot;someContent2&quot;&gt;Here's the second content pane.&lt;/div&gt;
<pre style="white-space:pre-wrap;">
<div style="border: 1px solid black; padding: 5px;">


&lt;div id=&quot;someContent3&quot;&gt; Here's the third content pane.&lt;/div&gt;
<span id="someContent1" class="morphlink showhidetext">Here's the first content pane.</span>


&lt;/div&gt;
<span id="someContent2" class="morphlink showhidetext">Here's the second content pane.</span>
 
<span id="someContent3" class="morphlink showhidetext">Here's the third content pane.</span>
 
</div>
</pre>
</pre>


<p>Needs to become:
Needs to become:
</p>
<pre>
&lt;div style=&quot;border: 1px solid black; padding: 5px;&quot;&gt;&lt;div id=&quot;someContent1&quot;&gt;Here's the first content pane.&lt;/div&gt;&lt;div id=&quot;someContent2&quot;&gt;Here's the second content pane.&lt;/div&gt;&lt;div id=&quot;someContent3&quot;&gt; Here's the third content pane.&lt;/div&gt;&lt;/div&gt;


<pre style="white-space:pre-wrap;">
<div style="border: 1px solid black; padding: 5px;">
<span id="someContent1" class="morphlink showhidetext">Here's the first content pane.</span> <span id="someContent2" class="morphlink showhidetext">Here's the second content pane.</span> <span id="someContent3" class="morphlink showhidetext"> Here's the third content pane.</span>
</div>
</pre>
</pre>
<p>[[PROTIP]]: Write the code in legible HTML and, when it's working (except for whitespace issues), then remove all the excess spacing.
 
</p>
Other elements (div, ul, table, etc.) are not affected by this issue.
 
==Tab Example==
==Tab Example==
<p>
</p>
<span class="morphMaster" id="gamingTemplateMaster"></span>
<table width="80%" cellpadding="0" cellspacing="0" border="0" style="background-color: #FFCC66; border-top: 1px black solid; border-left: 1px black solid; border-right: 1px black solid;">
<table width="80%" cellpadding="0" cellspacing="0" border="0" style="background-color: #FFCC66; border-top: 1px black solid; border-left: 1px black solid; border-right: 1px black solid;">
   <tr>
   <tr>
Line 81: Line 73:


     <td style="text-align: right; padding: 5px; font-size: 8pt; vertical-align: middle;">
     <td style="text-align: right; padding: 5px; font-size: 8pt; vertical-align: middle;">
<span id="gamingTemplateLink1">Games</span> •  
<span id="gamingTemplateLink1" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent1">Games</span> •  
<span id="gamingTemplateLink2">Consoles</span> •  
<span id="gamingTemplateLink2" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent2">Consoles</span> •  
<span id="gamingTemplateLink3">Portables</span> •  
<span id="gamingTemplateLink3" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent3">Portables</span> •  
<span id="gamingTemplateLink4">Developers</span><br />
<span id="gamingTemplateLink4" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent4">Developers</span><br />
<span id="gamingTemplateLink5">Comics</span> •  
<span id="gamingTemplateLink5" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent5">Comics</span> •  
<span id="gamingTemplateLink6">Websites</span> •  
<span id="gamingTemplateLink6" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent6">Websites</span> •  
<span id="gamingTemplateLink7">Related</span>
<span id="gamingTemplateLink7" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent7">Related</span>
     </td>
     </td>
   </tr>
   </tr>
Line 97: Line 89:
     <td style="padding: 5px;">
     <td style="padding: 5px;">
     <table cellpadding="5" id="gamingTemplateContent1" cellspacing="0" border="0" width="100%" style="border: 1px black solid; display: none;">
     <table cellpadding="5" id="gamingTemplateContent1" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       <tr valign="top" style="background-color: navajowhite;">
       <tr valign="top" style="background-color: navajowhite;">
Line 104: Line 96:
     </table>
     </table>


     <table cellpadding="5" id="gamingTemplateContent2" cellspacing="0" border="0" width="100%" style="border: 1px black solid; display: none;">
     <table cellpadding="5" id="gamingTemplateContent2" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       <tr valign="top" style="background-color: blanchedalmond;">
       <tr valign="top" style="background-color: blanchedalmond;">
Line 111: Line 103:
     </table>
     </table>


     <table cellpadding="5" id="gamingTemplateContent3" cellspacing="0" border="0" width="100%" style="border: 1px black solid; display: none;">
     <table cellpadding="5" id="gamingTemplateContent3" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       <tr valign="top" style="background-color: navajowhite;">
       <tr valign="top" style="background-color: navajowhite;">
Line 118: Line 110:
     </table>
     </table>


     <table cellpadding="5" id="gamingTemplateContent4" cellspacing="0" border="0" width="100%" style="border: 1px black solid; display: none;">
     <table cellpadding="5" id="gamingTemplateContent4" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       <tr valign="top" style="background-color: blanchedalmond;">
       <tr valign="top" style="background-color: blanchedalmond;">
Line 125: Line 117:
     </table>
     </table>


     <table cellpadding="5" id="gamingTemplateContent5" cellspacing="0" border="0" width="100%" style="border: 1px black solid; display: none;">
     <table cellpadding="5" id="gamingTemplateContent5" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       <tr valign="top" style="background-color: navajowhite;">
       <tr valign="top" style="background-color: navajowhite;">
Line 132: Line 124:
     </table>
     </table>


     <table cellpadding="5" id="gamingTemplateContent6" cellspacing="0" border="0" width="100%" style="border: 1px black solid; display: none;">
     <table cellpadding="5" id="gamingTemplateContent6" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       <tr valign="top" style="background-color: blanchedalmond;">
       <tr valign="top" style="background-color: blanchedalmond;">
Line 139: Line 131:
     </table>
     </table>


     <table cellpadding="5" id="gamingTemplateContent7" cellspacing="0" border="0" width="100%" style="border: 1px black solid; display: none;">
     <table cellpadding="5" id="gamingTemplateContent7" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       <tr valign="top" style="background-color: navajowhite;">
       <tr valign="top" style="background-color: navajowhite;">
Line 150: Line 142:
   </tr>
   </tr>
</table>
</table>
<span class="co;[Click to Hide Code];[Click to View Code];0;tabExample"></span>
<span class="collapsibletoggle">[<span class="mw-customtoggle-tabExample showhidetext"><span class="collapsibletoggletext hiddentext">Click to Hide Code</span><span class="collapsibletoggletext">Click to View Code</span></span>]</span>
<div class="tabExample">
<div id="mw-customcollapsible-tabExample" class="mw-collapsible mw-collapsed">
<pre>
<pre style="white-space:pre-wrap;">
&lt;span class=&quot;morphMaster&quot; id=&quot;gamingTemplateMaster&quot;&gt;&lt;/span&gt;
<table width="80%" cellpadding="0" cellspacing="0" border="0" style="background-color: #FFCC66; border-top: 1px black solid; border-left: 1px black solid; border-right: 1px black solid;">
  <tr>


&lt;table width=&quot;80%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;background-color: #FFCC66; border-top: 1px black solid; border-left: 1px black solid; border-right: 1px black solid;&quot;&gt;
    <td width="58" height="42" align="center">[[Image:Gamecontroller.gif]]</td>
  &lt;tr&gt;
    <td style="font-size: 12pt; padding: 5px;"><b>{{PAGENAME}}</b> is part of a series on [[Gaming]].</td>


     &lt;td width=&quot;58&quot; height=&quot;42&quot; align=&quot;center&quot;&gt;[[Image:Gamecontroller.gif]]&lt;/td&gt;
     <td style="text-align: right; padding: 5px; font-size: 8pt; vertical-align: middle;">
    &lt;td style=&quot;font-size: 12pt; padding: 5px;&quot;&gt;&lt;b&gt;{{PAGENAME}}&lt;/b&gt; is part of a series on [[Gaming]].&lt;/td&gt;
<span id="gamingTemplateLink1" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent1">Games</span> •
<span id="gamingTemplateLink2" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent2">Consoles</span> •
<span id="gamingTemplateLink3" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent3">Portables</span> •
<span id="gamingTemplateLink4" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent4">Developers</span><br />
<span id="gamingTemplateLink5" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent5">Comics</span> •
<span id="gamingTemplateLink6" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent6">Websites</span> •
<span id="gamingTemplateLink7" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent7">Related</span>
    </td>
  </tr>
</table>


    &lt;td style=&quot;text-align: right; padding: 5px; font-size: 8pt; vertical-align: middle;&quot;&gt;
<table width="80%" cellpadding="0" cellspacing="0" border="0" style="background-color: #FFCC66; border-left: 1px black solid; border-right: 1px black solid; border-bottom: 1px black solid;">
&lt;span id=&quot;gamingTemplateLink1&quot;&gt;Games&lt;/span&gt;&nbsp;&bull;&nbsp;
&lt;span id=&quot;gamingTemplateLink2&quot;&gt;Consoles&lt;/span&gt;&nbsp;&bull;&nbsp;
&lt;span id=&quot;gamingTemplateLink3&quot;&gt;Portables&lt;/span&gt;&nbsp;&bull;&nbsp;
&lt;span id=&quot;gamingTemplateLink4&quot;&gt;Developers&lt;/span&gt;&lt;br /&gt;
&lt;span id=&quot;gamingTemplateLink5&quot;&gt;Comics&lt;/span&gt;&nbsp;&bull;&nbsp;
&lt;span id=&quot;gamingTemplateLink6&quot;&gt;Websites&lt;/span&gt;&nbsp;&bull;&nbsp;
&lt;span id=&quot;gamingTemplateLink7&quot;&gt;Related&lt;/span&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;


&lt;table width=&quot;80%&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; style=&quot;background-color: #FFCC66; border-left: 1px black solid; border-right: 1px black solid; border-bottom: 1px black solid;&quot;&gt;
   <tr>
 
     <td style="padding: 5px;">
   &lt;tr&gt;
     &lt;td style=&quot;padding: 5px;&quot;&gt;
     &lt;table cellpadding=&quot;5&quot; id=&quot;gamingTemplateContent1&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;border: 1px black solid; display: none;&quot;&gt;
     <table cellpadding="5" id="gamingTemplateContent1" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       &lt;tr valign=&quot;top&quot; style=&quot;background-color: navajowhite;&quot;&gt;
       <tr valign="top" style="background-color: navajowhite;">
         &lt;td style=&quot;text-align: justify; font-size: 10pt;&quot;&gt;THE LIST OF GAMES&lt;/td&gt;
         <td style="text-align: justify; font-size: 10pt;">THE LIST OF GAMES</td>
       &lt;/tr&gt;
       </tr>
     &lt;/table&gt;
     </table>


     &lt;table cellpadding=&quot;5&quot; id=&quot;gamingTemplateContent2&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;border: 1px black solid; display: none;&quot;&gt;
     <table cellpadding="5" id="gamingTemplateContent2" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       &lt;tr valign=&quot;top&quot; style=&quot;background-color: blanchedalmond;&quot;&gt;
       <tr valign="top" style="background-color: blanchedalmond;">
         &lt;td style=&quot;text-align: left; font-size: 10pt;&quot;&gt;THE LIST OF CONSOLES&lt;/td&gt;
         <td style="text-align: left; font-size: 10pt;">THE LIST OF CONSOLES</td>
       &lt;/tr&gt;
       </tr>
     &lt;/table&gt;
     </table>


     &lt;table cellpadding=&quot;5&quot; id=&quot;gamingTemplateContent3&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;border: 1px black solid; display: none;&quot;&gt;
     <table cellpadding="5" id="gamingTemplateContent3" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       &lt;tr valign=&quot;top&quot; style=&quot;background-color: navajowhite;&quot;&gt;
       <tr valign="top" style="background-color: navajowhite;">
         &lt;td style=&quot;text-align: left; font-size: 10pt;&quot;&gt;THE LIST OF PORTABLES&lt;/td&gt;
         <td style="text-align: left; font-size: 10pt;">THE LIST OF PORTABLES</td>
       &lt;/tr&gt;
       </tr>
     &lt;/table&gt;
     </table>


     &lt;table cellpadding=&quot;5&quot; id=&quot;gamingTemplateContent4&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;border: 1px black solid; display: none;&quot;&gt;
     <table cellpadding="5" id="gamingTemplateContent4" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       &lt;tr valign=&quot;top&quot; style=&quot;background-color: blanchedalmond;&quot;&gt;
       <tr valign="top" style="background-color: blanchedalmond;">
         &lt;td style=&quot;text-align: left; font-size: 10pt;&quot;&gt;THE LIST OF DEVELOPERS&lt;/td&gt;
         <td style="text-align: left; font-size: 10pt;">THE LIST OF DEVELOPERS</td>
       &lt;/tr&gt;
       </tr>
     &lt;/table&gt;
     </table>


     &lt;table cellpadding=&quot;5&quot; id=&quot;gamingTemplateContent5&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;border: 1px black solid; display: none;&quot;&gt;
     <table cellpadding="5" id="gamingTemplateContent5" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       &lt;tr valign=&quot;top&quot; style=&quot;background-color: navajowhite;&quot;&gt;
       <tr valign="top" style="background-color: navajowhite;">
         &lt;td style=&quot;text-align: left; font-size: 10pt;&quot;&gt;THE LIST OF COMICS&lt;/td&gt;
         <td style="text-align: left; font-size: 10pt;">THE LIST OF COMICS</td>
       &lt;/tr&gt;
       </tr>
     &lt;/table&gt;
     </table>


     &lt;table cellpadding=&quot;5&quot; id=&quot;gamingTemplateContent6&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;border: 1px black solid; display: none;&quot;&gt;
     <table cellpadding="5" id="gamingTemplateContent6" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       &lt;tr valign=&quot;top&quot; style=&quot;background-color: blanchedalmond;&quot;&gt;
       <tr valign="top" style="background-color: blanchedalmond;">
         &lt;td style=&quot;text-align: left; font-size: 10pt;&quot;&gt;THE LIST OF WEBSITES&lt;/td&gt;
         <td style="text-align: left; font-size: 10pt;">THE LIST OF WEBSITES</td>
       &lt;/tr&gt;
       </tr>
     &lt;/table&gt;
     </table>


     &lt;table cellpadding=&quot;5&quot; id=&quot;gamingTemplateContent7&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;border: 1px black solid; display: none;&quot;&gt;
     <table cellpadding="5" id="gamingTemplateContent7" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">


       &lt;tr valign=&quot;top&quot; style=&quot;background-color: navajowhite;&quot;&gt;
       <tr valign="top" style="background-color: navajowhite;">
         &lt;td style=&quot;text-align: left; font-size: 10pt;&quot;&gt;RELATED CONTENT&lt;/td&gt;
         <td style="text-align: left; font-size: 10pt;">RELATED CONTENT</td>
       &lt;/tr&gt;
       </tr>
     &lt;/table&gt;
     </table>


     &lt;/td&gt;
     </td>
   &lt;/tr&gt;
   </tr>
&lt;/table&gt;
</table>
</pre>
</pre>
</div>
</div>


==Slideshow Example==
==Slideshow Example==
<span class="morphMaster" id="slideMaster"></span>
<div style="border: 1px solid black; padding: 5px;">
<div style="border: 1px solid black; padding: 5px;">


<div id="slideContent1">
<div id="slideContent1" class="morphcontent">Here's the first slide. <span id="slideLink2" class="morphlink showhidetext" data-correspondingcontent="slideContent2">Here's the link to the second slide.</span> </div>
Here's the first slide. <span id="slideLink2">Here's the link to the second slide.</span>  


</div>
<div id="slideContent2" class="morphcontent hiddentext">Here's the second slide. <span id="slideLink3" class="morphlink showhidetext" data-correspondingcontent="slideContent3">Here's the link to the third slide.</span></div>


<div id="slideContent2">
<div id="slideContent3" class="morphcontent hiddentext">Here's the third slide. <span id="slideLink1" class="morphlink showhidetext" data-correspondingcontent="slideContent1">Here's the link to the first slide.</span></div>
Here's the second slide. <span id="slideLink3">Here's the link to the third slide.</span>
</div>


<div id="slideContent3">
Here's the third slide. <span id="slideLink1">Here's the link to the first slide.</span>
</div>
</div>
 
<span class="collapsibletoggle">[<span class="mw-customtoggle-slideExample showhidetext"><span class="collapsibletoggletext hiddentext">Click to Hide Code</span><span class="collapsibletoggletext">Click to View Code</span></span>]</span>
</div>
<div id="mw-customcollapsible-slideExample" class="mw-collapsible mw-collapsed">
<span class="co;[Click to Hide Code];[Click to View Code];0;slideExample"></span>
<pre style="white-space:pre-wrap;">
<div class="slideExample">
<pre>
 
&lt;span class=&quot;morphMaster&quot; id=&quot;slideMaster&quot;&gt;&lt;/span&gt;
 
&lt;div style=&quot;border: 1px solid black; padding: 5px;&quot;&gt;
 
&lt;div id=&quot;slideContent1&quot;&gt;
Here's the first slide. &lt;span id=&quot;slideLink2&quot;&gt;Here's the link to the second slide.&lt;/span&gt;
 
&lt;/div&gt;
 
&lt;div id=&quot;slideContent2&quot;&gt;
Here's the second slide. &lt;span id=&quot;slideLink3&quot;&gt;Here's the link to the third slide.&lt;/span&gt;
&lt;/div&gt;
 
&lt;div id=&quot;slideContent3&quot;&gt;
 
Here's the third slide. &lt;span id=&quot;slideLink1&quot;&gt;Here's the link to the first slide.&lt;/span&gt;
&lt;/div&gt;
 
&lt;/div&gt;
</pre>
</div>
 
==Slideshow Example with Paging==
<span class="morphMaster" id="slidePagingMaster"></span>
 
<div style="border: 1px solid black; padding: 5px;">
<div style="border: 1px solid black; padding: 5px;">


<div id="slidePagingContent1">Here's the first slide.</div>
<div id="slideContent1" class="morphcontent">Here's the first slide. <span id="slideLink2" class="morphlink showhidetext" data-correspondingcontent="slideContent2">Here's the link to the second slide.</span> </div>


<div id="slidePagingContent2">Here's the second slide.</div>
<div id="slideContent2" class="morphcontent hiddentext">Here's the second slide. <span id="slideLink3" class="morphlink showhidetext" data-correspondingcontent="slideContent3">Here's the link to the third slide.</span></div>


<div id="slidePagingContent3">Here's the third slide.</div>
<div id="slideContent3" class="morphcontent hiddentext">Here's the third slide. <span id="slideLink1" class="morphlink showhidetext" data-correspondingcontent="slideContent1">Here's the link to the first slide.</span></div>
 
<p><span id="slidePagingLinkPrev">Prev Slide</span> | <span id="slidePagingLinkNext">Next Slide</span></p>


</div>
</div>
<span class="co;[Click to Hide Code];[Click to View Code];0;slidePagingExample"></span>
<div class="slidePagingExample">
<pre>
&lt;span class=&quot;morphMaster&quot; id=&quot;slidePagingMaster&quot;&gt;&lt;/span&gt;
&lt;div style=&quot;border: 1px solid black; padding: 5px;&quot;&gt;
&lt;div id=&quot;slidePagingContent1&quot;&gt;Here's the first slide.&lt;/div&gt;
&lt;div id=&quot;slidePagingContent2&quot;&gt;Here's the second slide.&lt;/div&gt;
&lt;div id=&quot;slidePagingContent3&quot;&gt;Here's the third slide.&lt;/div&gt;
&lt;p&gt;&lt;span id=&quot;slidePagingLinkPrev&quot;&gt;Prev Slide&lt;/span&gt; | &lt;span id=&quot;slidePagingLinkNext&quot;&gt;Next Slide&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
</pre>
</pre>
</div>
</div>
==See also==
*[[Encyclopedia Dramatica:Collapsing Objects]]
*[[Encyclopedia Dramatica:Cycling Objects]]

Latest revision as of 01:17, 16 March 2021

Early in 2008, Encyclopedia Dramatica's Collapsing Objects went back in time and raped a Power Ranger. This unholy union resulted in a terrifying new breed of dynamic content known as Mighty Morphing Power Objects, or Morphing Objects for short.

In 2017, ED at long last upgraded from MediaWiki 1.16 to MediaWiki 1.28 and adopted jQuery, causing the old Morphing Objects to cease functioning. A new jQuery-based script was then written to replace it.

How Does It Work?

The new script used for morphing objects is as follows:

/* Click link to show one item and hide sibling items */

$(function(){
    $(".morphlink").click(function(){
        $("#"+$(this).data("correspondingcontent")).removeClass("hiddentext").siblings(".morphcontent").addClass("hiddentext");
    });
});

This basically translates to: When a HTML element with the class morphlink is click, an element with an id corresponding to the data-correspondingcontent attribute of the clicked element has its hiddentext class removed while sibling elements with the morphcontent class has the hiddentext class added to them.

As such, the toggle links or buttons must have the morphlink class, and the content that is morphed in and out of view must have the morphcontent class. The morphlink element must possess the data-correspondingcontent attribute, and that data-correspondingcontent attribute must correspond to the id of the morphcontent element that is supposed to be showed. The hiddentext class should be added to all morphcontent elements that are not initially displayed by default.

<span class="morphlink showhidetext" data-correspondingcontent="uniqueNameContent1">Link to Show uniqueNameContent1</span>

<p id="uniqueNameContent1" class="morphcontent hiddentext">Content object 1 is a paragraph!</p>

<span class="morphlink showhidetext" data-correspondingcontent="uniqueNameContent2">Link to Show uniqueNameContent2</span>

<div id="uniqueNameContent2" class="morphcontent hiddentext">Content object 2 is a div!</div>

<span class="morphlink showhidetext" data-correspondingcontent="uniqueNameContent3">Link to Show uniqueNameContent3</span>

<table id="uniqueNameContent3" class="morphcontent hiddentext">Content object 3 is a table!</table>
    <tr>
        <td>Content object 3 is a table!</td>
    </tr>
</table>

Important: Newline Issue

The morphcontent class can be assigned to span elements, but since the script depends on .siblings, the span elements might be located on the same line or in the same paragraph. This is because the MediaWiki software transforms two newlines into a paragraph.

For example:

<div style="border: 1px solid black; padding: 5px;">

<span id="someContent1" class="morphlink showhidetext">Here's the first content pane.</span>

<span id="someContent2" class="morphlink showhidetext">Here's the second content pane.</span>

<span id="someContent3" class="morphlink showhidetext">Here's the third content pane.</span>

</div>

Needs to become:

<div style="border: 1px solid black; padding: 5px;">
<span id="someContent1" class="morphlink showhidetext">Here's the first content pane.</span> <span id="someContent2" class="morphlink showhidetext">Here's the second content pane.</span> <span id="someContent3" class="morphlink showhidetext"> Here's the third content pane.</span>
</div>

Other elements (div, ul, table, etc.) are not affected by this issue.

Tab Example

Morphing Objects is part of a series on Gaming.

GamesConsolesPortablesDevelopers
ComicsWebsitesRelated

THE LIST OF GAMES
THE LIST OF CONSOLES
THE LIST OF PORTABLES
THE LIST OF DEVELOPERS
THE LIST OF COMICS
THE LIST OF WEBSITES
RELATED CONTENT


[Click to Hide CodeClick to View Code]

<table width="80%" cellpadding="0" cellspacing="0" border="0" style="background-color: #FFCC66; border-top: 1px black solid; border-left: 1px black solid; border-right: 1px black solid;">
  <tr>

    <td width="58" height="42" align="center">[[Image:Gamecontroller.gif]]</td>
    <td style="font-size: 12pt; padding: 5px;"><b>{{PAGENAME}}</b> is part of a series on [[Gaming]].</td>

    <td style="text-align: right; padding: 5px; font-size: 8pt; vertical-align: middle;">
<span id="gamingTemplateLink1" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent1">Games</span> • 
<span id="gamingTemplateLink2" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent2">Consoles</span> • 
<span id="gamingTemplateLink3" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent3">Portables</span> • 
<span id="gamingTemplateLink4" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent4">Developers</span><br />
<span id="gamingTemplateLink5" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent5">Comics</span> • 
<span id="gamingTemplateLink6" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent6">Websites</span> • 
<span id="gamingTemplateLink7" class="morphlink showhidetext" data-correspondingcontent="gamingTemplateContent7">Related</span>
    </td>
  </tr>
</table>

<table width="80%" cellpadding="0" cellspacing="0" border="0" style="background-color: #FFCC66; border-left: 1px black solid; border-right: 1px black solid; border-bottom: 1px black solid;">

  <tr>
    <td style="padding: 5px;">
		
    <table cellpadding="5" id="gamingTemplateContent1" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">

      <tr valign="top" style="background-color: navajowhite;">
        <td style="text-align: justify; font-size: 10pt;">THE LIST OF GAMES</td>
      </tr>
    </table>

    <table cellpadding="5" id="gamingTemplateContent2" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">

      <tr valign="top" style="background-color: blanchedalmond;">
        <td style="text-align: left; font-size: 10pt;">THE LIST OF CONSOLES</td>
      </tr>
    </table>

    <table cellpadding="5" id="gamingTemplateContent3" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">

      <tr valign="top" style="background-color: navajowhite;">
        <td style="text-align: left; font-size: 10pt;">THE LIST OF PORTABLES</td>
      </tr>
    </table>

    <table cellpadding="5" id="gamingTemplateContent4" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">

      <tr valign="top" style="background-color: blanchedalmond;">
        <td style="text-align: left; font-size: 10pt;">THE LIST OF DEVELOPERS</td>
      </tr>
    </table>

    <table cellpadding="5" id="gamingTemplateContent5" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">

      <tr valign="top" style="background-color: navajowhite;">
        <td style="text-align: left; font-size: 10pt;">THE LIST OF COMICS</td>
      </tr>
    </table>

    <table cellpadding="5" id="gamingTemplateContent6" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">

      <tr valign="top" style="background-color: blanchedalmond;">
        <td style="text-align: left; font-size: 10pt;">THE LIST OF WEBSITES</td>
      </tr>
    </table>

    <table cellpadding="5" id="gamingTemplateContent7" class="morphcontent hiddentext" cellspacing="0" border="0" width="100%" style="border: 1px black solid;">

      <tr valign="top" style="background-color: navajowhite;">
        <td style="text-align: left; font-size: 10pt;">RELATED CONTENT</td>
      </tr>
    </table>

			
    </td>
  </tr>
</table>

Slideshow Example

Here's the first slide. Here's the link to the second slide.
Here's the second slide. Here's the link to the third slide.
Here's the third slide. Here's the link to the first slide.

[Click to Hide CodeClick to View Code]

<div style="border: 1px solid black; padding: 5px;">

<div id="slideContent1" class="morphcontent">Here's the first slide. <span id="slideLink2" class="morphlink showhidetext" data-correspondingcontent="slideContent2">Here's the link to the second slide.</span> </div>

<div id="slideContent2" class="morphcontent hiddentext">Here's the second slide. <span id="slideLink3" class="morphlink showhidetext" data-correspondingcontent="slideContent3">Here's the link to the third slide.</span></div>

<div id="slideContent3" class="morphcontent hiddentext">Here's the third slide. <span id="slideLink1" class="morphlink showhidetext" data-correspondingcontent="slideContent1">Here's the link to the first slide.</span></div>

</div>

See also