Greasy Fork is available in English.

CKUIToolkit

A simple settings modal framework.

Tento skript by nemal byť nainštalovaný priamo. Je to knižnica pre ďalšie skripty, ktorú by mali používať cez meta príkaz // @require https://update.greasyfork.org/scripts/441653/1034229/CKUIToolkit.js

Autor
CKylinMC
Verzia
1.2.1
Vytvorené
17.03.2022
Aktualizované
31.03.2022
Licencia
GPL-3.0-only

通过JSON/对象创建设置对话框

        const sampleCfg = {
            title: '设置',
            settings: [
                {
                    name: 'simple-text',
                    type: 'text',
                    label: '简单文本',
                }, {
                    name: 'simple-toggle',
                    type: 'toggle',
                    label: '简单开关',
                    description: '这是一个简单的开关',
                    value: false,
                }, {
                    name: 'simple-input',
                    type: 'input',
                    label: '简单输入框',
                    description: '这是一个简单的输入框',
                    value: '',
                }, {
                    name: 'simple-num-input',
                    type: 'inputnumber',
                    label: '简单数字输入框',
                    description: '这是一个简单的输入框',
                    value: 0,
                    min: 0,
                    max: 100,
                    step: 1,
                }, {
                    name: 'simple-long-input',
                    type: 'inputarea',
                    label: '简单长文本输入框',
                    description: '这是一个简单的输入框',
                    value: '',
                    checker: ()=>true,
                }, {
                    name: 'simple-select',
                    type: 'select',
                    label: '简单选择框',
                    description: '这是一个简单的选择框',
                    value: '',
                    options: [
                        { opt: '选项1', value: '1' },
                        { opt: '选项2', value: '2' },
                    ]
                }, {
                    name: 'text-toggle',
                    type: 'texttoggle',
                    description: '这是一个简单的选择框',
                    before: '开关当前处于',
                    on: '开',
                    off: '关',
                    after: '状态',
                    value: false,
                },{
                    name: 'simple-raw',
                    type: 'raw',
                    contents: {
                        text:'RAW!!!!'
                    },
                }, {
                    name: 'header',
                    type: 'header',
                    label: '分区A',
                }, {
                    name: 'btns',
                    type: 'btns',
                    btns: [
                        {
                            label: "1111111111111111111111111111",
                            onclick: async () => console.log(123)
                        },
                        {
                            label: "2222"
                        },
                        {
                            label: "3333"
                        },
                        {
                            label: "4444"
                        },
                    ],
                }, {
                    name: 'window-a',
                    type: 'window',
                    label: '窗口A',
                    config: {
                        title: '窗口A',
                        settings: [
                            {
                                name: 'window-a-sub-a',
                                type: 'text',
                                label: '窗口A子项A',
                            }
                        ]
                    }
                }
            ]
        };
        CKUIToolkit.showSettings(sampleCfg).then(it=>console.log('result:',it,'\nOrigin:',sampleCfg));