(Ask) How to make a spoiler?
#1
ask: how to make a spoiler (open / closed) in MyBB?

This example:[Image: Capture.png]
Reply
#2
Go to ACP> Configuration and on the left hand side of the screen click on 'MyCode'

Once in there go to 'Add new code' and enter this into the fields:

Regular expression:
\[spoiler\](.*?)\[/spoiler\]


Replacement:
<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>


Attached Files Thumbnail(s)
   
Reply
#3
(2017-02-14, 08:55 AM)Nemus Wrote: Go to ACP> Configuration and on the left hand side of the screen click on 'MyCode'

Once in there go to 'Add new code' and enter this into the fields:

Regular expression:
\[spoiler\](.*?)\[/spoiler\]


Replacement:
<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>
I've done it like that, but not running

This is the result when I add the code


Attached Files Thumbnail(s)
   
Reply
#4
Looks like you use the [ code ] tag, not [ spoiler ]
Tchat en français
Do not ask me help through PM or Discord

Reply
#5
I've tried the code, only the result as Tag, I mean spoiler can be opened and closed
Reply
#6
You can also try spoiler plugin instead of using Mycode :-
https://community.mybb.com/mods.php?action=view&pid=143

Though Mycode is also okay.

Regards
WallBB
- MyBB Heart
Reply
#7
You have used the code tag, not [spoiler] text here [/spoiler]

To use it, you have to use the spoiler code which is:

 [spoiler]ENTER TEXT HERE[/spoiler]
Reply
#8
Try this one:

https://community.mybb.com/mods.php?action=view&pid=614

Others have to work too, but this add button to sceditor and stylesheet to customize spoilers.

And finally texts to multilang support, eable three types of spoilers.

So this oe should work i have it into localhost with 1.8.11 and on my site with another lesser version of m ybb but it works in all mybb 1.8.x series of mybb.
The only infinite thing is the universe and human stupidity, but the universe is not for sure

Plugins 1.6.x

Plugins 1.8.x

Reply
#9
Iv'e got this working great but having trouble adding it to the editor bar were the other codes and smiles are. (I'm a pure noob to Mybb)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)