MyBB Community Forums

Full Version: [MyCode] Simple Text Spoiler Tag/Steam-like text spoiler tag.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This is pretty simple to do and I highly apologize if a thread like this already exists.

Anyway, let's get to it:

Step 1: Go to Admin CP ---> Configuration ---> MyCode (You'll find it to the left in the sidebar) ---> Add New Mycode

Step 2, configure your MyCode:

Title:
It doesn't matter, write whatever you want.

Short Description:
Again, it doesn't matter, write whatever you want

Regular Expression: Type this: \[spoiler\](.*?)\[/spoiler\]

Replacement: Type this:  <div id="spoiler">$1</div>

Enabled?: Yes. (Obviously)

So now you're done with the configuration. Time for some css.

Step 3, writing some very simple css:

Now go to: Admin CP ---> Templates & Style ---> Click on your theme: By default it should be Default or MyBB 1.8. ---> Add Stylesheet

File name: The name doesn't really matter but makes sure you end the name with .css

Attached to:
Globally

And then choose: Write my own content.

Now write this code:


#spoiler {
  display:inline-block;
  color: black;
  background-color: black;
  
}

#spoiler:hover {
  display:inline-block;
  color: white;
  background-color: black;
  
}

Press Save stylesheet.

And now you are done! Please note that in the text editor when you make posts/topics you will only see the spoiler text as code but once you post your thread/post the text should be a black box that shows the text when you hover over it.

Edit: Just in case anyone was confused, to use this code you write: [spoiler]*Your text here*[/spoiler].
nice tutorial dude....
The code doesn't show up in my editor.
(2015-01-22, 03:53 PM)user25 Wrote: [ -> ]The code doesn't show up in my editor.

There wont be a button for your code. You have to write the code manually.
It worked one time then when I tried to change spoilers to kuro on all instances (mycode, css) it won't hide the text so I reverted to using the original ones but it seems like it won't hide the text anymore.