Log in

View Full Version : BB Code Enhancements - Inline Hover Spoiler BB Code (like Something Awful and Reddit)


Fangs404
02-29-2012, 11:00 PM
I posted this version of the spoiler BB code for vB 3.7 and 3.8, and it was well received, so I figured I'd bring it to vB 4, too.

Having been a member of Something Awful for a while, I've grown to really like their spoiler BB code. Reddit has the same spoiler code. I searched around, but I couldn't find a similar spoiler for vB. Every single spoiler tag I saw requires that you either click a button (which doesn't allow inline spoilers) or highlight text (which requires unnecessary work). I wanted to mimic SA's and Reddit's simple spoiler code on my forum, so this is what you see here. This mod is completely theme-independent (it's just a BB code, nothing else!), and it'll keep your site W3C compliant.

Without hovering, you see nothing but black:
https://vborg.vbsupport.ru/attachment.php?attachmentid=88188&stc=1&d=1224134837

However, when you hover the mouse over the black section of text, it magically appears:
https://vborg.vbsupport.ru/attachment.php?attachmentid=88187&stc=1&d=1224134837

Title: Spoiler
BB Code Tag Name: spoiler
Replacement: <span style="color: #000000; background: #000000;" onmouseover="this.style.color='#FFFFFF';" onmouseout="this.style.color='#000000';">{param}</span>
Example: THIS TEXT IS SPOILERED LOL
Description: This tag changes the text into a black box which is unreadable. If you hover the mouse over the black box, the text will magically appear.
Use Option: No
Image: https://vborg.vbsupport.ru/attachment.php?attachmentid=136770&stc=1&d=1330717187

Note: Depending on your template, you may need to change the colors in the HTML replacement code. Just make sure that color, background, and onmouseout match and that onmouseover is different. The colors in the above code should work just fine for styles with a light background and dark text.

Fangs404
03-02-2012, 06:48 PM
Just updated the image to be vB4 compatible. vB3 wanted 21x20 images, and vB4 wants 16x16 images.

EvilArcana
03-16-2012, 12:50 PM
Is there any way to get the spoilered text to not show up in any Most Recent Posts widgets?

Fangs404
03-19-2012, 03:31 AM
Is there any way to get the spoilered text to not show up in any Most Recent Posts widgets?
Can you give me an example? It sounds like that's a bug with the widget not properly rendering BB code.

Alan_SP
04-01-2012, 12:39 AM
I really like it. :up:

ptceuro
04-04-2012, 12:29 AM
Thank's
I really like it.

midnightpariah
05-30-2012, 03:41 PM
A fantastic solution for a spoiler BB code! You've even provided an elegant button. Thank you so much!

One issue I encountered is in vB's Mobile skin on an iPhone (Safari). For some reason, the text receives a white dropshadow, making it legible while "hidden" and thus somewhat defeating its purpose. This problem does not exist in the normal fullsite vB skin on an iPhone, nor is it present in the Mobile skin when viewed from a computer with IE9.

Fangs404
06-18-2012, 04:21 AM
A fantastic solution for a spoiler BB code! You've even provided an elegant button. Thank you so much!

One issue I encountered is in vB's Mobile skin on an iPhone (Safari). For some reason, the text receives a white dropshadow, making it legible while "hidden" and thus somewhat defeating its purpose. This problem does not exist in the normal fullsite vB skin on an iPhone, nor is it present in the Mobile skin when viewed from a computer with IE9.
Hm, would you mind providing a screenshot? If this only happens in mobile Safari, it might just be an iPhone problem. Perhaps the iPhone isn't capable of rendering the text the way a browser with a mouse can.

oldfan
05-24-2023, 11:28 PM
works 4.2.6 php 7.2