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 button

View previous topic View next topic Go down

Solved Select content button

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

Hello,


I followed this TUT http://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

Sir. Mayo
Forumember

Male Posts : 969
Reputation : 87
Language : English, Some french.
Location : Working 11Pm-7Am EST I will try to respond ASAP

http://sir-mayo.forumotion.com/

Back to top Go down

Solved Re: Select content button

Post by Ange Tuteur on 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>')});

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: Select content button

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

@Sir. Mayo wrote:Hello,


I followed this TUT http://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

Sir. Mayo
Forumember

Male Posts : 969
Reputation : 87
Language : English, Some french.
Location : Working 11Pm-7Am EST I will try to respond ASAP

http://sir-mayo.forumotion.com/

Back to top Go down

Solved Re: Select content button

Post by APE on May 13th 2015, 3:05 pm

Topic solved and archived




APE
Manager
Manager

Male Posts : 8618
Reputation : 750
Language : fluent in dork / mumbojumbo & English haha
Location : STUCK IN FORUMOTIONS SERVERS HELP ME !!!!!!

http://chatworld.forumotion.co.uk/

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