Skip to content
Dario Giovannetti edited this page Jan 27, 2018 · 2 revisions

WORK IN PROGRESS/OUT OF DATE: if you want to contribute or develop a plugin, just submit a bug requesting to update/complete this page ;) I'll be pleased to help you as soon as possible!

Development dependencies

The dependencies are defined in package.json, but for the moment the following are also needed:

For quick local testing use the auxiliary/WikiMonkey-local.js script. You can build just that instead of all the scripts with cake build, then serve it locally with cake serve, but you will need to run cake serve-gencert the first time in order to generate the SSL certificate. Finally install it with:

mw.loader.load('https://localhost:8080/auxiliary/WikiMonkey-local.js');

Useful links

API

Wiki Monkey's API is not documented yet: although the situation will be improved over time, if you need information about a particular function, or if you want to know what function you should use in order to make your plugin work, just ask a question in the issue tracker.

Plugins

This is a tutorial explaining how to develop plugins for Wiki Monkey.

Each plugin's code must either be put directly in the installed .user.js file, or saved in an external .js file, then required in the .user.js file's header with a @require statement.

Also, each plugin must have an entry in the configuration's JSON object.

PluginExample1.js

var PluginExample1 = new function () {
    this.main = function (args, callNext) {
        alert("Hello World");

        if (callNext) {
            callNext();
        }
    };
};

PluginExample2.js

var PluginExample2 = new function () {
    this.makeUI = function (args) {
        return document.createElement('div');
    };

    this.main = function (args, callNext) {
        alert("Hello World");

        if (callNext) {
            callNext();
        }
    };
};

PluginExample3.js

var PluginExample3 = new function () {
    this.mainAuto = function (args, title, callBot, chainArgs) {
        alert("Hello World");

        callBot(0, null);
    };

PluginExample4.js

var PluginExample4 = new function () {
    this.makeBotUI = function (args) {
        return document.createElement('div');
    };

    this.mainAuto = function (args, title, callBot, chainArgs) {
        alert("Hello World");

        callBot(0, null);
    };

PluginTemplate5.js

var PluginTemplate5 = new function () {
    var privateVariable = null;

    var privateFunction = function (args) {
        // put your code here
    };

    this.publicVariable = null;

    this.publicFunction = function (args) {
        // put your code here
    };

    this.makeUI = function (args) {
        // create and return a DOM element
    };

    this.makeBotUI = function (args) {
        // create and return a DOM element
    };

    this.main = function (args, callNext) {
       // put your code here

        if (callNext) {
            callNext();
        }
    };

    this.mainAuto = function (args, title, callBot, chainArgs) {
       // put your code here

        callBot(0, null);
    };