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.

Add Code snippet to the editor

Go down

Add Code snippet to the editor

Post by Zzbaivong on February 23rd 2016, 6:06 am

Inspired by the code snippet in help forumotion, I wrote this script, but using font bbcode instead of the table bbcode. This will allow more flexible use, for example, copied bbcode to other forums not available to this script.


How to set up?

Go to Admin Panel > Modules > JavaScript codes management and create a new script with the following settings:
Title: Code snippet
Placement: In all the pages
jQuery(function($) {

    'use strict';

    $('head').append($('<style>', {
        text: '.sceditor-button-inline-code div{background-image:url(!important}.post-entry font[face="monospace"]{color:green;background:#f4f4f4;padding:0 5px;display:inline-block;margin:0 3px;border-radius:2px}'

    if (!$.sceditor) return;

    $(function() {
        $('#text_editor_textarea').sceditor('instance').css('font[face="monospace"]{color:green;background:#f4f4f4;padding:2px 5px;display:inline-block;margin:-2px 3px;border-radius:2px}');

    function inlineCode(editor) {
        editor.insert('[font=monospace]', '[/font]');

    $.sceditor.command.set('inline-code', {
        exec: function() {
        txtExec: function() {
        tooltip: 'Code snippet'

    toolbar = toolbar.replace(/code/, 'code,inline-code');

Save the script. Done.

Last edited by Zzbaivong on May 16th 2016, 9:46 am; edited 1 time in total

Posts : 100
Reputation : 50
Language : JavaScript ^^

Back to top Go down

Re: Add Code snippet to the editor

Post by Abdalah_98 on May 16th 2016, 8:35 am

Not worked to me ?


Male Posts : 32
Reputation : 1
Language : EN,AR
Location : Earth :D

Back to top Go down

Back to top

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