+ Reply to Thread
Results 1 to 14 of 14

Thread: My favorite BB code - A javascript spoiler

  1. #1

    Default My favorite BB code - A javascript spoiler

    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:

    Code:
    <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('div')[1].getElementsByTagName('div')[0].style.display = '';		this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[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: [spoiler=Episode 2]He Gets Killed![/spoiler]

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

    Use {option}: Yes


    Screenshots

    Example code:


    Spoiler in its closed state:


    Spoiler when open


    Images CAN be hidden within this

  2. #2

    Default

    Very nice. I have seen many requests for this.

    Thanks

  3. #3
    Moody Admin Peggy is on a distinguished road Peggy's Avatar
    Join Date
    Jan 2005
    Location
    NE Ohio
    Age
    50
    Posts
    12,414

    Default

    I think someone, semann I think it was, posted something like this in his bb codes thread.

  4. #4

    Default

    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.

  5. #5

    Default

    Yes, I use that, maybe a bit different. My code is this:

    Code:
    <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('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Nascondi'; } else { this.parentNode.parentNode.getElementsByTagName('div')[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>

  6. #6

    Default

    ... but do any of these methods work with the thread preview?

  7. #7

    Default

    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?

  8. #8

  9. #9

    Default

    Wonderful bit of code, works great!

  10. #10

    Default

    Nice thread! but i don't know where can i put it in?

  11. #11

    Default

    Quote Originally Posted by towermatt View Post
    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.

  12. #12

    Default Help

    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:

    [spoiler] Whatever [/spoiler]

    Or for posters to have the option and put:

    [spoiler=Lotto Numbers] 32 45 89 [/spoiler]

    If they want to.

    Is this possible?

    AO

  13. #13

    Default

    Quote Originally Posted by Arrogant-One View Post
    I have a question.

    Can I have multipe tags to make the spoiler work?

    For instance, presently its

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

    I would prefer an additional tags, being:

    [spoiler] Whatever [/spoiler]

    Or for posters to have the option and put:

    [spoiler=Lotto Numbers] 32 45 89 [/spoiler]

    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
    [spoiler] The answer is 13 [/spoiler]

    or

    when they type

    [spoiler=Answer] The answer is 13 [/spoiler].

    Is this possible? Please, somebody?

  14. #14

    Default

    Thanks I just installed this now and it works very nicely

    One of the best Spoiler codes I have seen.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. BB Code - Spoiler Tag
    By Pyrofyr in forum vBulletin Modifications prior to version 4.0
    Replies: 17
    Last Post: 09-08-2008, 09:11 AM
  2. BBcode - Advanced Spoiler Code
    By iltbashm in forum vBulletin Modifications prior to version 4.0
    Replies: 6
    Last Post: 06-23-2008, 05:28 PM
  3. spoiler tag BB code problem
    By the noob in forum vBulletin Discussion and Questions
    Replies: 0
    Last Post: 03-25-2008, 07:01 PM
  4. *Need Help Installing Bot, plus javascript code*
    By Scott X in forum vBulletin Discussion and Questions
    Replies: 7
    Last Post: 09-29-2007, 10:44 PM
  5. I need to put javascript Code...
    By Scott X in forum vBulletin Discussion and Questions
    Replies: 4
    Last Post: 09-09-2007, 09:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts