Select content
3 posters
Page 1 of 1
Select content
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:
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!
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
Re: Select content
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?
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- Helper
- Posts : 8711
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom
Re: Select content
Yes, this is exactly what happens. I made a screenshot:
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.
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.
Re: Select content
When you send the post does the spaces appear in the final post?
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
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.
Re: Select content
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- Helper
- Posts : 8711
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom
Re: Select content
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)
Guest- Guest
Re: Select content
@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- Helper
- Posts : 8711
Reputation : 638
Language : English & Basic French
Location : Scotland, United Kingdom
Re: Select content
I am using Firefox, also. It does add spaces, but the final post does not have the spaces.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
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.
Re: Select content
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
And yes, I use Mozilla, never thought that this could be browser-related. Thank you guys for clearing this up for me! Solved
Re: Select content
Problem solved & topic archived.
Lost Founder's Password |Forum's Utilities |Report a Forum |General Rules |FAQ |Tricks & Tips
You need one post to send a PM.
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.
Similar topics
» "select content"
» Select Content
» Select content button
» Code Of " Select Content"
» "Select Content" not working?
» Select Content
» Select content button
» Code Of " Select Content"
» "Select Content" not working?
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum