howtothings.co.uk
How to add spoiler tags to your forum [MyBB 1.4 / 1.6 / 1.6.4] - Printable Version

+- howtothings.co.uk (https://www.howtothings.co.uk)
+-- Forum: Computing (https://www.howtothings.co.uk/forumdisplay.php?fid=4)
+--- Forum: Website Development, Implementation and General Webmaster Support (https://www.howtothings.co.uk/forumdisplay.php?fid=9)
+--- Thread: How to add spoiler tags to your forum [MyBB 1.4 / 1.6 / 1.6.4] (/showthread.php?tid=1006)



How to add spoiler tags to your forum [MyBB 1.4 / 1.6 / 1.6.4] - Mark - 25-09-2011

How to add spoiler tags to your forum [MyBB 1.4 / 1.6 / 1.6.4]

A really easy way to add [spoiler] tags to your forum.

1) Go to your Admin CP > Configuration > MyCode > Add new MyCode

Title: Spoiler
Short Description: Spoiler
Regular Expression:
Code:
\[spoiler\](.*?)\[/spoiler\]
Replacement:
Code:
<div style="margin:20px; margin-top:5px"><div class="quotetitle"><input class="button2 btnlite" type="button" value="View Spoiler" style="text-align:center;width:115px;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 Spoiler'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'View Spoiler'; }" /></div><div class="quotecontent"><div style="display: none;">$1</div></div></div>
Enabled: Yes

You could add the replacement to your CSS file and link it that way but this is the easy way.

Result: [spoiler]This is a spoiler[/spoiler]


RE: How to add spoiler tags to your forum [MyBB 1.4 / 1.6 / 1.6.4] - Drumm - 25-09-2011

I liked it before