Configuration Dialog

A enhanced configuration dialog for Userscripts.

Tính đến 08-02-2019. Xem phiên bản mới nhất.

Script này sẽ không được không được cài đặt trực tiếp. Nó là một thư viện cho các script khác để bao gồm các chỉ thị meta // @require https://update.greasyforks.org/scripts/45343/668865/Configuration%20Dialog.js

Tác giả
Devy
Phiên bản
0.0.1.20190208100029
Đã tạo
30-04-2018
Đã cập nhật
08-02-2019
Size
30 KB
Giấy phép
N/A

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(); });
长期地址
遇到问题?请前往 GitHub 提 Issues。