vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   BB Code Enhancements - [BB Code] Sliding Spoiler with jQuery (https://vborg.vbsupport.ru/showthread.php?t=241132)

bpr 04-23-2010 10:00 PM

[BB Code] Sliding Spoiler with jQuery
 
1 Attachment(s)
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:
https://vborg.vbsupport.ru/attachmen...1&d=1272073026

Open Spoiler:
https://vborg.vbsupport.ru/attachmen...1&d=1272073026

How to install?
1. Upload the picture
https://vborg.vbsupport.ru/attachmen...1&d=1272075022
into the following directory via ftp:
[forum_root]/images/icons/

2. Upload the Editor Icon via ftp:
https://vborg.vbsupport.ru/attachmen...1&d=1272074407

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

TimberFloorAu 04-24-2010 01:08 AM

Excellent Tagged

obmob 05-26-2011 12:02 AM

Will test :D

ozione 08-30-2011 07:56 AM

this is just what i needed and it actually works as it should! THANKS!

ozione 09-10-2011 07:04 AM

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.


All times are GMT. The time now is 06:56 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01002 seconds
  • Memory Usage 1,731KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (6)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete