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.

Select content

3 posters

Go down

Solved Select content

Post by ifelthope1126 May 23rd 2014, 10:57 pm

Hello all!
I've waited for someone to post about this problem, but as I see nobody noticed this, or maybe that's not a problem at all. For me it is not a big problem too, but it's quite annoying. So, it's about "Select content" button. When I push that button, then copy selected text and paste it anywhere, I always get four extra spaces (not line-breaks, just spaces) at the beginning of the code. It happens on my forum, and on this forum too. It never happened earlier, while I was using old JavaScript code for that button. But one day it stopped working, and I got new JS. Here it is:

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

My question is, does this have any solution, or it is normal for select content function to act like that? If there is any way to fix it, I'll be very grateful for your ansvers. Any help appreciated!


Last edited by ifelthope1126 on May 23rd 2014, 11:41 pm; edited 1 time in total
ifelthope1126
ifelthope1126
Forumember

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

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Select content

Post by Derri May 23rd 2014, 11:04 pm

Hi,

Just to confirm, you click the 'select content' button and copy the content and then paste it and you get 4 spaces at the start of code. In this case the four spaces would appear before the word function, in the code above?
Derri
Derri
Helper
Helper

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

Back to top Go down

Solved Re: Select content

Post by ifelthope1126 May 23rd 2014, 11:24 pm

Yes, this is exactly what happens. I made a screenshot:
Select content Untitl10
I've copied and pasted random content, and in the beginning, where I highlighted red, you can see space, which I'm talking about. Just now I have noticed, that when I post the selected content, the spaces dissapear. So maybe it's not a big deal, I'm just a little confused, because this never happened with the old JS I've used.
ifelthope1126
ifelthope1126
Forumember

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

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Select content

Post by SLGray May 23rd 2014, 11:33 pm

When you send the post does the spaces appear in the final post?


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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Select content

Post by Derri May 23rd 2014, 11:33 pm

It could be a possible browser issue because when I copy/paste the selected content I don't actually get spaces. I use Google Chrome.
Derri
Derri
Helper
Helper

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

Back to top Go down

Solved Re: Select content

Post by Guest May 23rd 2014, 11:35 pm

Yes, the problem is within your browser. I checked your profile and saw that you're using Firefox, i try it on the same browser and i am currently experiencing the same problem.


Last edited by @Mark on May 23rd 2014, 11:37 pm; edited 2 times in total (Reason for editing : Mispelled)
avatar
Guest
Guest


Back to top Go down

Solved Re: Select content

Post by Derri May 23rd 2014, 11:36 pm

@Mark wrote:Yes, the problem is within your browser. I checked your profile and saw that you're using Firefox, i try it on the same browser and i am currently experiencing the same problem.

Thanks for checking Mark.
Derri
Derri
Helper
Helper

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

Back to top Go down

Solved Re: Select content

Post by SLGray May 23rd 2014, 11:38 pm

I am using Firefox, also. It does add spaces, but the final post does not have the spaces.


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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Solved Re: Select content

Post by ifelthope1126 May 23rd 2014, 11:40 pm

SLGray, no, the spaces doesn't appear in the final post.
And yes, I use Mozilla, never thought that this could be browser-related. Thank you guys for clearing this up for me! Solved Smile
ifelthope1126
ifelthope1126
Forumember

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

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Select content

Post by SLGray May 23rd 2014, 11:48 pm

Problem solved & topic archived.


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 : 51572
Reputation : 3525
Language : English
Location : United States

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

Back to top Go down

Back to top

- Similar topics

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