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.
The forum of the forums
3 posters

    Select content button

    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

    Solved Select content button

    Post by Sir. Mayo May 11th 2015, 9:49 pm

    Hello,


    I followed this TUT https://help.forumotion.com/t93456-select-content-button but no select code button is showing up, any help would be nice.
    here  the code:
    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.setStart(a.firstChild, 0);b.setEnd(a,
     a.childNodes.length);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>')});

    CSS:

    Code:
    .selectCode { float:right; text-transform: uppercase; cursor:pointer; }
    div.cont_code { clear: right; }


    Last edited by Sir. Mayo on May 12th 2015, 12:31 am; edited 1 time in total
    Ange Tuteur
    Ange Tuteur
    Forumaster


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

    Solved Re: Select content button

    Post by Ange Tuteur May 11th 2015, 9:53 pm

    Did you edit the code at all ? It looks kind of messy scratch

    Try replacing it 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.setStart(a.firstChild, 0);b.setEnd(a, a.childNodes.length);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>')});
    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

    Solved Re: Select content button

    Post by Sir. Mayo May 12th 2015, 12:31 am

    Sir. Mayo wrote:Hello,


    I followed this TUT https://help.forumotion.com/t93456-select-content-button but no select code button is showing up, any help would be nice.
    here  the code:
    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.setStart(a.firstChild, 0);b.setEnd(a,
     a.childNodes.length);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>')});

    CSS:

    Code:
    .selectCode { float:right; text-transform: uppercase; cursor:pointer; }
    div.cont_code { clear: right; }

    Ange Tuteur wrote:Did you edit the code at all ? It looks kind of messy scratch

    Try replacing it 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.setStart(a.firstChild, 0);b.setEnd(a, a.childNodes.length);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>')});


    It turns out it was a Google tracking script i had installed. But i removed it and everything is find now thanks @Ange Tuteur
    Ape
    Ape
    Administrator
    Administrator


    Male Posts : 19325
    Reputation : 2005
    Language : fluent in dork / mumbojumbo & English haha

    Solved Re: Select content button

    Post by Ape May 13th 2015, 3:05 pm

    Topic solved and archived



    Select content button Left1212Select content button Center11Select content button Right112
    Select content button Ape_b110
    Select content button Ape1010

      Current date/time is September 22nd 2024, 11:20 pm