Jump to content

Spoiler Tag BBCode on File Comments


Arthmoor

Recommended Posts

Since this has been raised from the dead, I'd like to throw in my two pennies' worth. I help to run a phpBB3-based board, which allows us to create custom BBCodes. Since there's no default "spoiler" code I decided to go with a custom tag. Instead of trying to set the text color to the background, which would be almost impossible, since not only do alternate posts have different colored backgrounds, but we also allow several themes which have different background colors, as well, we use one which collapses a spoiler into a bar. Clicking on a button on that bar then expands or collapses that bar depending upon its current state. I think such a tag would work across all the Nexus boards identically and it should be possible to simply replace the current one, since the new behavior should be inherited by the old text.

 

Here's the html code we implemented ...

 


  •  
  • <div style="margin:20px; margin-top:5px"><div class="quotetitle"><b>Spoiler:</b> <input type="button" value="Click here to Show" style="width:110px;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 = 'Click here to Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Click Here to Show'; }" /></div><div class="quotecontent"><div style="display: none;">{TEXT}</div></div></div>
     

... where "{TEXT}" is the text entered between the spoiler tags.

 

I don't know if this would be useful or not, since I have no idea how you implement custom BBCodes on this software, but if it would work it might simplify any alterations you make to the spoiler tag in the future, since you wouldn't have to create a different one for each sub-site. Additionally, it doesn't matter how long the spoiler is, it will always take up just a single line in the post until it's been expanded, which I think is a significant plus to this sort of implementation. Additionally, the button is actually a toggle, so once a user has finished reading a lengthy spoiler he can simply collapse it, again, to get it out of the way.

Link to comment
Share on other sites

  • 3 years later...

Not quite...

 

Unfortunately, this is hidden text only when using the "White" theme. No good when using the "Underground" (Default) theme.

 

See for yourself. Use the "Change Theme" option in the lower-left corner of the page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...