Title: Spoiler Tag "V3" Post by: Exilis on September 12, 2009, 04:59:47 pm This spoiler tag is like the others, for a more in-depth explanation go to one of those. I just quickly modded it because it was requested by Andrew.
Basically, this code is much like V2- in V2, the user would type in [spoiler=Hello]Secret[/spoiler] and it would show the text "Hello" as a link, and when clicked would reveal the text "Secret". In V3, the code above ([spoiler=Hello]Secret[/spoiler]) would show the text "(show)" as a link, and under it would be "Hello" in italics, when (show) was clicked on it would reveal "Secret". I hope you get where I'm going with this; Preview is here. (http://codewatchers.smfforfree4.com/index.php/topic,1.0.html#msg8) Code: <script> var b = document.getElementsByTagName("div"); //Created by Agent Moose (smcodes.smfforfree3.com) for(x=0;x<b.length;x++){ if(b[x].className=="post" && b[x].innerHTML.match(/\[spoiler=(.*)\](.*)\[\/spoiler\]/i)){ b[x].innerHTML = b[x].innerHTML.replace("[spoiler=" + RegExp.$1 + "]" + RegExp.$2 + "[/spoiler]","<div><div><a href='javascript:void(0)' onclick='$(this).parent().next().toggle()'>(show)<br /></a><i>" + RegExp.$1 + "</i></div><div style='display:none' id='spoiler'>" + RegExp.$2 + "</div></div>"); };}; </script> Title: Re: Spoiler Tag "V3" Post by: Andrew on September 12, 2009, 06:06:08 pm Thanks a ton for making this Exilis! Ill add it as soon as EzPortal wants to work on my forum. O0 |