Thursday, August 22, 2013

Creating Easy Spoiler Code for MyBB

Creating Easy Spoiler Code for MyBB. 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.

Follow the tutorial below :

  • Go to your forum’s Admin CP
  • Configuration
  • MyCode
  • Add New MyCode
  • Put in “Spoiler” as your Title and “Spoiler button” as your Short Description.
  • For the Regular Expression field, add the following:
\[spoiler\](.*?)\[/spoiler\]


next in the Replacement field, add this:
<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>


Save the new MyCode, you just created a MyBB spolier.
Here’s the results for the MyBB spoiler:



The spoiler is very customizable, you can adjust the width, font size, border size, border color, etc. Simply use the

$1
MyCode to use the new spoiler in your forum.

It is Creating Easy Spoiler Code for MyBB, Hopefully can help you.

thumbnail Title: Creating Easy Spoiler Code for MyBB
Posted by:Stuard Van
Published :2013-08-22T11:00:00-07:00
Rating: 5
Reviewer: 5 Reviews
Creating Easy Spoiler Code for MyBB
Share :
Related articles:

1 comment :