Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
[BB Code] Sliding Spoiler with jQuery Details »»
[BB Code] Sliding Spoiler with jQuery
Version: 1.00, by bpr bpr is offline
Developer Last Online: Dec 2010 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 4.0.x Rating:
Released: 04-23-2010 Last Update: Never Installs: 9
Template Edits
Re-useable Code Additional Files  
No support by the author.

What does this mod do?
This is a normal spoiler, with which you can hide some text in your post. When a user clicks on the spoiler name, a field will slide in/out with the hidden text.

Where is it useful?
This could be useful for serveral things, of couse it is not as mighty as a real hide hack, but you could hide small / unimportant information such as an answer for an rethoric question or you could hide some offtopic spam in a context post.

How does it looks?
Closed spoiler:


Open Spoiler:


How to install?
1. Upload the picture

into the following directory via ftp:
[forum_root]/images/icons/

2. Upload the Editor Icon via ftp:


into
[forum_root]/images/editor/

Uploads are finished now!


3. Create a new BBCode via ACP with the following settings:
Title: Spoiler
BB-Code Tag: sp
Code:
Code:
<div class="spoilerBB">
<h4 onclick="$('.spoilerHidden').slideToggle();">Spoiler Inhalt:</h4>
<div class="spoilerHidden" style="display:none;">
{param}
</div>
</div>
!IMPORTANT:You might wanna change "Spoiler Inhalt:" into your own language, but basically it means: "Spoiler Content:"(Dont worry you dont have to be a HTML crack to do so)

Example: [sp]Hidden text![/sp]
Description: This code hides/show a text within the spoiler tag
{option} usage: NO!
Image: /images/icons/spoiler.gif
You can check the rest however you like, but I was using:
Remove Tag: Yes
and the rest: No

Now you can save.

3. jQuery Part:

If you are already using jquery on your website you can easily skip part3 and go on to part4.
However, if you dont have jquery implented you can do this just like that:

Open your ACP -> Styles & Templates -> "Configure Styles" -> choose "Alter Templates" -> click on the template "footer" and than "edit"

Scroll down to the very last code line where something should be written like this:

Code:
{vb:raw ad_location.ad_footer_end} 
</div>
and put underneath
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
now you can save this template and leave it.

4. Your Spoiler hack should already work!
On the other hand it looks pretty "blank" So lets do some quick n dirty CSS (3):
In my case I created an extra external stylesheet for my board, in many cases thats not the case, I am actually not that deep into vbulletin yet with all the style vars and so on but what we need is this little css:
Code:
/*SPOILER*/
.spoilerBB{}

    .spoilerBB h4
    {
        padding-left:3px;
        font-style:italic;
        font-size:13px;
    }
    
    .spoilerBB h4:before
    {
        content: url(/images/icons/exclamation--frame.png);
        padding-right:5px;
    }
    
    .spoilerHidden
    {
        background-color:#f2f6f8;
        border:1px solid lightblue;
        color:#303030;
        font-style:italic;
        padding:5px;
    }
You could also add this in one of the header templates such as "headinclude_bottom" where as you have to put around the code the following lines:
Above:
Code:
<style type="text/css">
Under:
Code:
</style>
I personally do not recommend internal style sheets, so I am sorry to mess this little howto up with that bullcrap and not using style vars, I might alter this text in the future.

5. Thats it - you are done

All the best
bpr

Screenshots

File Type: png closed-spoiler.png (7.0 KB, 0 views)
File Type: png open-spoiler.png (7.7 KB, 0 views)

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-24-2010, 01:08 AM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Excellent Tagged
Reply With Quote
  #3  
Old 05-26-2011, 12:02 AM
obmob obmob is offline
 
Join Date: Nov 2001
Posts: 580
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will test
Reply With Quote
  #4  
Old 08-30-2011, 07:56 AM
ozione ozione is offline
 
Join Date: Nov 2010
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this is just what i needed and it actually works as it should! THANKS!
Reply With Quote
  #5  
Old 09-10-2011, 07:04 AM
ozione ozione is offline
 
Join Date: Nov 2010
Posts: 55
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

there is one bug though; using widgets with last posts and if the spoiler is somewhere on the beginning of the post, the widget reveals it.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 02:39 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04163 seconds
  • Memory Usage 2,262KB
  • Queries Executed 21 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (6)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (2)postbit_attachment
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete