Fandom Developers Wiki
Advertisement

CustomComments is a versatile script that allows administrators to easily customize comments or messages for users in a given group.

Installation

Customization

This script adds custom classes to user's comments and messages in the selected group.

Adding groups

The recommended way to add user groups is through the MediaWiki:Custom-comment-groups.json page on your wiki, as this allows for fast and easy customization without it going through the review process. However, by doing it this way, you need to make sure you do not introduce any errors in the JSON as doing so can cause the custom comments to stop working. You may copy this example and customize it to your liking. (Note: when creating this page, you will see two braces {} in the page. These must be removed before adding anything.)

[
    {
        "group": "group1",
        "users": ["User1", "User2", "User3"]
    },
    {
        "group": "group2",
        "users": ["User4", "User5", "User6"]
    }
]

Alternatively, you may define window.customCommentGroups in your MediaWiki:Common.js file. This method is simpler to understand, but doing it this way means that any changes must be reviewed before going live. This can delay the changes made to the groups. Again, you may use the example below to customize the users in the group.

window.customCommentGroups = [
    {
        group: "group1",
        users: ["User1", "User2", "User3"]
    },
    {
        group: "group2",
        users: ["User4", "User5", "User6"]
    }
];

Using configuration options with Fandom Developers Wiki scripts

The instructions on this page describe how to use configuration options with a script. Here on the Fandom Developers Wiki, many scripts provide optional configuration settings as a mean to alter or enhance the default behavior of the script. When installing configuration options in your JavaScript file, please note that they need to go above the import statement in order to work — unless the directions say otherwise. In case MediaWiki:ImportJS is used to load the scripts, it will be executed last.

Configuration options load too late, don't work
// 1. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});

// 2. AjaxRC configuration option
window.ajaxRefresh = 30000;
Proper placement of configuration options
// 1. AjaxRC configuration option
window.ajaxRefresh = 30000;

// 2. AjaxRC import statement
importArticles({
    type: 'script',
    articles: [
        'u:dev:MediaWiki:AjaxRC.js'
    ]
});

Note: in both examples, the group name cannot have spaces and are case-sensitive when using CSS to customize the classes.

Styling comments

Styling is pretty straightforward. Comments and messages for users in a group will have a special class added to them. The above examples have users put into group1 and group2. You may copy and customize the following example to your MediaWiki:Common.css file.

/* You can unify how the comments and messages appear for the users in a group using this example. */
.comment-group1, .message-group1 {
    background-color: lightblue;
    border: 2px solid black;
    /* Additional CSS */
}

/* Alternatively, you can change the appearance of both comments and messages by using this example, or if you prefer one not to have any custom styling you can leave it out. */
.comment-group2 {
    background-color: orange;
    border: 2px solid red;
    /* Additional CSS */
}

.message-group2 {
    background-color: cyan;
    border: 2px solid green;
    /* Additional CSS */
}
Text above can be found here (edit)
Advertisement