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.

Content Selection Code is not working?

+2
SLGray
Van-Helsing
6 posters

Page 1 of 2 1, 2  Next

Go down

Solved Content Selection Code is not working?

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

Hi dear all,
I am using this Tuturial https://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
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

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

Did you check all pages for the JavaScript?


Content Selection Code is not working? 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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Content Selection Code is not working?

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

Yes of course.
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

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

How is it not working?


Content Selection Code is not working? 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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by TheCrow 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..


Content Selection Code is not working? Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Content Selection Code is not working?

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

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


Content Selection Code is not working? 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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by TheCrow 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..


Content Selection Code is not working? Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Content Selection Code is not working?

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

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


Content Selection Code is not working? 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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by TheCrow January 14th 2014, 1:03 am

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


Content Selection Code is not working? Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Content Selection Code is not working?

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

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


Content Selection Code is not working? 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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by TheCrow January 14th 2014, 1:09 am

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


Content Selection Code is not working? Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo 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
Sir. Mayo
Forumember

Male Posts : 978
Reputation : 90
Language : English, Some french.
Location : you can also reach me on snoonet's irc server. I idle in #Techsupport Username is Vault108

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

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by TheCrow January 14th 2014, 12:48 pm

Javascripts:
Content Selection Code is not working? N0ro
Result:
Content Selection Code is not working? WrSpcU8

Still nothing!


Content Selection Code is not working? Thecro10
Forum of the Forums

Forumotion Rules | Tips & Tricks |
FAQ | Did you forget your password?



*** The Support Forum will never ask you for your email or password, so please do not post them anywhere! ***
No support via PM!
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Van-Helsing 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
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo 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
Sir. Mayo
Forumember

Male Posts : 978
Reputation : 90
Language : English, Some french.
Location : you can also reach me on snoonet's irc server. I idle in #Techsupport Username is Vault108

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

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by SLGray 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.


Content Selection Code is not working? 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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Content Selection Code is not working?

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


Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo 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
Sir. Mayo
Forumember

Male Posts : 978
Reputation : 90
Language : English, Some french.
Location : you can also reach me on snoonet's irc server. I idle in #Techsupport Username is Vault108

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

Back to top Go down

Solved Re: Content Selection Code is not working?

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


Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Sir. Mayo 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
Sir. Mayo
Forumember

Male Posts : 978
Reputation : 90
Language : English, Some french.
Location : you can also reach me on snoonet's irc server. I idle in #Techsupport Username is Vault108

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

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Guest 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.
avatar
Guest
Guest


Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Van-Helsing 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
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by ifelthope1126 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
ifelthope1126
Forumember

Female Posts : 107
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 TheCrow 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.
TheCrow
TheCrow
Manager
Manager

Male Posts : 6916
Reputation : 795
Language : Greek, English

https://www.inforumgr.com

Back to top Go down

Solved Re: Content Selection Code is not working?

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

Bump
Van-Helsing
Van-Helsing
Hyperactive

Male Posts : 2431
Reputation : 116
Language : English, Greek

http://itexperts.forumgreek.com/

Back to top Go down

Solved Re: Content Selection Code is not working?

Post by Ange Tuteur 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
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Content Selection Code is not working?

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

Yes, that almost worked for me! But this is how it looks like now:
Content Selection Code is not working? 8ww0
I can't push the "Select Content" button.
ifelthope1126
ifelthope1126
Forumember

Female Posts : 107
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 January 22nd 2014, 8:58 pm

Click it, it works. Wink

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

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Content Selection Code is not working?

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

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

Female Posts : 107
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 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
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Page 1 of 2 1, 2  Next

Back to top

- Similar topics

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