Page 1 of 3

jQuery Spoiler

Posted: 24 Jul 2010, 22:28
by marc1706
jQuery Spoiler

Image

NOTE:
In order to work, this spoiler will need jQuery. If your style already has jQuery included, it will work right out of the box, otherwise you will have to do this:
Download jQuery 1.4.2 from here: http://code.jquery.com/jquery-1.4.2.min.js
Save it on your computer and upload it to the template folder of your style(s) that will use the spoiler.

If you have more than one style for your users, do this for every style:
Open styles/*yourstyle*/template/overall_header.html
Find:

Code: Select all

</head>
Add before:

Code: Select all

<script src="{T_TEMPLATE_PATH}/jquery-1.4.2.min.js" type="text/javascript"></script>
If you downloaded a different version of jQuery, please replace "jquery-1.4.2.min.js" with the filename of your jQuery.

BBCode Usage:

Code: Select all

[spoiler={INTTEXT}]{TEXT}[/spoiler]
HTML Replacement:

Code: Select all

<dl class="codebox"><dt><a href="javascript&#058; void(0);" onclick="var spoiler = this.parentNode.parentNode.getElementsByTagName('dd')[0]; if ( spoiler.style.display == 'none' ) { $(spoiler).slideDown(); $(spoiler).fadeIn('slow'); this.innerHTML = ' [&minus;] {INTTEXT}'; } else { $(spoiler).slideUp(); $(spoiler).fadeOut('slow'); this.innerHTML = '[+] {INTTEXT}'; };">[+] {INTTEXT}</a></dt><dd style="display: none;">{TEXT}</dd></dl>
Help line:

Code: Select all

[Spoiler="Title"] Any Text [/Spoiler]
Demo:
http://www.youtube.com/watch?v=TWNyCU5AhrY

Re: jQuery Spoiler

Posted: 25 Jul 2010, 09:52
by Stoker
Looks nice :thumb:

Re: jQuery Spoiler

Posted: 30 Jul 2010, 06:28
by Stitch
This isn't working on my board for some reason. I do have the jQuery 1.4.2 installed on my board because I am using it with another mod already. All I am getting is the bbcode text.
[spoiler2="this is a test"]Testing this cool BBcode[/spoiler2]
Any ideas?

Re: jQuery Spoiler

Posted: 30 Jul 2010, 11:20
by KukY13
Stitch » 30 Jul 2010, 06:28 wrote:
[spoiler2="this is a test"]Testing this cool BBcode[/spoiler2]
Any ideas?
The Spoiler title is an {IDENTIFIER}, and if my memory serves me, it only allows A-Z, a-z, 0-9 and underscores.
So try changing the BBCode, and replace {IDENTIFIER} with {SIMPLETEXT}.

Re: jQuery Spoiler

Posted: 30 Jul 2010, 12:36
by Stoker
or INTTEXT

Re: jQuery Spoiler

Posted: 01 Aug 2010, 06:44
by Stitch
Ok after an hour of messing around I finally figured out the problem but don't know how to solve it. If you put a space in your title it will break the bbcode. As long as it is all one word it works fine.

This way does not work

Code: Select all

[spoiler2="this is a test"]Testing this cool BBcode[/spoiler2]

This way works

Code: Select all

[spoiler2="thisisatest"]Testing this cool BBcode[/spoiler2]

Re: jQuery Spoiler

Posted: 01 Aug 2010, 07:25
by Stoker
And if you use this as BBode Usage:

Code: Select all

[spoiler={INTTEXT}]{TEXT}[/spoiler]
?

Re: jQuery Spoiler

Posted: 01 Aug 2010, 17:53
by Stitch
Stoker » 01 Aug 2010, 07:25 wrote:And if you use this as BBode Usage:

Code: Select all

[spoiler={INTTEXT}]{TEXT}[/spoiler]
?
No sir..using INTEXT it doesn't work at all. Even without spaces in the title.

Re: jQuery Spoiler

Posted: 01 Aug 2010, 18:20
by Stoker
Hmm, so you are on one of the older versions of phpBB. Shame on you :D
Then try what KukY13 suggested, use SIMPLETEXT

Re: jQuery Spoiler

Posted: 01 Aug 2010, 18:47
by Stitch
I'm only one version behind. 3.0.6.