The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Code Of " Select Content"

3 posters

Go down

Solved Code Of " Select Content"

Post by Guest July 15th 2013, 4:08 pm

I want a code that makes members copy the whole code by selecting on "select content" like the one in help.forumotion.com:rose:


Last edited by Egyptian Revolution on July 15th 2013, 9:19 pm; edited 1 time in total
avatar
Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

Post by Derri July 15th 2013, 4:12 pm

Derri
Derri
Helper
Helper

Male Posts : 8755
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

Post by Guest July 15th 2013, 4:18 pm

thanks but nothing happened
avatar
Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

Post by novacane. July 15th 2013, 5:06 pm

are you sure you have your javascripts activated?
novacane.
novacane.
Forumember

Female Posts : 59
Reputation : 3
Language : english

Back to top Go down

Solved Re: Code Of " Select Content"

Post by Derri July 15th 2013, 5:25 pm

Yes make sure you activate Javascript Very Happy

You'll find the option in the Javascript management area.
Derri
Derri
Helper
Helper

Male Posts : 8755
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

Post by Guest July 15th 2013, 6:09 pm

it is active
avatar
Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

Post by Derri July 15th 2013, 6:15 pm

Did you ensure you took the correct code?
Derri
Derri
Helper
Helper

Male Posts : 8755
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

Post by Guest July 15th 2013, 7:58 pm

yes, i used this code for phpbb3

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 Content </a>');
    });
avatar
Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

Post by Derri July 15th 2013, 8:12 pm

Egyptian Revolution wrote:yes, i used this code for phpbb3

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 Content </a>');
    });

Have you got other javascripts installed? If so, try removing them one by one to see if that's causing a clash.
Derri
Derri
Helper
Helper

Male Posts : 8755
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

Post by Guest July 15th 2013, 9:17 pm

thanks  i delete some codes that caused the problem and i solved it
avatar
Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

Post by SLGray July 15th 2013, 9:21 pm

Topic Solved & Locked


Code Of " Select Content" Slgray10

When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.
SLGray
SLGray
Administrator
Administrator

Male Posts : 51463
Reputation : 3519
Language : English
Location : United States

https://forumsclub.com/gc/128-link-directory/

Back to top Go down

Back to top


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