How To Make Select All In BB Code

Status
Not open for further replies.

fbiotai93

Active Member
343
2010
13
130
Hello WJ

Can You Give Code To Make Select All In BB Code

[slide]http://imgcafe.com/view/uploads/catsofo.jpg[/slide]

hope you all can help me:)):))
 
1 comment
1- Open the headinclude template and add in the end :
PHP:
<script type="text/javascript">  
function selectCode(a)  
{  
   var e = a.parentNode.parentNode.getElementsByTagName('p')[0];  
   if (window.getSelection)  
   {  
      var s = window.getSelection();  
       if (s.setBaseAndExtent)  
      {  
         s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);  
      }  
      else  
      {  
         var r = document.createRange();  
         r.selectNodeContents(e);  
         s.removeAllRanges();  
         s.addRange(r);  
      }  
   }  
   else if (document.getSelection)  
   {  
      var s = document.getSelection();  
      var r = document.createRange();  
      r.selectNodeContents(e);  
      s.removeAllRanges();  
      s.addRange(r);  
   }  
   else if (document.selection)  
   {  
      var r = document.body.createTextRange();  
      r.moveToElementText(e);  
      r.select();  
   }  
}  
</script>
2- Open the bbcode_code template and replace it with:
PHP:
<div class="bbcode_container" > 
    <div class="bbcode_description" style="padding-bottom:2px">{vb:rawphrase code}:&nbsp;<a href="#" onclick="selectCode(this); return false;" style="font-size:11px">(Click Here to Select All)</a></div> 
    <pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>><p>{vb:raw code}</p></pre> 
</div>
3- Open the bbcode_html template and replace it with:
PHP:
<div class="bbcode_container"> 
    <div class="bbcode_description" style="padding-bottom:2px">{vb:rawphrase html_code}:&nbsp;<a href="#" onclick="selectCode(this); return false;" style="font-size:11px">(Click Here to Select All)</a></div> 
    <pre class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']"> style="height:<vb:if condition="$blockheight<=$vboptions['codemaxlines']">{vb:math {vb:math {vb:raw blockheight}+2}}*{vb:stylevar mid_fontSize}}<vb:else />{vb:math {vb:math {vb:raw blockheight}+1}*{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>><p>{vb:raw code}</p></pre> 
</div>
4- Open the bbcode_php template and replace it with:
PHP:
<div class="bbcode_container">
    <div class="bbcode_description" style="padding-bottom:2px">{vb:rawphrase php_code}:&nbsp;<a href="#" onclick="selectCode(this); return false;" style="font-size:11px">(Click Here to Select All)</a></div>
    <div class="bbcode_code"<vb:if condition="$vboptions['codemaxlines']">style="height:<vb:if condition="$blockheight<$vboptions['codemaxlines']">{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}*2}<vb:else />{vb:math {vb:raw blockheight}*{vb:stylevar mid_fontSize}+{vb:stylevar mid_fontSize}}</vb:if>;"</vb:if>><code><p>{vb:raw code}</p></code></div>
</div>
--------------------------------

* If you want to add button instead of text :-
Open the bbcode_code template and find :
PHP:
<a href="#" onclick="selectCode(this); return false;" style="font-size:11px">(Click Here to Select All)</a>
Then replace it with :
PHP:
<a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>
Do the same thing in bbcode_html and bbcode_php

Done !!!
 
Status
Not open for further replies.
Back
Top