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.

Select content button

3 posters

Go down

Solved Select content button

Post by Sir. Mayo 11.05.15 20:49

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 11.05.15 23:31; edited 1 time in total
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

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

Back to top Go down

Solved Re: Select content button

Post by Ange Tuteur 11.05.15 20:53

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
Ange Tuteur
Forumaster

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

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Select content button

Post by Sir. Mayo 11.05.15 23:31

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

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

Back to top Go down

Solved Re: Select content button

Post by Ape 13.05.15 14:05

Topic solved and archived


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

Male Posts : 19470
Reputation : 2013
Language : fluent in dork / mumbojumbo & English haha

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

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum