Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: ResizeR on May 15, 2012, 12:26:45 PM

Title: Spoiler-BBCode in same line
Post by: ResizeR on May 15, 2012, 12:26:45 PM
Hi,

I want this Quick Spoiler MOD/BBCode (http://custom.simplemachines.org/mods/index.php?mod=2940) to be setted in the same line.

I want to be able to Write text inbefore the spoiler box. Like this:
Text text text [Spoiler]Spoilerteeext[/spoiler]

Quick example:
Text text text (http://www.abload.de/img/sdfsdfpszzn.png)

I'd tried to figure out, but I couldn't find the place in the source code, where it adds a new line.
Title: Re: Spoiler-BBCode in same line
Post by: All Colours Sam on May 15, 2012, 01:14:19 PM
Hi, welcome to SMF.

It seems that mod uses a div to generate the spoiler content, this means it will always be displayed on a new line unless you do some changes and wrap the previous text in another div and use floats properties, but is a mess to do it like that.

The best you cna do is change the div for a span in Subs-QuickSpoiler.php  and set some css on the span to be treated as an inline display.

Keep in mind that this will not always work, depending on how long the previous text is or how small is the user resolution the spoiler will be displayed on a new line.
Title: Re: Spoiler-BBCode in same line
Post by: emanuele on May 15, 2012, 01:28:03 PM
Quote from: Suki on May 15, 2012, 01:14:19 PM
The best you cna do is change the div for a span in Subs-QuickSpoiler.php  and set some css on the span to be treated as an inline display.
/me is in picky mode. :P

Using a span if you "spoiler" a table you will get invalid xhtml.
style="display:inline"
should do the same...I hope...
Title: Re: Spoiler-BBCode in same line
Post by: All Colours Sam on May 15, 2012, 01:53:34 PM
Yes, I don't use span because a spoiler is basically a content wrap and that is precisely what a div do.  There is a lot of things you cannot put inside a span tag.
Title: Re: Spoiler-BBCode in same line
Post by: ResizeR on May 15, 2012, 03:25:11 PM
I tried to replace the div's with span's additional fixed some stylebugs with CSS and i'm happy with it.  :)
You just made my day!
thanks for helping :)
Title: Re: Spoiler-BBCode in same line
Post by: MrPhil on May 16, 2012, 10:43:43 AM
If the desire is to have the spoiler "anchor" be in-line text and graphics in a <span>, rather than a <div>, perhaps it could be done with a link <a> that pops up a new floating window? You might look at various "fancy tool tip" and "lightbox" PHP codes. I think both of them generate Javascript, so at least part of the action is taking place on the browser. They may just use "onClick" rather than <a>.

A very simple minded system could probably be done with a Javascript function per spoiler (or a unique identifier to a shared function), onClick trigger in a <span>, and the function just puts up an alert box with your spoiler text. You'd probably accumulate the functions (or one function with text for all spoilers) to stick at the end of the output page.