PDA

View Full Version : BB Code Enhancements - Special Spoiler


Derek Chai
01-24-2009, 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
01-25-2009, 05:47 PM
*Reserved*

Hornstar
01-25-2009, 09:19 PM
Quite a simple spoiler. i'm pretty sure there are many already on the site that have this, but one which has usergroup permissions would be nice.

Derek Chai
01-26-2009, 01:57 AM
Trythe bbcode permissions mod?

imaroot
01-30-2009, 09:45 AM
installed

sandt38
02-03-2009, 02:24 AM
It didn't work for me.

DonHouston
02-03-2009, 03:44 AM
how could i make this NWS instead of spoiler, just rename everything?

ottawamom
02-03-2009, 03:45 PM
Won't work for me either.

Derek Chai
02-03-2009, 10:17 PM
Hmm, I'm sure I fixed it.. Link to one that doesn't work? Also to replace the NWS name you can change "Click to show spoiler" to what you want and "Click to hide spoiler"

Jasem
03-23-2009, 08:08 PM
Good, installed

duditas
04-02-2009, 12:19 AM
Installed. Thanx :)

odln018
04-15-2009, 01:22 PM
Thanks, installed.

marianoblesa
05-04-2009, 02:31 AM
Thanks, installed.

vdinh
05-14-2009, 05:32 PM
Great spoiler! I like it simple :)
Derek, is there a way to make the NWS name line move all the way to the bottom of the post (instead of on top like now) once somebody clicks on it to open the whole message. That way, once a user reaches the end of the post, he/she can click the NWS line again to hide it.

adnoid
05-21-2009, 08:59 PM
Installed, works great.

Made a slightly modified duplicate & edited it for use with NSFW content as well!

viper357
09-03-2010, 07:24 AM
edit: nevermind, my stupidity.

Works great, thanks.