Select content Hitskin_logo Hitskin.com

This is a Hitskin.com skin preview
Install the skinReturn to the skin page

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.
3 posters

    Select content

    ifelthope1126
    ifelthope1126
    Forumember


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

    Solved Select content

    Post by ifelthope1126 Fri May 23 2014, 23:57

    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 Sat May 24 2014, 00:41; edited 1 time in total
    Derri
    Derri
    Helper
    Helper


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

    Solved Re: Select content

    Post by Derri Sat May 24 2014, 00:04

    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?
    ifelthope1126
    ifelthope1126
    Forumember


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

    Solved Re: Select content

    Post by ifelthope1126 Sat May 24 2014, 00:24

    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.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Select content

    Post by SLGray Sat May 24 2014, 00:33

    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.
    Derri
    Derri
    Helper
    Helper


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

    Solved Re: Select content

    Post by Derri Sat May 24 2014, 00:33

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


    Solved Re: Select content

    Post by Guest Sat May 24 2014, 00:35

    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 Sat May 24 2014, 00:37; edited 2 times in total (Reason for editing : Mispelled)
    Derri
    Derri
    Helper
    Helper


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

    Solved Re: Select content

    Post by Derri Sat May 24 2014, 00:36

    @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.
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Select content

    Post by SLGray Sat May 24 2014, 00:38

    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.
    ifelthope1126
    ifelthope1126
    Forumember


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

    Solved Re: Select content

    Post by ifelthope1126 Sat May 24 2014, 00:40

    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
    SLGray
    SLGray
    Administrator
    Administrator


    Male Posts : 51497
    Reputation : 3523
    Language : English
    Location : United States

    Solved Re: Select content

    Post by SLGray Sat May 24 2014, 00:48

    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.