MyBB spoiler MyCode you can easily customize WITHOUT a plugin.
A popular forum BBCode for forums has been the spoiler code, the button you create that can hide everything in your post, such as text, images, videos, etc. For MyBB, this does not come as a default BBCode (or MyCode), and must be manually coded into the MyBB powered forum. There have been a few plugins but some of them can be a bit buggy and sometimes needs updates when a new version of MyBB comes out, so instead of using plugins, here’s some MyCode you can use to create a MyBB spoiler that doesn’t require a plugin and can be used no matter what version of MyBB you’re using.
MyBB Spoiler MyCode Tutorial
1. Go to your forum’s Admin CP > Configuration > MyCode > Add New MyCode.
2. Put in “Spoiler” as your Title and “Spoiler button” as your Short Description.
3. For the Regular Expression field, add the following:
4. In the Replacement field, add this:
5. Save the new MyCode, you just created a MyBB spolier
The spolier is very customizable, you can adjust the width, font size, border size, border color, etc. Simply use the [spoiler]your MyBB spoiler message here[/spoiler] MyCode to use the new spoiler in your forum.
A popular forum BBCode for forums has been the spoiler code, the button you create that can hide everything in your post, such as text, images, videos, etc. For MyBB, this does not come as a default BBCode (or MyCode), and must be manually coded into the MyBB powered forum. There have been a few plugins but some of them can be a bit buggy and sometimes needs updates when a new version of MyBB comes out, so instead of using plugins, here’s some MyCode you can use to create a MyBB spoiler that doesn’t require a plugin and can be used no matter what version of MyBB you’re using.
MyBB Spoiler MyCode Tutorial
1. Go to your forum’s Admin CP > Configuration > MyCode > Add New MyCode.
2. Put in “Spoiler” as your Title and “Spoiler button” as your Short Description.
3. For the Regular Expression field, add the following:
Kod:
[spoiler](.*?)[/spoiler]
4. In the Replacement field, add this:
Kod:
<div>
<input type="button" value="Show Spoiler" style="width:80px;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 Spoiler'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Show Spoiler';}">
</div>
<div>
<div style="background: #ffffff;margin: 0 15px 15px 15px;padding: 5px;border: 1px solid black;display: none;">
$1
</div>
</div>
</div>
5. Save the new MyCode, you just created a MyBB spolier
The spolier is very customizable, you can adjust the width, font size, border size, border color, etc. Simply use the [spoiler]your MyBB spoiler message here[/spoiler] MyCode to use the new spoiler in your forum.