vBulletin

Thank you for visiting. This is our website archive. Please visit our main website by clicking the banner above.
vBulletin FAQ is dedicated to helping the forum owner build, manage and profit from his vBulletin Forum
vBulletin Web Hosting - Free skins and styles for your vBulletin - Search Engine Optimization




My favorite BB code - A javascript spoiler

dchapman
07-06-2006, 07:05 PM
This is by far the most useful BB code I have ever used. It is used heavily on every one of my forums, including dev forums. It's a javascript spoiler.

Title: Spoiler

Tag: Spoiler

Replacement:

<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler</b> for <i>{option}</i>: <input type="button" value="Show" style="width:45px;font-size:10px;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.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
{param}
</div>
</div>
</div>

Example: He Gets Killed!

Description: Use this to hide important information which might spoil a movie, program, etc for other users.

Use {option}: Yes


Screenshots

Example code:
http://img3.zoints.com/screens/s1.png

Spoiler in its closed state:
http://img3.zoints.com/screens/s2.png

Spoiler when open
http://img3.zoints.com/screens/s3.png

Images CAN be hidden within this :)

noppid
07-06-2006, 08:12 PM
Very nice. I have seen many requests for this.

Thanks

Peggy
07-06-2006, 08:40 PM
I think someone, semann I think it was, posted something like this in his bb codes thread.

noppid
07-06-2006, 09:46 PM
You are correct. As with everything, there is more then one way to skin a cat. Both are very good ways to get the job done.

Norman
07-07-2006, 07:54 AM
Yes, I use that, maybe a bit different. My code is this:

<div style="margin:5px 20px 20px 20px">
<div class="smallfont" style="margin-bottom:2px"><b>Spoiler:</b> <input type="button" value="Mostra" style="width:80px;font-size:10px;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 = 'Nascondi'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Mostra'; }"></div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
{param}
</div>
</div>

KW802
07-07-2006, 08:11 AM
... but do any of these methods work with the thread preview?

louisianna
03-20-2007, 07:49 PM
hmm. i can't quite get this to work either. i'm running 3.6.2 maybe i don't have something checked or turned on to get it to work?

hakan_72_123
05-02-2007, 10:29 PM
Very nice.Thanks

towermatt
12-18-2007, 04:07 PM
Wonderful bit of code, works great!

windows vizta
12-25-2007, 09:44 AM
Nice thread! but i don't know where can i put it in?

Arrogant-One
03-12-2008, 11:47 PM
Wonderful bit of code, works great!
Agreed. I love this new bb spoiler code. Thanks heaps. I'd click install if there was an install icon.

Arrogant-One
04-17-2008, 06:37 PM
I have a question.

Can I have multipe tags to make the spoiler work?

For instance, presently its

[spoil=Puzzle] Answer to Puzzle [/spoiler]

I would prefer an additional tags, being:

Whatever

Or for posters to have the option and put:

32 45 89

If they want to.

Is this possible?

AO

Arrogant-One
06-19-2008, 11:14 PM
I have a question.

Can I have multipe tags to make the spoiler work?

For instance, presently its

Answer to Puzzle

I would prefer an additional tags, being:

Whatever

Or for posters to have the option and put:

32 45 89

If they want to.

Is this possible?

AO

Guys,

Any help to my query above would be appreciated. Basically I just want the spoiler tags to work when someone types
The answer is 13

or

when they type

The answer is 13 .

Is this possible? Please, somebody?


vBulletin

seo book

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum