WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Select All In Codebox Empty Select All In Codebox Sun Feb 20, 2011 6:28 am

Axtrix

Axtrix
Registered Member
Registered Member
How do i put the sellect all thing in my codebox. PUNBB

2Select All In Codebox Empty Re: Select All In Codebox Sun Feb 20, 2011 11:35 pm

Axtrix

Axtrix
Registered Member
Registered Member
bump

3Select All In Codebox Empty Re: Select All In Codebox Mon Feb 21, 2011 3:19 pm

Jophy

Jophy
Registered Member
Registered Member
Please don't double post unless separated by 24 hours, use the EDIT button Wink

http://www.socialtechforum.com/

4Select All In Codebox Empty Re: Select All In Codebox Mon Feb 21, 2011 8:18 pm

Guest


Guest
This should be in the HTML section, any wait (:
1. Make a html page with this script:
Code:
function selectCode(a)
{
  // Get ID of code block
  var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
 
  // Not IE
  if (window.getSelection)
  {
      var s = window.getSelection();
      // Safari
      if (s.setBaseAndExtent)
      {
        s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
      }
      // Firefox and Opera
      else
      {
        // workaround for bug # 42885
        if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
        {
            e.innerHTML = e.innerHTML + ' ';
        }
 
        var r = document.createRange();
        r.selectNodeContents(e);
        s.removeAllRanges();
        s.addRange(r);
      }
  }
  // Some older browsers
  else if (document.getSelection)
  {
      var s = document.getSelection();
      var r = document.createRange();
      r.selectNodeContents(e);
      s.removeAllRanges();
      s.addRange(r);
  }
  // IE
  else if (document.selection)
  {
      var r = document.body.createTextRange();
      r.moveToElementText(e);
      r.select();
  }
}
if(text){}else{ var text = 'Selecionar todos';}
jQuery(document).ready(function(){
  jQuery("dl.codebox dt").not("dl.spoiler > dt").html('Code: <a href="#" onclick="selectCode(this); return false;" title="Select all the content" class="code-a">Select All</a>');
});
2. in ur version has templates then go to the templates - General - viewtopic_body:
insert this script at the top or any where:
Code:
<script src="/ID-" type="text/javascript"></script>

Change the "ID" with the html page number (:
if u version don't has template then just put this script in a widget:
Code:
<script type="text/javascript">function selectCode(a)
{
  // Get ID of code block
  var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0];
 
  // Not IE
  if (window.getSelection)
  {
      var s = window.getSelection();
      // Safari
      if (s.setBaseAndExtent)
      {
        s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
      }
      // Firefox and Opera
      else
      {
        // workaround for bug # 42885
        if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
        {
            e.innerHTML = e.innerHTML + ' ';
        }
 
        var r = document.createRange();
        r.selectNodeContents(e);
        s.removeAllRanges();
        s.addRange(r);
      }
  }
  // Some older browsers
  else if (document.getSelection)
  {
      var s = document.getSelection();
      var r = document.createRange();
      r.selectNodeContents(e);
      s.removeAllRanges();
      s.addRange(r);
  }
  // IE
  else if (document.selection)
  {
      var r = document.body.createTextRange();
      r.moveToElementText(e);
      r.select();
  }
}
if(text){}else{ var text = 'Selecionar todos';}
jQuery(document).ready(function(){
  jQuery("dl.codebox dt").not("dl.spoiler > dt").html('Code: <a href="#" onclick="selectCode(this); return false;" title="Select all the content" class="code-a">Select All</a>');
});
</script>

5Select All In Codebox Empty Re: Select All In Codebox Mon Feb 21, 2011 10:50 pm

Axtrix

Axtrix
Registered Member
Registered Member
Solved.

6Select All In Codebox Empty Re: Select All In Codebox Mon Feb 21, 2011 10:56 pm

RockerMan

RockerMan
Technician
Technician
Nicely done Gangstar Smile

http://www.graphics-post.com/

7Select All In Codebox Empty Re: Select All In Codebox Tue Feb 22, 2011 4:04 pm

Jophy

Jophy
Registered Member
Registered Member
**Solved

http://www.socialtechforum.com/

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum