MyBB Community Forums

Full Version: Folders via MyCode?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Right now we've got this regex:
\[folder=(.*?)](^$)*(.*?)(^$)*\[/folder\]

and this replacement:
<button title="Click to show/hide" type="button" onclick="if(document.getElementById('spoiler') .style.display=='none') {document.getElementById('spoiler') .style.display=''}else{document.getElementById('spoiler') .style.display='none'}">$1</button>
<div id="spoiler" style="display:none">
$3
</div>

The result kinda works as intended, but only if the page contains only one folder. If there's more than one, clicking any button only opens/closes the first one on the page.

How do we change this?
Try basing it on the <details> element: https://developer.mozilla.org/en-US/docs...nt/details
Oh, that works much better, thank you!