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.

Content Selection Code is not working?

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Solved Content Selection Code is not working?

Post by Van-Helsing on January 13th 2014, 11:58 pm

Hi dear all,
I am using this Tuturial http://help.forumotion.com/t93456-select-content-button?highlight=Select+All to add content select function in my forum but its not working? My forum version is phpbb2.

Best Regards,
Dark-Avenger.

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by SLGray on January 14th 2014, 12:09 am

Did you check all pages for the JavaScript?


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


SLGray
Administrator
Administrator

Male Posts : 36747
Reputation : 2449
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Van-Helsing on January 14th 2014, 12:24 am

Yes of course.

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by SLGray on January 14th 2014, 12:26 am

How is it not working?


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


SLGray
Administrator
Administrator

Male Posts : 36747
Reputation : 2449
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Luffy on January 14th 2014, 12:31 am

SLGray i have tested it also and it doesn't show the Select Content link at all! I don't know it might be a problem with the code that has been given..






Luffy
Manager
Manager

Male Posts : 4258
Reputation : 424
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by SLGray on January 14th 2014, 12:34 am

I am using it on my forums, and it works fine.


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


SLGray
Administrator
Administrator

Male Posts : 36747
Reputation : 2449
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Luffy on January 14th 2014, 12:36 am

Can you please try adding this code to yours and check if it shows? Because to me it doesn't show anything!

Code:
function selectCode(a)
    {
    // Get ID of code block
    var e = jQuery(a).closest('tr').next().find('.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();
    }
    }
    jQuery(function(){

    jQuery('div.postbody td.code').parent().prev().find('b').html('Code:
    <a href="javascript:void()" onClick="selectCode(this)"><font
    face="verdana" color="red"></font> Select Content </a>');
    });

This is the default code but it still doesn't show anything to me..






Luffy
Manager
Manager

Male Posts : 4258
Reputation : 424
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by SLGray on January 14th 2014, 1:00 am

Is your forum version punBB? If it is, you need to use the second code.


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


SLGray
Administrator
Administrator

Male Posts : 36747
Reputation : 2449
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Luffy on January 14th 2014, 1:03 am

It's not punBB. I am testing it on PhpBB2






Luffy
Manager
Manager

Male Posts : 4258
Reputation : 424
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by SLGray on January 14th 2014, 1:07 am

Do you have other JavaScripts? Try removing them, and see if the code works.


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


SLGray
Administrator
Administrator

Male Posts : 36747
Reputation : 2449
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Luffy on January 14th 2014, 1:09 am

I have other Javascripts but no-one is affecting the Select Content Javascript..






Luffy
Manager
Manager

Male Posts : 4258
Reputation : 424
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo on January 14th 2014, 3:30 am

Are you sure i thought as well and it turns out it was an issue with other scripts, try turning other ones off one by one.

Sir. Mayo
Forumember

Male Posts : 969
Reputation : 87
Language : English, Some french.
Location : Working 11Pm-7Am EST I will try to respond ASAP

http://sir-mayo.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Luffy on January 14th 2014, 12:48 pm

Javascripts:

Result:


Still nothing!






Luffy
Manager
Manager

Male Posts : 4258
Reputation : 424
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Van-Helsing on January 14th 2014, 1:24 pm

Hi dear all,
I was find another similar tutorial in avacweb http://www.avacweb.com/t925-suggestion-for-avacweb-select-all-in-codeboxes-i-m-including-the-method?highlight=select but when I am pressing the Select Content it scrolls up the forum.

Best Regards,
Dark-Avenger

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo on January 14th 2014, 5:52 pm

Can you link to a post on your forum where there is a code box please and thank you

Sir. Mayo
Forumember

Male Posts : 969
Reputation : 87
Language : English, Some french.
Location : Working 11Pm-7Am EST I will try to respond ASAP

http://sir-mayo.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by SLGray on January 14th 2014, 7:04 pm

Try using a different browser. If you are using Chrome, there are known issues with somethings not working in Chrome.


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


SLGray
Administrator
Administrator

Male Posts : 36747
Reputation : 2449
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Guest on January 14th 2014, 7:53 pm

Not working with me neither. I installed it and now my quote tag messed up. Now it outputs: Code: Select all

Guest
Guest


Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo on January 14th 2014, 9:14 pm

Marios94 wrote:Can you please try adding this code to yours and check if it shows? Because to me it doesn't show anything!

Code:
function selectCode(a)
  {
  // Get ID of code block
  var e = jQuery(a).closest('tr').next().find('.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();
  }
  }
  jQuery(function(){

  jQuery('div.postbody td.code').parent().prev().find('b').html('Code:
  <a href="javascript:void()" onClick="selectCode(this)"><font
  face="verdana" color="red"></font> Select Content </a>');
  });

This is the default code but it still doesn't show anything to me..

DId you test this code on a punbb forum that is the code for phbb2 ONLY. that why it would not work on a Punbb forum.


Sir. Mayo
Forumember

Male Posts : 969
Reputation : 87
Language : English, Some french.
Location : Working 11Pm-7Am EST I will try to respond ASAP

http://sir-mayo.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Guest on January 14th 2014, 9:26 pm

@Sir. Mayo wrote:
Marios94 wrote:Can you please try adding this code to yours and check if it shows? Because to me it doesn't show anything!

Code:
function selectCode(a)
  {
  // Get ID of code block
  var e = jQuery(a).closest('tr').next().find('.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();
  }
  }
  jQuery(function(){

  jQuery('div.postbody td.code').parent().prev().find('b').html('Code:
  <a href="javascript:void()" onClick="selectCode(this)"><font
  face="verdana" color="red"></font> Select Content </a>');
  });

This is the default code but it still doesn't show anything to me..

DId you test this code on a punbb forum that is the code for phbb2 ONLY. that why it would not work on a Punbb forum.

Dosen't work. I run PHPbb2. It pops up the select content but it wont select it & changes quote to code

Guest
Guest


Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo on January 14th 2014, 9:29 pm

Can you please link to a post that guests can see that has a code box so i can see the issue my self.

Sir. Mayo
Forumember

Male Posts : 969
Reputation : 87
Language : English, Some french.
Location : Working 11Pm-7Am EST I will try to respond ASAP

http://sir-mayo.forumotion.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Guest on January 14th 2014, 9:39 pm

@Sir. Mayo wrote:Can you please link to a post that guests can see that has a code box so i can see the issue my self.
I fixed the JS issue, I just removed the JS from it. To be honest it's just simply easier not to use it.

Guest
Guest


Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Van-Helsing on January 19th 2014, 9:04 am

Hi all,
I am using mozilla firefox and I am still facing the same problem, is it a bug of phpbb2 or the JS is wrong?

Best Regards,
Dark-Avenger

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by ifelthope1126 on January 19th 2014, 9:09 am

Hello, I have the same problem too on my two phpBB2 forums. I'm using Mozilla. I haven't added any JavaScript codes recently. The Select Content button one day has just dissapeared without any reason.

ifelthope1126
Forumember

Female Posts : 70
Reputation : 9
Language : Lithuanian, Russian, English

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Luffy on January 19th 2014, 11:05 am

@Sir. Mayo wrote:
Marios94 wrote:Can you please try adding this code to yours and check if it shows? Because to me it doesn't show anything!

Code:
function selectCode(a)
  {
  // Get ID of code block
  var e = jQuery(a).closest('tr').next().find('.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();
  }
  }
  jQuery(function(){

  jQuery('div.postbody td.code').parent().prev().find('b').html('Code:
  <a href="javascript:void()" onClick="selectCode(this)"><font
  face="verdana" color="red"></font> Select Content </a>');
  });

This is the default code but it still doesn't show anything to me..

DId you test this code on a punbb forum that is the code for phbb2 ONLY. that why it would not work on a Punbb forum.

I already said that i am using this code to a test forum that is PHPBB2.

Luffy
Manager
Manager

Male Posts : 4258
Reputation : 424
Language : Greek, English
Location : Greece

http://helpgr.forumgreek.com/forum

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Van-Helsing on January 22nd 2014, 9:23 am

Bump

Van-Helsing
Hyperactive

Male Posts : 2222
Reputation : 82
Language : English, Greek

http://helpgr.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Ange Tuteur on January 22nd 2014, 8:32 pm

Hello,

try switching your current script with this :
Code:
function selectCode(a){a=$(a).closest("dl").find(".cont_code,code")[0];if(window.getSelection){var c=window.getSelection();if(c.setBaseAndExtent)c.setBaseAndExtent(a,0,a,a.innerText.length-1);else{window.opera&&a.innerHTML.substring(a.innerHTML.length-4)=="<BR>"&&(a.innerHTML+=" ");var b=document.createRange();b.selectNodeContents(a);c.removeAllRanges();c.addRange(b)}}else document.getSelection?(c=document.getSelection(),b=document.createRange(),b.selectNodeContents(a),
c.removeAllRanges(),c.addRange(b)):document.selection&&(b=document.body.createTextRange(),b.moveToElementText(a),b.select())}
 
$(function(){
$("dl.codebox:not(.spoiler,.hidecode) > dd.code, dl.codebox:not(.spoiler,.hidecode) > dd > code").closest("dl").find('dt').append('<span onClick="selectCode(this)" class="selectCode">Select content</span>');
});

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by ifelthope1126 on January 22nd 2014, 8:42 pm

Yes, that almost worked for me! But this is how it looks like now:

I can't push the "Select Content" button.

ifelthope1126
Forumember

Female Posts : 70
Reputation : 9
Language : Lithuanian, Russian, English

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Ange Tuteur on January 22nd 2014, 8:58 pm

Click it, it works. Wink

Just add this CSS :
Code:
.selectCode { margin-left:10px; cursor:pointer; }

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by ifelthope1126 on January 22nd 2014, 9:01 pm

Now it works perfectly, thank you very much!Very Happy

ifelthope1126
Forumember

Female Posts : 70
Reputation : 9
Language : Lithuanian, Russian, English

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Ange Tuteur on January 22nd 2014, 9:12 pm

No problem Wink

If you want to change the hover color you can use this CSS :
Code:
.selectCode:hover { color:#f00; }

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top


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