code: select all ?

dogbox

New Member
does anyone know how to do this?

adp3wg.jpg


Thank you
 
This is small hack used Script selectCode.

Install:
1. Open Temp: headinclude
Add below:

Code:
<script type="text/javascript"> 
function selectCode(a) 
{ 
   var e = a.parentNode.parentNode.getElementsByTagName('PRE')[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 bbcode_code:
find:

PHP:
$vbphrase[code]:
Add below:

Code:
<a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>
3. Open bbcode_html:
find:

Code:
$vbphrase[html_code]:

Add below:

Code:
<a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>
4. Open bbcode_php:
find:

Code:
$vbphrase[php_code]:
Add below:

Code:
<a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>
Next find:

Code:
$code
Replace with:

Code:
<pre>$code</pre>
That´s all.
wink.gif


Hope u like!
biggrin.gif
 
I'm not the coder, but try changing all instances of type="button" to type ="text". Or maybe remove the type="button" altogether and it may revert to text. Sounds logical, no?
 
Ok, how about this - remove the middle part entirely and replace it with "Select All" like this:

Code:
<a href="#" onclick="selectCode(this); return false;">Select All</a>

That should work since it's a hyperlink. Give it a shot.
 
Back
Top