inline & block [hide] bbcode
This modification is in the archives.
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:
Negative:
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 = ' hidden » '; inline_title_shown = ' « '; inline_text_prefix = ''; block_title_hidden = ' Show content'; block_title_shown = ' Hide content'; block_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; } } } 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> 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 = ' hidden » '; inline_title_shown = ' « '; 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> 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 = ' Show content'; block_title_shown = ' Hide content'; block_text_prefix = ' '; 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> 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. =) Download No files for download. Screenshots |
Similar Mods
BB Code Enhancements Inline Hover Spoiler BBCode | vBulletin 3.7 Template Modifications |