MyBB Community Forums
simple spoiler code - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Resources (https://community.mybb.com/forum-8.html)
+--- Forum: MyCodes (https://community.mybb.com/forum-117.html)
+--- Thread: simple spoiler code (/thread-79493.html)



simple spoiler code - drankur - 2010-10-02

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>




RE: simple spoiler code - Andrew B. - 2011-03-26

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