Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.7 > vBulletin 3.7 Template Modifications
inline & block [hide] bbcode Details »»
inline & block [hide] bbcode
Version: 0.01, by Kagemaru Kagemaru is offline
Developer Last Online: Nov 2013 Show Printable Version Email this Page

Category: BB Code Enhancements - Version: 3.7.2 Rating:
Released: 07-03-2008 Last Update: Never Installs: 10
Translations Is in Beta Stage  
No support by the author.

What this does: These BB Codes add tags to hide text inline and in a block. I've also made a BB Code that uses an option.

Positive:
  • These tags allow to use hidden text inline and in blocks. Also, about anything can be used inside them (at least as far as I've tested).
  • Both one of the single versions and the double version can be used together. i.e: [hide] for inline and [hide=inline] or [hide=block] for both.

Negative:
  • After editing, the tags don't work. Refresh and they're there though. (weird :\)
  • At the moment, it will always post the javascript function whenever a [hide] tag is used, which can make it pretty slow if big amounts of hide tags are used on one page. I'd be glad if someone could help me with stuffing this into a plugin/product or something, to prevent that from happening.
CSS

Go to Admincp > Styles & Templates > Style Manager > Main CSS

Now scroll all the way down to Additional CSS Definitions and add:

Code:
                /*******************************************\
                *        CSS for the [hide] BBcode!         *
                \*******************************************/

span.hidetitle_inline {
     background-color: #5C7099;
     color: #FFFFFF;
     font-weight: bold;
}
span.hidetext_inline {
     background-color: #E1E4F2;
     color: #000000;
}

div.hideborder_block {
     width: 100%;
     border-collapse: collapse;
     border: solid thin black;
     background-color: #5C7099;
     color: #FFFFFF;
     font-weight: bold;
}
div.hidetitle_block div{
     width: 100%;
     border-collapse: collapse;
     border: solid thin black; 
}
div.hidetext_block{
     background-color: #F5F5FF;
     color: #000000;
}
-----------------------------------------------------------------------------------

Then add the BB Code(s) at AdminCP > Custom BB Codes > Add New BB Code:

Hide BB Code
Title: hide
BB Code Tag Name: hide
Replacement:
Code:
<script language='JavaScript' type='text/javascript'><!--

  inline_title_hidden = '&nbsp;hidden ?&nbsp;';
  inline_title_shown = '&nbsp;?&nbsp;';
  inline_text_prefix = '';
  block_title_hidden = '&nbsp;Show content';
  block_title_shown = '&nbsp;Hide content';
  block_text_prefix  = '&nbsp;';

function hide(target,displaytype) {
    titleNode = target;
    textNode = target.nextSibling;
  if (displaytype == 'inline') {
    if (textNode.style.display != 'none') {
      textNode.style.display = 'none';
      titleNode.innerHTML = inline_title_hidden;
    } else {
      textNode.style.display = 'inline';
      titleNode.innerHTML = inline_title_shown;
    }
  } else {
    if (textNode.style.display != 'none') {
      textNode.style.display = 'none';
      titleNode.innerHTML = block_title_hidden; } 
    else {
      textNode.style.display = 'block';
      titleNode.innerHTML = block_title_shown;
    }
  }
}

if ('{option}' == 'inline') {
  var output = '<span><span class="hidetitle_inline" onclick="hide(this,\'inline\');">'+inline_title_hidden+'</span><span class="hidetext_inline" style="display: none;">'+inline_text_prefix;
  document.write(output);
} else {
  var output = '<div class="hideborder_block"><div class="hidetitle_block" onclick="hide(this,\'block\');">'+block_title_hidden+'</div><div class="hidetext_block" style="display: none;">'+block_text_prefix;
  document.write(output);
}
//--></script>
{param}
<script language='JavaScript' type='text/javascript'><!--

  inline_text_suffix = '';
  block_text_suffix  = '<br />';

if ('{option}' == 'inline') {
  var output = inline_text_suffix+'</span></span>';
} else {
  var output = block_text_suffix+'</div></div>';
}
document.write(output);
//--></script>
Example: This is [hide]an inline[/hide] example!
Description: This tag allows both inline and block hide to be used.
[hide=inline] = inline
[hide=block] = block
Use option: Yes
Remove Tags if empty: Yes


Inline BB Code only
Title: hide
BB Code Tag Name: hide
Replacement:
Code:
<script language='JavaScript' type='text/javascript'><!--

  inline_title_hidden = '&nbsp;hidden ?&nbsp;';
  inline_title_shown = '&nbsp;?&nbsp;';
  inline_text_prefix = '';

function hide(target,displaytype) {
    titleNode = target;
    textNode = target.nextSibling;
  if (displaytype == 'inline') {
    if (textNode.style.display != 'none') {
      textNode.style.display = 'none';
      titleNode.innerHTML = inline_title_hidden;
    } else {
      textNode.style.display = 'inline';
      titleNode.innerHTML = inline_title_shown;
    }
  } else {
    if (textNode.style.display != 'none') {
      textNode.style.display = 'none';
      titleNode.innerHTML = block_title_hidden; } 
    else {
      textNode.style.display = 'block';
      titleNode.innerHTML = block_title_shown;
    }
  }
}

var output = '<span><span class="hidetitle_inline" onclick="hide(this,\'inline\');">'+inline_title_hidden+'</span><span class="hidetext_inline" style="display: none;">'+inline_text_prefix;
document.write(output);
//--></script>
{param}
<script language='JavaScript' type='text/javascript'><!--

  inline_text_suffix = '';
  
var output = inline_text_suffix+'</span></span>';
document.write(output);
//--></script>
Example: This is [hide]a block[/hide] example!
Description: This tag allows to hide text in a block.
Use option: No
Remove Tags if empty: Yes

Block BB Code only
Title: hide
BB Code Tag Name: hide
Replacement:
Code:
<script language='JavaScript' type='text/javascript'><!--

  block_title_hidden = '&nbsp;Show content';
  block_title_shown = '&nbsp;Hide content';
  block_text_prefix = '&nbsp;';

function hide(target,displaytype) {
  titleNode = target;
  textNode = target.nextSibling;
  if (textNode.style.display != 'none') {
    textNode.style.display = 'none';
    titleNode.innerHTML = block_title_hidden; } 
  else {
    textNode.style.display = 'block';
    titleNode.innerHTML = block_title_shown;
  }
}

var output = '<div class="hideborder_block"><div class="hidetitle_block" onclick="hide(this,\'block\');">'+block_title_hidden+'</div><div class="hidetext_block" style="display: none;">'+block_text_prefix;
document.write(output);
//--></script>
{param}
<script language='JavaScript' type='text/javascript'><!--

  block_text_suffix  = '<br />';

var output = block_text_suffix+'</div></div>';
document.write(output);
//--></script>
Example: This is [hide]an inline[/hide] example!
Description: This tag allows to hide text in the middle of a sentence. The hidden text will show on click, and is hidden on another click.
Use option: No
Remove Tags if empty: Yes

-----------------------------------------------------------------------------------

Done! You should now be able to use them.

There are a few things you can configure (in addition to the obvious CSS ) in the Javascript directly:

At the top:
inline_title_hidden = Title of the inline region when the text is hidden.
inline_title_shown = Title of the inline region when the text is shown.
inline_text_prefix = Something that should come before the shown inline text.
block_title_hidden = Title of the block region when the text is hidden.
block_title_shown = Title of the inline region when the text is shown.
block_text_prefix = Something that should come before the shown block text.

At the bottom:

inline_text_suffix = Something that should come after the shown inline text.
block_text_suffix = Something that should come after the shown block text.

-----------------------------------------------------------------------------------
This is my first entry on VB.org, so I'm all open for fair comments.

I hope a few souls find this useful. If you do, please click install. =)

Show Your Support

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

Comments
  #2  
Old 09-17-2008, 04:35 PM
Simon88 Simon88 is offline
 
Join Date: Mar 2008
Posts: 2
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yay! first reply and thanks!
Reply With Quote
  #3  
Old 01-18-2009, 08:49 PM
troppodel's Avatar
troppodel troppodel is offline
 
Join Date: Nov 2008
Posts: 62
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

i there
nice mod but please let me know can i disable the click for show text for usergroups like unregistered?
i wanna hide a text for the unregistered users and disable the click for see the text, but enable it for the registered users
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 05:10 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.03830 seconds
  • Memory Usage 2,223KB
  • Queries Executed 18 (?)
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
  • (4)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (3)postbit_onlinestatus
  • (3)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_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete