Welcome to PhpBB3 BBCodes. Click here to register
Feed

jQuery Spoiler

Forum rules
We dont add more BBCodes to our database, but feel free to share and support your own BBCodes here.

Remember that it is not allowed to use {TEXT} inside the html tags!!!
It causes a serious security risk to your board and users.
Like this: <div style="{TEXT}">{TEXT}</div>
Green = OK - Red = forbidden

jQuery Spoiler

Postby marc1706 » 24 Jul 2010, 20:28

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
Last edited by marc1706 on 18 Aug 2010, 14:15, edited 1 time in total.
User avatar
marc1706

BBCoder II
 
Windows 7 Firefox
Status: Offline
Age: 20
Posts: 8
Topics: 1
Joined: 14 Apr 2010, 09:17
Last Visit: Yesterday, 17:56
PhpBB Version: 3.0.7-PL1

Donate to skip ads


Re: jQuery Spoiler

Postby Stoker » 25 Jul 2010, 07:52

Looks nice :thumb:
Board rules! No PM support
Image
User avatar
Stoker

Site Admin
 
Ubuntu Firefox
Status: Offline
Age: 37
Posts: 951
Topics: 80
Joined: 03 Mar 2010, 18:56
Last Visit: Today, 02:51
Location: Denmark
PhpBB Version: 3.0.7-PL1

Re: jQuery Spoiler

Postby Stitch » 30 Jul 2010, 04:28

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?
Image
User avatar
Stitch

BBCoder II
 
Windows Vista Firefox
Status: Offline
Posts: 28
Topics: 3
Joined: 06 Mar 2010, 04:08
Last Visit: 04 Sep 2010, 18:17

Re: jQuery Spoiler

Postby KukY13 » 30 Jul 2010, 09:20

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}.
Image
User avatar
KukY13

BBCoder III
 
Windows XP Chrome
Status: Offline
Age: 13
Posts: 92
Topics: 10
Joined: 26 Jun 2010, 14:23
Last Visit: Yesterday, 20:43
PhpBB Version: 3.0.7-PL1

Re: jQuery Spoiler

Postby Stoker » 30 Jul 2010, 10:36

or INTTEXT
Board rules! No PM support
Image
User avatar
Stoker

Site Admin
 
Windows 7 Firefox
Status: Offline
Age: 37
Posts: 951
Topics: 80
Joined: 03 Mar 2010, 18:56
Last Visit: Today, 02:51
Location: Denmark
PhpBB Version: 3.0.7-PL1

Re: jQuery Spoiler

Postby Stitch » 01 Aug 2010, 04:44

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]
Image
User avatar
Stitch

BBCoder II
 
Windows Vista Firefox
Status: Offline
Posts: 28
Topics: 3
Joined: 06 Mar 2010, 04:08
Last Visit: 04 Sep 2010, 18:17

Re: jQuery Spoiler

Postby Stoker » 01 Aug 2010, 05:25

And if you use this as BBode Usage:
Code: Select all
[spoiler={INTTEXT}]{TEXT}[/spoiler]
?
Board rules! No PM support
Image
User avatar
Stoker

Site Admin
 
Windows 7 Firefox
Status: Offline
Age: 37
Posts: 951
Topics: 80
Joined: 03 Mar 2010, 18:56
Last Visit: Today, 02:51
Location: Denmark
PhpBB Version: 3.0.7-PL1

Re: jQuery Spoiler

Postby Stitch » 01 Aug 2010, 15:53

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.
Image
User avatar
Stitch

BBCoder II
 
Windows Vista Firefox
Status: Offline
Posts: 28
Topics: 3
Joined: 06 Mar 2010, 04:08
Last Visit: 04 Sep 2010, 18:17

Re: jQuery Spoiler

Postby Stoker » 01 Aug 2010, 16:20

Hmm, so you are on one of the older versions of phpBB. Shame on you :D
Then try what KukY13 suggested, use SIMPLETEXT
Board rules! No PM support
Image
User avatar
Stoker

Site Admin
 
Windows 7 Firefox
Status: Offline
Age: 37
Posts: 951
Topics: 80
Joined: 03 Mar 2010, 18:56
Last Visit: Today, 02:51
Location: Denmark
PhpBB Version: 3.0.7-PL1

Re: jQuery Spoiler

Postby Stitch » 01 Aug 2010, 16:47

I'm only one version behind. 3.0.6.
Image
User avatar
Stitch

BBCoder II
 
Windows Vista Firefox
Status: Offline
Posts: 28
Topics: 3
Joined: 06 Mar 2010, 04:08
Last Visit: 04 Sep 2010, 18:17

Donate to skip ads


Next

Return to Submit a BBCode



  • Similar topics
    Replies
    Views
    Last Post

Who is online

Users browsing this forum: No registered users and 1 guest

cron