Page 1 of 2 12 LastLast
Results 1 to 10 of 20

Thread: BB Code - Spoiler Tag

  1. #1
    New to vBFAQ
    Join Date
    Mar 2007
    Posts
    13

    BB Code - Spoiler Tag

    Hey, decided to post this here, it's a spoiler tag, easy to use, and can be opened and closed. ;]

    Very easy install since it's BB Code.

    Title : Spoiler

    Tag : spoiler

    Replacement :
    <div style="margin: 5px;">
    <div class="smallfont" style="margin-bottom: 2px;">
    <b>Spoiler!</b> <input value="Show" style="margin: 0px; padding: 0px; width: 45px; font-size: 10px;" onclick="if(this.parentNode.parentNode.getElements ByTagName('div')[1].getElementsByTagName('div')[0].style.display != 'inline'){ this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'inline'; this.innerText = ''; this.value = 'Hide'; }else{ this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value='Show'; }" type="button">
    </div>
    <div class="alt2" style="border: 1px inset ; padding: 6px;">
    <div class="spoiler" style="display: none;"></div>
    </div>
    </div>
    Example : [spoiler] Halo Thar~![/spoiler]

    Description : Used to hide spoilers. Don't ruin the ends of movies, games, etc for those who haven't seen it yet!

    Screenshot: Almost forgot it >.o;


  2. #2
    Moody Admin Peggy's Avatar
    Join Date
    Jan 2005
    Location
    Youngstown, OH
    Posts
    12,402
    These spoiler tags can be fun.
    Thanks for posting it here.

  3. #3
    New to vBFAQ
    Join Date
    Mar 2007
    Posts
    13
    No prob, I figure if you change the word Spoiler, you can even use them for other things as well, like hiding and expanding general content. So it can be an all around thing.

    I'm gonna mess around with more BB Codes later on today and post what I come up with.

  4. #4
    Moody Admin Peggy's Avatar
    Join Date
    Jan 2005
    Location
    Youngstown, OH
    Posts
    12,402
    Great, I'll be looking for it.

  5. #5
    Experienced vBulletin User
    Join Date
    Jul 2006
    Posts
    259
    Tried the above code in 3 different styles including the vBulletin default style. It did not work. I could see three typos in the code, correcting these did not solve the problem.

    line 4 getElements ByTagName <- extra space
    line 5 getElementsByTagName('d iv') <- extra space
    line 6 getElementsByTagName('d iv') <- extra space
    line 9 1px inset ; <- extra space


  6. #6
    New to vBFAQ
    Join Date
    Mar 2007
    Posts
    13
    Don't think it makes much of a difference, but what version are you running? I'm using 3.6.4 and it works perfectly fine for me.

    Oh, and if you took that out, it's not extra code.
    I used it to fix a visual problem I was having before with it.

  7. #7
    hmm. can't get this to work either. I'm running 3.6.2

  8. #8
    Experienced vBulletin User
    Join Date
    Jul 2006
    Posts
    259
    Tried the code on two separate installations. It does not work on either, in any style. 8 styles tested in IE6, IE7 and Firefox
    Have installed a spoiler BB code from another Coder and it works immediately.

  9. #9
    New to vBFAQ
    Join Date
    Apr 2007
    Posts
    2
    Quote Originally Posted by protoss View Post
    ...Have installed a spoiler BB code from another Coder and it works immediately.
    Cool. We can't get this one to work either. Where's the one that you found that does work?

    Thanks!

  10. #10
    New to vBFAQ
    Join Date
    Apr 2007
    Posts
    2

    Smile

    Quote Originally Posted by protoss View Post
    Tried the above code in 3 different styles including the vBulletin default style. It did not work.
    Here's the fix for it. It does need all those typos fixed as you [and the unseen "Oda"] have proven.

    It also needs the crucial "{param}" tag to transfer the spoiler text to the bbcode handler. Here's the code w/ typos fixed and "param" in place:
    Code:
    <div style="margin: 5px;"> 
    <div class="smallfont" style="margin-bottom: 2px;"> 
    <b>Spoiler!</b> <input value="Show" style="margin: 0px; padding: 0px; width: 45px; font-size: 10px;" onclick="if(this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != 'inline') 
    { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'inline'; this.innerText = ''; this.value = 'Hide'; } 
    else 
    { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value='Show'; }" type="button">
    </div> 
    <div class="alt2" style="border: 1px inset; padding: 6px;"> 
    <div class="spoiler" style="display: none;">{param}</div> 
    </div> 
    </div>
    It is pretty cool. Thanks to Pyrofyr for the nifty start.

Similar Threads

  1. My favorite BB code - A javascript spoiler
    By dchapman in forum vBulletin Modifications prior to version 4.0
    Replies: 14
    Last Post: 01-31-2012, 05:46 PM
  2. BBcode - Advanced Spoiler Code
    By iltbashm in forum vBulletin Modifications prior to version 4.0
    Replies: 6
    Last Post: 06-24-2008, 12:28 AM
  3. spoiler tag BB code problem
    By the noob in forum vBulletin Discussion and Questions
    Replies: 0
    Last Post: 03-26-2008, 02:01 AM
  4. Spoiler vBCode
    By .Paradox in forum vBulletin Modifications prior to version 4.0
    Replies: 0
    Last Post: 12-21-2007, 07:51 PM
  5. Hide [code][/code] unregistered users
    By simplemind in forum General Internet Discussions
    Replies: 4
    Last Post: 08-22-2006, 11:30 AM

Posting Permissions

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