Topic: Mod: Add [spoiler] tag

I saw another post in here in regards to adding a spoiler tag so I went and used some code I found and modded it to my liking.

Demo: http://forums.programming-designs.com/v … p?pid=4248

Instructions

Step 1. Open parser.php

Step 2.
Find:

                '[img]$1[/img]',

After add:

                '[spoiler]',
                '[/spoiler]',

Step 3.
Find:

                     '#\[email=([^\[]*?)\](.*?)\[/email\]#',

After add:

                     '#\[spoiler\](.*?)\[/spoiler\]#',

Step 4.
Find:

                     '<a href="mailto:$1">$2</a>',

After add:

                     '<div class="spoiler" onmouseover="this.style.height=\'auto\';" onmouseout="this.style.height=\'20px\';"><b>Spoiler:</b> <i>Hover to reveal text</i><br /><br />$1</div>',

Step 5. Upload parser.php

Now for each style sheet you'll need to add the following:

.spoiler{
    height: 20px;
    overflow: hidden;
    border: 1px solid #ccc;
    background-color: #fafafa;
}
DIV.spoiler {MARGIN: 5px 15px 15px 15px; PADDING: 8px}

All done. Hope you enjoyed smile

Re: Mod: Add [spoiler] tag

And if the reader doesn't have javascript on its UA? roll

Re: Mod: Add [spoiler] tag

Jérémie wrote:

And if the reader doesn't have javascript on its UA? roll

Then too bad. Until the day W3C adds the :hover class to div classes then javascript will have to do xD

I don't like using javascript myself but nowadays people are using it more and more -- loads of web applications use javascript and browser compatibility is getting really good when it comes to javascript.