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.

Select content

View previous topic View next topic Go down

Solved Select content

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

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

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Select content

Post by Derri on 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?


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


Derri
Administrator
Administrator

Male Posts : 8385
Reputation : 576
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Select content

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

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.

ifelthope1126
Forumember

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

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Select content

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

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


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


SLGray
Administrator
Administrator

Male Posts : 36648
Reputation : 2443
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Select content

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


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


Derri
Administrator
Administrator

Male Posts : 8385
Reputation : 576
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Select content

Post by @Mark on 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)

@Mark
Forumember

Male Posts : 187
Reputation : 37
Language : HTML | CSS | Javascript | C | Java
Location : Republic of the Philippines

http://help.forumotion.com/

Back to top Go down

Solved Re: Select content

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


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


Derri
Administrator
Administrator

Male Posts : 8385
Reputation : 576
Language : English & Basic French
Location : Scotland, United Kingdom

Back to top Go down

Solved Re: Select content

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

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


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


SLGray
Administrator
Administrator

Male Posts : 36648
Reputation : 2443
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: Select content

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

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

http://sunset.forumtwilight.com

Back to top Go down

Solved Re: Select content

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

Problem solved & topic archived.


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


SLGray
Administrator
Administrator

Male Posts : 36648
Reputation : 2443
Language : English
Location : United States

http://ztwds.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