PDA

View Full Version : Spoiler BBCode


Fleiding
07-07-2017, 05:23 PM
Hi,

I have recently migrated from vB4 to vB5 and one of my members let me know that it isn't possible anymore to preview a post and see the hidden content in our Spoiler BBCode.

This is the replacement I'm using (which looks like this (http://i.imgur.com/xHCDr98.png)):

<div style="padding: 3px; font-size: 1em;"><div style="text-transform: uppercase; margin-bottom: 3px; font-size: 0.8em; font-weight: bold;"><span 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.innerHTML = '<b>{option}: </b><a href=\'#\' onClick=\'return false;\'>Verberg</a>'; } else { this.parentNode.parentNode.getElementsByTagName('d iv')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>{option}: </b><a href=\'#\' onClick=\'return false;\'>Toon</a>'; }" /><b>{option}: </b><a href="#" onClick="return false;">Toon</a></span></div><div class="quotecontent"><div style="display: none;">{param}</div></div></div>

Can someone assist me with editing the replacement so the design stays the same, but members can preview a post and still see the hidden content?

Thanks,
Rob

noypiscripter
07-07-2017, 09:46 PM
The code seems fine in most cases but if the spoiler text has single quotes in it, then the Javascript would break and would cause the "Verberg" to not show up. And if the spoiler text has double quotes in it, then it would totally break the functionality of the BBCode.

I have the same BBCode on my site and it doesn't have this issue.

Fleiding
07-08-2017, 07:45 AM
Thanks Glenn!