[Request] Copy Coded Links

Status
Not open for further replies.

JointRolla420

Active Member
219
2009
0
0
OK so I need a code to be made up, I already know where to PUT IT but I just need somebody to find it or make it up.

It's pretty basic I just want to add a link beside the word "Code:" for all my coded links on my site so when somebody clicks it, all contents/links in the CODE box will be copied to clipboard...

Any help would be appreciated

EDIT: I am running vBulletin
 
5 comments
Install:
1. Open Temp: headinclude
Add below:

PHP:
          <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:
PHP:
           <a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>


3. Open bbcode_html:
find:
PHP:
           $vbphrase[html_code]:
Add below:
PHP:
           <a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>
4. Open bbcode_php:
find:
PHP:
           $vbphrase[php_code]:
Add below:
PHP:
           <a href="#" onclick="selectCode(this); return false;"><input type="button" value="Select All" /></a>
Next find:
PHP:
           $code
Replace with:
PHP:
           <pre>$code</pre>
 
Status
Not open for further replies.
Back
Top