MyBB Community Forums

Full Version: simple spoiler code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I was using a spoiler code on my phpbb3 .. i converted it for MyBB... i hope it may be of help... also plz tell if it has any security issue (i don't think so)

Regular Expression
\[Spoiler](.*?)\[/Spoiler\]

Replacement
<div style="margin:20px; margin-top:5px">
    <div class="smallfont" style="margin-bottom:2px"><b>Spoiler!</b> : <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;">
   $1
    </div>
    </div>
    </div>

Thanks for the simple spoiler code. I just added it to my site.