[ XF9 ]

Spoiler Plugin for phpBB

Posted on in Code.

This is a plugin for your phpBB Forum to hide/show content depending on your needs

There is no styling involved – add it directly or modify your theme accordingly.
Tested with version 3.0.12 and 3.1.3, should work in any other version too.

BBCode Usage:

[spoiler]{TEXT}[/spoiler]

HTML Replacement:

<div class="spoiler">
	<button class="spoilerbutton" onclick="parent = this.parentNode.getElementsByTagName('div')[0].style; if(parent.display != 'block') { parent.display = 'block';} else { parent.display = 'none';}" type="button">Spoiler</button>
	<div class="spoilertext" style="display: none;">{TEXT}</div>
</div>

Help Line:

Hidden text: [spoiler]hidden text here[/spoiler]

Explanation:
The markup consists of a button to toggle the spoiler text and a div which contains the said text. Upon clicking at the button it will access the div containing the spoiler text, check it’s display status and change it to show/hide it. That’s it :)


Write a reply or comment

Your email address will not be published.