Configuration Dialog

A enhanced configuration dialog for Userscripts.

目前為 2019-02-08 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/45343/668866/Configuration%20Dialog.js

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

作者
Devy
版本
0.0.1.20190208100029
建立日期
2018-04-30
更新日期
2019-02-08
尺寸
30.9 KB
授權條款
未知

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(); });