Hide BBCode

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Anti-Spam Guide
Raewyn
Registered User
Posts: 90
Joined: Fri Jun 04, 2004 12:10 am

Hide BBCode

Post by Raewyn » Sun Jun 29, 2008 8:51 pm

There was a [hide=TITLE]TEXT[/hide] tag written up for phpbb2 by EGIS which I used on my old forums to great extent, and it was great for collapsing a lot of the verbose stuff into sections, especially in writing sections where users would get together to write huge stories. However, all the similar bbcodes I can find for phpBB3 all use tables and/or some ugly button exclaiming, 'SPOILER! CLICK HERE TO EXPAND!' type deal.

What I am looking for is something nice, clean, simple; with the syntax above, [hide=TITLE]TEXT[/hide], with TITLE becoming a link (or not - that's the way it worked in phpBB2, I would actually prefer if it wasn't a link but was delineated in some way so that the TITLE text could actually be formatted by user preference by use of other bbcode. Maybe a small graphic or something to the left of TITLE that, when clicked, expands the TEXT? Whatever it is, TEXT would be hidden with formatting preserved until it is clicked, then it all collapsing once more when clicked again. With the ability to nest [hide] tags within each other.

The only link to EGIS' old mod that I could find was here: http://www.dragongem.org/InstalledMods/ ... _1.3.0.zip - all others seemed to turn up dead ends for me, including the ones on this site. Any and all help is hugely appreciated, I have a feeling that this is going to be more complicated than just a few entires in 'Add BBCode'.

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Sun Jun 29, 2008 11:09 pm

I knwo that is very descriptive but I am dislexic (really messes up help and scripting :O)...

From what I understand is you want something so that the poster could make text like one of these....
my own chosen text
something else i choose
just plain text but still custom by poster
And then once clicked opens a box under it that contains "TEXT" set by user like this...
my own chosen text
here is whatever the value of TEXT is and i got to set it all by myself xD
And then if I clicked on TITLE again it would hide it?

Basically what I get from it is you want users to be able to make their own spoilers

Raewyn
Registered User
Posts: 90
Joined: Fri Jun 04, 2004 12:10 am

Re: Hide BBCode

Post by Raewyn » Sun Jun 29, 2008 11:31 pm

Essentially, yes. So if [hide=TITLE]TEXTBLOCK: Lorem ipsum dolor sit amet, et cetera.[/hide]:
TITLE
would show first, with it being whatever text (formattable?) that the user inputs. Once it is clicked upon, it would expand underneath.
TITLE
TEXTBLOCK: Lorem ipsum dolor sit amet, et cetera.
And then when TITLE is clicked upon again, it all shrinks back down to just show:
TITLE
With nested [hide]s being possible, formatting of the TEXTBLOCK and whatnot, and the possibility of having TITLE formattable would be a huge plus, as it was not in the phpBB2 version I was using. Does that make sense? I know I don't put things into words very well sometimes. While convenient to use for spoilers and the like, it is also extremely convenient to use for large blocks of text, say, in a set of rules, in a large story post on an RPG board, or manually-posted stats for the same kind of thing.

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Sun Jun 29, 2008 11:49 pm

I will see what I can do :)

Raewyn
Registered User
Posts: 90
Joined: Fri Jun 04, 2004 12:10 am

Re: Hide BBCode

Post by Raewyn » Mon Jun 30, 2008 12:31 am

Anything would be greatly appreciated! Thank you. :)

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Mon Jun 30, 2008 12:39 am

I made a very simple, very efficient one :)
It is still being worked on, should be done in the next 5 minutes or so... Unfortunately due to phpBB restrictions I couldn't make it like your exact request, but it is still user friendly and alot easier to control now :D

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Mon Jun 30, 2008 1:02 am

When I said very simple I meant EXTREMELY simple... You probably won't believe it with how small of code it is. And by the fact that you add it like a custom BBCode...

And of course just like every modification that's about to be released, a bug just showed up :O

Found it, its due to colored text being contained in a <span>. I will fix it real quick

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Mon Jun 30, 2008 2:00 am

Had a stupid little bug with the font bbcode making a span, but I think it is all fixed now :D

Anyway. here it is. Just go to custom bbcodes (ACP>posting) and put these in

BBCode Usage:

Code: Select all

[hide]{TEXT1}|{TEXT2}[/hide]
HTML Replacement: (NOTE: from what I have heard you can't put any line breaks in this so keep it as it is.)

Code: Select all

<dl class="codebox" style="padding-bottom: 0px !important;"><span onclick="var elementmode = this.getElementsByTagName('span');for(var i=0;i<elementmode.length;i++){if(elementmode[i].title == 'hereitis'){elementmode[i].style.display=(!elementmode[i].style.display)?'none':'';}}"><dt style="margin-bottom: 0px !important;">{TEXT1}</dt><span title="hereitis" style="display:none;padding-left:20px;padding-bottom: 3px">{TEXT2}</span></span></dl>
Examples: (Don't try to use it, the image are on my private server so it won't work)

Code: Select all

[hide][img]http://localhost:85/styles/prosilver2/imageset/site_logo.gif[/img]|b[/hide]
[hide][img]http://localhost:85/styles/prosilver2/imageset/site_logo.gif[/img]|b[/hide] 
[hide][color=#FF0000]TITLE[/color]|Here is some more random text[/hide]
[hide][color=#FF0000]TITLE[/color]|Here is some more random text[/hide]
After expanding the second and fourth one, it looks like this:

Image

If you notice any bugs just post here telling me and I will investigate.

Oh btw this is probably something every other scripter in the world would frown on, especially phpBB because they have guidelines. xD

Raewyn
Registered User
Posts: 90
Joined: Fri Jun 04, 2004 12:10 am

Re: Hide BBCode

Post by Raewyn » Mon Jun 30, 2008 2:19 am

Fantastic! That's totally awesome, and you are a god(ess?) amongst men for pumping it out so fast!

Not to say that I am ungrateful - I appreciate how you pretty much pushed out exactly what I asked for, and in record time - but now I have a few tweak requests, or questions, if you will. I took out the padding-left from the displaying text, so that it will all show flush aligned left (or whatever the alignment will happen to be), and that works just fine. However, I find I am unable to nest this HIDE tag.

What I mean by that is being able to do something like:

[hide]Test One|[hide]Test Two|Test Three[/hide][/hide]

So that Test One shows, then when you open Test One, it shows Test Two which is also a HIDE, and when Test Two is clicked upon Test Three finally shows. I tried altering the bbcode syntax to [hide={TEXT1}]{TEXT2}[/hide] to see if maybe it was a syntactical problem, but it appears not to work that way, either.

Is there any way to make it nestable? It would certainly elevate you from the status of god(ess?)hood to... something even more awesome.

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Mon Jun 30, 2008 2:21 am

I will work on that, the problem (I know right away without looking ;D) is because of the ID. I just have to make sure they all get different ones, which actually could be a little tricky.

EDIT: I also fixed another bug in the process, previously if you clicked on any content it would collapse, now only the title can collapse it.

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Mon Jun 30, 2008 3:42 am

Okay, I tried and tried but it turns out it is a bug with phpBB custom bbcodes...

If you go to the add bbcode screen and put in all the default highlight ones (the top example for each section) and then try this code right here:

Code: Select all

[highlight=red]the pen is [highlight=blue]BLUE![/highlight] not red[/highlight]
it will come back wrong, it tries to end [highlight=red] with the inside [/highlight] even though they are not supposed to...

I shall report this and I will look for a way to fix it myself. If I find out how I will PM you or post here, probably both. I will start right away :)

Raewyn
Registered User
Posts: 90
Joined: Fri Jun 04, 2004 12:10 am

Re: Hide BBCode

Post by Raewyn » Mon Jun 30, 2008 4:39 am

No worries, no rush! It's for a forum still in development, honestly, take your time. I was lucky enough that you jumped on the thing, you don't need to try to circumvent whatever phpBB3 has in place to prevent nesting for the sake of this piece of code. Though it is interesting that you found that out!

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Mon Jun 30, 2008 4:54 am

What's even more interesting is it isn't only custom bbcodes... it is everything. my bug report: http://www.phpbb.com/bugs/phpbb3/ticket ... t_id=29815

Here is the example I put in there:

Code: Select all

[color=#FF0000]red red red red red red red red [color=#00BF00]green green green [/color]red red red red red red red red [/color]
comes as
red red red red red red red red green green green red red red red red red red red

Also noticed but not in report:

Code: Select all

[b]gggggggggg[b]gggggggggg[/b]gggggggggg[/b]
[i]gggggggggg[i]gggggggggg[/i]gggggggggg[/i]
[u]gggggggggg[u]gggggggggg[/u]gggggggggg[/u]
gggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggg
gggggggggggggggggggggggggggggg

The only one that works is quote:

Code: Select all

[quote]inside first[quote]inside second[/quote]back to first[/quote]
inside first
inside second
back to first
I am woring with that one to see what I can do with [ color] and will see what goes from there.

opalelement
Registered User
Posts: 315
Joined: Wed Dec 27, 2006 4:05 am

Re: Hide BBCode

Post by opalelement » Mon Jun 30, 2008 6:02 pm

Nothing I can do, I don't understand anything about how the bbcodes.php page works... I don't know the big advanced php :(

Harshadewa
Registered User
Posts: 48
Joined: Sat Jun 16, 2007 9:57 am
Contact:

Re: Hide BBCode

Post by Harshadewa » Tue Jul 01, 2008 3:50 am

How can we make it to allow use in specific forum??
Wanna help for a good cause?
http://colombogoldenlions.org/

Locked

Return to “[3.0.x] MOD Requests”