Menu Buttons

You can add additional menu buttons using the configuration file menubuttons.json:

{
    "menubuttons": [
        {
          "menu": "main",
          "buttonid": "testbutton",
          "image": "bbuilder_newbutton_items.png",
          "text": "Test Button",
          "help": "This is a test button!",
          "scriptclasses": ["menu_test"],
          "conditions": []
        }
    ]
}

Currently supported are following menu types: main, admin, profilemore and adminactions

The scriptclasses property defines which script is run when you click the button, here the client-side class clientclasses/menu_test.js:

function onActivated() {
    let popup = GUI.showpopup({title: "Test Window"});
    popup.innerHTML = "This is a test window.<br><center><input type=\"submit\" value=\"Test Trigger\" id=\"testbutton\"></center>";
    var self = this;
    GUI.onclick("testbutton", function(event) {
        self.triggerserver("test", "123");
        GUI.hidepopup();
    });
}

This script is opening a new window with a button which is triggering an action on the server, add following server-side class scriptclasses/menu_test.js:

function onClientTest(pl, nr) {
    echo("triggered menu_test: " + nr);
    pl.showmessage("Received test trigger! " + nr);
}

PS: When you show a new popup window, it will automatically add a back button so that the user can return to the previous menu.