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 Code not working.

View previous topic View next topic Go down

In progress Select Content Code not working.

Post by The Life Less One on April 17th 2014, 1:19 pm

Hello so I used this tutorial to do the select content feature for my friends forum but it doesn't work for some reason.
http://help.forumotion.com/t93456-select-content-button the tutorial is there and the forum is version phpbb3 so I used the second code for it. When the code was copied and pasted into the javascript code management it seemed to work but whenever I or other members click it, it scrolls us up at the top Confused

Any ideas on how to solve this?

The Life Less One
New Member

Posts : 5
Reputation : 1
Language : English

http://yugiohzexalduelacade.forumotion.com/

Back to top Go down

In progress Re: Select Content Code not working.

Post by Needhelplease:( on April 17th 2014, 2:04 pm

Are you sure you followed everything "Correctly"?

Needhelplease:(
New Member

Posts : 4
Reputation : 1
Language : English

Back to top Go down

In progress Re: Select Content Code not working.

Post by The Life Less One on April 17th 2014, 2:10 pm

Yea javascript is enabled and it is also set to all pages. The indentations are also correct.

The Life Less One
New Member

Posts : 5
Reputation : 1
Language : English

http://yugiohzexalduelacade.forumotion.com/

Back to top Go down

In progress Re: Select Content Code not working.

Post by Michael_vx on April 17th 2014, 5:34 pm

hi try this code it working on my forum
javascript
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">code_select</span>');
    });
i guess you will need also to put this css code

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

i hope it works with you

Michael_vx
Forumember

Male Posts : 656
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

In progress Re: Select Content Code not working.

Post by Pizza Boi on April 17th 2014, 5:36 pm

Hi Very Happy

Are you using any other Javascript for the topics? Please post your forum Url so we can check if there are conflicting scripts.

Regards,
Pizza Boi

Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

In progress Re: Select Content Code not working.

Post by Ange Tuteur on April 17th 2014, 11:10 pm

Hello The Life Less One,

Since the last update to the editor the select content code on versions like phpbb2 stopped working. Over on FR support there's a code that should work for all versions, regardless.

Replace your script by :
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">Sélectionner le contenu</span>');
        });

Then add the following to your stylesheet :
Display > Colors > CSS stylesheet
Code:
.selectCode { float:right; text-transform: uppercase; cursor:pointer; }
div.cont_code { clear: right; }

Ange Tuteur
Forumaster

Male Posts : 13021
Reputation : 2684
Language : EN10, FR5
Location : Pennsylvania

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