PDA

View Full Version : BB Code Enhancements - Custom Spoiler


orange gold
04-17-2009, 10:00 PM
please leave feedback

...

The following bbcode creates a spoiler which allows you to give a button a title then when the button is pressed it reveals the text inside

Title:
Spoiler
BB Code Tag Name
Spoiler
Replacement:
<div>
<div class="pre-spoiler">
<input type="button" value="{option}" style="width:450px;font-size:14px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName(' div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = '{option}';}">
</div>
<div>
<div class="spoiler" style="display: none;"><div style="border: 1px solid ;">{param}</div></div>
</div>
</div>

Example:
enter your text here
Description:
shows and hides text with the click of a button
Remove Tag If Empty: Yes


ENJOY!

Hornstar
04-18-2009, 05:21 AM
could you show a screen shot of before and after with the pressing of the button.

I just want to see how different this is to this: https://vborg.vbsupport.ru/showthread.php?t=207408

orange gold
04-18-2009, 05:40 AM
oh dang someone beat me.. anyways mine has a fancier button. no box below it when its hiding and you dont need to put quotes around the custom name, so its more user friendly
ill try to get a screen shot

orange gold
04-18-2009, 06:58 AM
added screenshots

Jasem
04-18-2009, 08:20 AM
thank you!

ExTincTi0N
04-19-2009, 02:25 AM
Great job there OG, I will use this probably, also btw its .RevO from irtl :hehe:

orange gold
04-19-2009, 02:57 AM
Great job there OG, I will use this probably, also btw its .RevO from irtl :hehe:
hehehehhehehehhehehehehhehehhahahahahahhaohohohoho hohohohoho!

mystikmedia
04-19-2009, 02:35 PM
I am getting an error with this: "Expected ;". The button shows, but nothing happens when clicked.

orange gold
04-19-2009, 03:28 PM
perhaps you entered a ' in the button title which is throwing off the code. or maybe you copy pasted it over weird

mystikmedia
04-19-2009, 03:35 PM
Thank you. Yes, it had "Here's" in it. Is there a fix for that?

orange gold
04-19-2009, 08:56 PM
is far as i know that can not be fixed because any browser would take it in as html... but ill work on it. thankyou for the feedback

mystikmedia
04-19-2009, 11:32 PM
Thanks. Look forward to hearing if you find a work-around. :)

orange gold
04-20-2009, 02:25 AM
no problem. i need this fixed for my own forum as well hehe
edit: also if anyone else here finds a work around here before me please post it here so i can fix my code and give credit to you in this thread

tspaetten
09-06-2009, 01:15 PM
Installed

Hey mate thanks for this, i have a quick ? is possible to change the color of the button, i cant figure it out. So please let me know, :D

tonyzhou
01-09-2010, 09:58 PM
XSS

test

click button twice

Mr. Flowers
02-02-2011, 11:57 PM
I installed it but removed the pre-spoiler as it was so annoying on my forum. The button was huge aswell so I reduced the size.
It works great though and is so easy to install thanks!