Moderator tools for the message editor

2 posters

Go down

Moderator tools for the message editor Empty Moderator tools for the message editor

Post by Mihai June 7th 2021, 7:22 pm

Hi all,

Recently, we developed a message editor tool that allows administrators and moderators to use an unlimited number of predefined texts.

Demonstration
Images:
Moderator tools for the message editor Screen11
Moderator tools for the message editor Screen10


Documentation
Instrument configuration:

Code:

var zModConfig = [{
    icon: "https://i.servimg.com/u/f58/11/80/17/98/chat-110.png",
    source : "https://cdn.rawgit.com/zeusmaximus/Moderation-tools-for-Forumotion/4a66d49/script.js",
    loadCss: true,
    fontAwesome: true
}];

Variable zModConfig is responsible for configuring the tool, it contains:

  • icon - the URL of the icon in the message editor;
  • source - the URL of the complete JavaScript code;
  • loadCss - allows values true or false. Value true load the css via JavaScript again false will not load the css. If you choose false you will have to add the manual css on the forum here https://github.com/zeusmaximus/Moderation-tools-for-Forumotion/blob/master/style.css
  • fontAwesome - allows values true or false. Value true loads FontAwesome with JavaScript, and false will not load the font. I recommend setting the value false if you have already added Font Awesome to the forum by another method.



Adding new categories:

The texts that you will add in the editor must be assigned to certain categories, variable zModGroups will help you do that:

  • id - any natural number;
  • name - the name of the category to display in the editor.


var zModGroups = [

]
;

Add between the two square brackets:
Code:

{
        id: 0,
        name: 'Group 1'
},
Repeat the procedure until you get the desired number of categories. For the last category in parentheses, the comma at the end is not required.


If for example we want to add 5 categories, the code will look like this:
Code:

var zModGroups = [{
        id: 0,
        name: 'Group 1'
},
{
        id: 1,
        name: 'Group 2'
},
{
        id: 2,
        name: 'Group 3'
},
{
        id: 3,
        name: 'Group 4'
},
{
        id: 4,
        name: 'Group 5'
}];

Adding new tables:

Using the variable zModTabels you can define how many tables you want, it contains:

  • type - represents the name of the table;
  • body_start - opening BBCode and/or HTML tags;
  • body_end - closing BBCode and/or HTML tags.


var zModTabels  = [

]
;

Add the square brackets of this variable:
Code:

{
        type: "bold",
        body_start: '[b]',
        body_end: "[/b]"
},

Repeat the procedure until you get the desired number of tables. The comma at the end is not required for the last table in parentheses.


Adding new texts:

Texts are added by variable zModMessages.

name  - the name of the predefined text;
message - the predefined text that will be inserted in the editor;
group_id - category id. it is dependent on the variable zModGroups;
type - the name of the desired table. it is dependent on the variable zModTabels.

var zModMessages. = [

]
;

Add between the two square brackets:

Code:

{
        name: "The name of your text",
        message: 'Hi !\n This is my default text.',
        group_id: 0,
        type: "bold"
},

Repeat the procedure until you get the desired number of predefined texts. For the last category in parentheses, the comma at the end is not required.

Code JavasScript
Add in: Panel > Modules > HTML & JAVASCRIPT > Javascript code management > Create a new JavaScript code


  • Title: Moderator tools for the message editor
  • Location: All Pages
  • Code:

    Code:

    /**
     * Title        : Forumotion tools for moderation
     * Version      : 1.0.2
     * Author        : Zeus
     * Author URI    : http://help.forumgratuit.ro
     * License      : GNU - General Public License v3.0
     * Documentation : https://github.com/zeusmaximus/Moderation-tools-for-Forumotion/
     * Last update  : May 28, 2017 at 16:03
     */
    var zModConfig = [{
        icon: "https://i58.servimg.com/u/f58/11/80/17/98/chat-110.png",
        source : "https://rawgit.com/SSYT/-Zeus-Moderation-tools-for-Forumotion/master/script.js",
        loadCss: true,
        fontAwesome: true
    }];
    var zModTabels = [{
            type: "zalert",
            body_start: '[table class="zmod_box zalert"][tr][td style="padding-right: 10px;" width="60px;"][icon="fa fa-exclamation-circle"][/icon][div]',
            body_end: "[/div][/td][/tr][/table]\n\n"
        },
        {
            type: "zsuccess",
            body_start: '[table class="zmod_box zsuccess"][tr][td style="padding-right: 10px;" width="60px;"][icon="fa fa-check"][/icon][div]',
            body_end: "[/div][/td][/tr][/table]\n\n"
        },
        {
            type: "zdefault",
            body_start: '[table class="zmod_box zdefault"][tr][td style="padding-right: 10px;" width="60px;"][icon="fa fa-rocket"][/icon][div]',
            body_end: "[/div][/td][/tr][/table]\n\n"
        },
        {
            type: "zwarning",
            body_start: '[table class="zmod_box zwarning"][tr][td style="padding-right: 10px;" width="60px;"][icon="fa fa-exclamation-triangle"][/icon][div]',
            body_end: "[/div][/td][/tr][/table]\n\n"
        },
        {
            type: "zinfo",
            body_start: '[table class="zmod_box zinfo"][tr][td style="padding-right: 10px;" width="60px;"][icon="fa fa-info"][/icon][div]',
            body_end: "[/div][/td][/tr][/table]\n\n"
        }
    ];
    var zModMessages = [{
            name: "Alert example",
            message: '[b]Alert[/b] \nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
            group_id: 0,
            type: "zalert"
        },
        {
            name: "Success example",
            message: '[b]Success[/b] \nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
            group_id: 0,
            type: "zsuccess"
        },
        {
            name: "Default example",
            message: '[b]Default[/b] \nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
            group_id: 1,
            type: "zdefault"
        },
        {
            name: "Warning example",
            message: '[b]Warning[/b] \nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
            group_id: 1,
            type: "zwarning"
        },
        {
            name: "Info example",
            message: '[b]Info[/b] \nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
            group_id: 1,
            type: "zinfo"
        }
    ];
    var zModGroups = [{
            id: 0,
            name: 'Administrators'
        },
        {
            id: 1,
            name: 'Moderators'
        }
    ];
    $.getScript(zModConfig[0].source, function(textStatus) {
        console.log( "zModStatus:" + textStatus);
    });

Mihai
Mihai
Forumember

Male Posts : 302
Reputation : 17
Language : Romanian, English
Location : Bucharest, Romania

View user profile https://help.forumgratuit.ro/

TonnyKamper likes this post

Back to top Go down

Moderator tools for the message editor Empty Re: Moderator tools for the message editor

Post by Ape June 7th 2021, 8:50 pm

Please translate all the text on your Codes before posting them.


Moderator tools for the message editor Left1212Moderator tools for the message editor Center11Moderator tools for the message editor Right112
Moderator tools for the message editor Ape_b110
Moderator tools for the message editor Keep_s10
Moderator tools for the message editor Ape1010
Ape
Ape
Administrator
Administrator

Male Posts : 16786
Reputation : 1817
Language : fluent in dork / mumbojumbo & English haha

View user profile http://chatworld.forumotion.co.uk/

pedxz likes this post

Back to top Go down

Back to top


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