PDA

View Full Version : BB Code Enhancements - Special Spoiler


Derek Chai
06-16-2008, 10:00 PM
PLEASE CLICK INSTALL (https://vborg.vbsupport.ru/vborg_miscactions.php?do=installhack&threadid=182791)




Since nobody would do it for me I have coded it myself. First go add a new BBCode

Title:Spoiler

BB Code Tag Name Spoiler

Replacement:
<script language='JavaScript' type='text/javascript'>
<!--
function spoiler(obj)
{
for (var i = 0; i < obj.childNodes.length; i++)
{
if (obj.childNodes[i].id == 'idTitle')
titleRow = obj.childNodes[i];
if (obj.childNodes[i].id == 'idSpoiler')
{
if (obj.childNodes[i].style.display != 'none')
{
obj.childNodes[i].style.display = 'none';
titleRow.innerHTML = '&nbsp;<b>Click to show spoiler</b>';
}
else
{
obj.childNodes[i].style.display = 'block';
titleRow.innerHTML = '&nbsp;<b>Click to hide spoiler</b>';
}
}
}
}
//--></script>
<div width="100%" class="alt1" onclick="spoiler(this);" style="border-collapse: collapse; border: solid thin black;"><div id="idTitle" class="alt2" style="border-collapse: collapse; border: solid thin black; width: 100%;">&nbsp;<b>Click to show spoiler</b></div><div id="idSpoiler" style="display: none;">{param}</div></div><br />

Example: Derek rules!

Description: Creates and hides text.

Remove Tag If Empty: Yes

DEMO: http://forum.i628.net/showpost.php?p=12&postcount=3 (If it's down it's probably due to host problems. Please look at screenshot instead if down.

Derek Chai
06-17-2008, 08:50 PM
Reserved.

TWTCommish
06-18-2008, 01:46 PM
This produces an "Object expected" JavaScript error for me using IE 6 and FF 2.

Derek Chai
06-21-2008, 02:38 AM
I think you might not have added the full code.