Greasy Fork is available in English.

Configuration Dialog

A enhanced configuration dialog for Userscripts.

Este script no debería instalarse directamente. Es una biblioteca que utilizan otros scripts mediante la meta-directiva de inclusión // @require https://update.greasyfork.org/scripts/45343/759338/Configuration%20Dialog.js

Autor
Devy
Versión
0.0.1.20191220072345
Creado
30/04/2018
Actualizado
20/12/2019
Licencia
Desconocida

Configuration dialog for Grease- and Tampermonkey Userscripts.

More information

Requirements

  • // @grant GM_getValue
  • // @grant GM_setValue
  • JQuery 2.1.1+

Configuration Example

{
    'title': 'Test Window', //Title of the window
    'id': 'settings_window', //ID of the window div

    "theme": "mac/win10/winXP", //Select a theme for the window
    'theme_selector': true, //Show Theme-Selector
    'theme_section_color': true, //Section color matches the window style

    "height": "75", //Initial height in percent
    "width": "75", //Initial width in percent

    'confirm_close': "Ungespeicherte Änderungen. Wirklich verwerfen?", //Confirm message on dialog close without having saved
    'confirm_revert': "Alle Änderungen verwerfen?", //Confirm message for reseting the current changes
    'confirm_reset': "Einstellungen auf Standard zurücksetzen?", //Confirm message for factory reset

    "top": {
        "minimize": "true", //Option to show minimize button
        "maximize": "true", //Option to show maximize button
        "close": "true" //Option to show close button
    },

    "font": {
        "size": "18px",  //Font size of content
        "family": "Consolas" //Font family of content
    },

    "savebutton": "true",  //Display of save button
    "revertbutton": "true", //Display of revert button
    "completeresetbutton": "true", //Display of factory reset button

    'content':
    [
        {
            "type": "p",
            "label": "This is just a normal Text."
        },
        {
            "type": "h1",
            "label": "This ist just a normal header."
        },
        {
            "type": "section",
            "label": "I'm a section",
            "collapsible": true,    //If section should be collapsible
            "collapsed": false      //If section should be collapsed by default
        },
        {
            "type": "subsection",
            "label": "I'm a subsection"
            "collapsible": true,    //If subsection should be collapsible
            "collapsed": false      //If subsection should be collapsed by default
        },
        {
            "label": "Text input field",
            "type": "input",
            "id": "username",
            "default": "default name"
        },
        {
            "label": "Checkbox",
            "type": "checkbox",
            "id": "checkbox",
            "default": false
        },
        {
            "type": "subsection",
            "label": "I'm a subsection"
        },
        {
            "label": "Dropdown field",
            "type": "select",
            "id": "selection",
            "options": [ "Pizza", "Pasta", "Cookies", "Döner" ],
            "default": "Cookies",
            "require": "checkbox"   //Requires the checkbox "checkbox" to be checked, otherwise it gets disabled
        },
        {
            "label": "Numeric field",
            "type": "numeric",
            "id": "numeric",
            "default": "0",
            "min": "10",
            "max": "40"
        },
        {
            "label": "Color field",
            "type": "color",
            "id": "color",
            "default": "#000000"
        },
    ]
}

Load a Configuration

configurationWindow.create( <JSON CODE> );

Show Configuration Window

configurationWindow.open();

Open Configuration Window via the context menu

  • // @grant GM_registerMenuCommand
GM_registerMenuCommand("Menu Item Name", function() { configurationWindow.open(); });