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]

1How to select all in codebox for phpbb2? Empty How to select all in codebox for phpbb2? Mon Feb 28, 2011 9:15 pm

Exterminator


Registered Member
Registered Member
How to select all in codebox for phpbb2?

Someone success with that? Please help me.

Guest


Guest
did u tried this?
http://www.webartzforum.com/t2292-select-all-in-codebox

Exterminator


Registered Member
Registered Member
Gangstar15 wrote:did u tried this?
http://www.webartzforum.com/t2292-select-all-in-codebox

Yeah, i tried. But it just work with phpbb3, punbb, not phpbb2.

According to the code i see, the codebox of phpbb2 is table, phpbb3 and punbb is div.

Any ideas Smile?

Guest


Guest
Oh yah Very Happy
try this:
Code:
function selectCode(a)
{
  // Get ID of code block
  var e = a.parentNode.parentNode.getElementsByClass('cont_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("td.code").html('Code: <a href="#" onclick="selectCode(this); return false;" title="Select all the content" class="code-a">Select All</a>');
});

Im not sure if it works

Exterminator


Registered Member
Registered Member
Ya, it didn't work Smile

I just try this :

Code:
jQuery(document).ready(function(){
  jQuery("span.genmed").html('Code: <span class="codeselect" onclick="selectCode(this); return false;">Select content</span>');
});

It's appear in right position, but when i clicked, it didn't select the codes.

So hard!

Guest


Guest
Me too Razz
Still need some advanced work (:
i will try my best,
+ the problem is in phpbb2 when post a code its not this code tag:
Code:
<code></code>

Plancker


Registered Member
Registered Member
need this too help us Very Happy

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