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.

[Code] code

View previous topic View next topic Go down

Solved [Code] code

Post by wittzi on November 29th 2013, 12:05 am

Hello, I am a newbie and I moderate a forum. I just wanna ask for help, if I can ask for the code of the [.code] of the forum? Or any ways to activate the key "Select all" , for my forum user's convenience. Any help is greatly appreciated.

wittzi
New Member

Posts : 5
Reputation : 1
Language : English

http://www.testforum.lightbb.com

Back to top Go down

Solved Re: [Code] code

Post by Luffy on November 29th 2013, 12:16 am

Try this code:

In Admin Panel -> Modules -> Javascript -> Create new,
name it: Select All Content
put this code in the other box:
Code:
function selectCode(a)
    {
    // Get ID of code block
    var e = jQuery(a).closest('tr').next().find('.cont_code')[0];

    // Not IE
    if (window.getSelection)
    {
    var s = window.getSelection();
    // Safari
    if (s.setBaseAndExtent)
    {
    s.setBaseAndExtent(e, 0, e, e.innerText.length - 1);
    }
    // Firefox and Opera
    else
    {
    // workaround for bug # 42885
    if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) == '<BR>')
    {
    e.innerHTML = e.innerHTML + ' ';
    }

    var r = document.createRange();
    r.selectNodeContents(e);
    s.removeAllRanges();
    s.addRange(r);
    }
    }
    // Some older browsers
    else if (document.getSelection)
    {
    var s = document.getSelection();
    var r = document.createRange();
    r.selectNodeContents(e);
    s.removeAllRanges();
    s.addRange(r);
    }
    // IE
    else if (document.selection)
    {
    var r = document.body.createTextRange();
    r.moveToElementText(e);
    r.select();
    }
    }
    jQuery(function(){

    jQuery('div.postbody td.code').parent().prev().find('b').html('Code:<a href="javascript:void()" onClick="selectCode(this)"><font
    face="verdana" color="red"></font> Select All Content </a>');
    });

And it should be done!






Luffy
Manager
Manager

Male Posts : 4035
Reputation : 407
Language : Greek, English
Location : Greece

http://www.thinktankforum.net

Back to top Go down

Solved Re: [Code] code

Post by wittzi on November 29th 2013, 12:36 am

Thank you. Shall I set it to solve or the Forum moderators will?

wittzi
New Member

Posts : 5
Reputation : 1
Language : English

http://www.testforum.lightbb.com

Back to top Go down

Solved Re: [Code] code

Post by Luffy on November 29th 2013, 12:37 am

You are welcome!

If it is solved then you can just write solved!

Or if you want you mark it to make their job easier!! Wink

Luffy
Manager
Manager

Male Posts : 4035
Reputation : 407
Language : Greek, English
Location : Greece

http://www.thinktankforum.net

Back to top Go down

Solved Re: [Code] code

Post by SLGray on November 29th 2013, 12:58 am

Topic Solved & Locked


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 35641
Reputation : 2374
Language : English
Location : United States

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