The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Code Of " Select Content"

View previous topic View next topic Go down

Solved Code Of " Select Content"

Post by Guest on 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

Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

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



Forum Rules : : Forumotion Staff : : Appeal A Warning : : FAQ : : Tips & Tricks : : Forgotten Password/Login Issues
You need one post to send a PM
When your topic has been solved, ensure you mark the topic solved
Never post your email in public

avatar
Derri
Administrator
Administrator

Male Posts : 8611
Reputation : 613
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

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

thanks but nothing happened

Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

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

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

Female Posts : 59
Reputation : 3
Language : english

Back to top Go down

Solved Re: Code Of " Select Content"

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

Yes make sure you activate Javascript Very Happy

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


Forum Rules : : Forumotion Staff : : Appeal A Warning : : FAQ : : Tips & Tricks : : Forgotten Password/Login Issues
You need one post to send a PM
When your topic has been solved, ensure you mark the topic solved
Never post your email in public

avatar
Derri
Administrator
Administrator

Male Posts : 8611
Reputation : 613
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

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

it is active

Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

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

Did you ensure you took the correct code?


Forum Rules : : Forumotion Staff : : Appeal A Warning : : FAQ : : Tips & Tricks : : Forgotten Password/Login Issues
You need one post to send a PM
When your topic has been solved, ensure you mark the topic solved
Never post your email in public

avatar
Derri
Administrator
Administrator

Male Posts : 8611
Reputation : 613
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

Post by Guest on 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>');
    });

Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

Post by Derri on 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.
avatar
Derri
Administrator
Administrator

Male Posts : 8611
Reputation : 613
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Code Of " Select Content"

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

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

Guest
Guest


Back to top Go down

Solved Re: Code Of " Select Content"

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

Topic Solved & Locked


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

avatar
SLGray
Administrator
Administrator

Male Posts : 40509
Reputation : 2733
Language : English
Location : United States

https://fmthemes.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


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