Skip to content
ScriptCatScriptCat
首页
使用指南
开发指南
更新日志
关于我们
github icon
  • 开发指南

    • 简介
      • 后台脚本
        • 云端执行
          • 订阅模式
            • 用户配置
              • API 文档
                • CatApi 文档
                  • 描述文档

                  用户配置

                  calendar icon2021年5月26日timer icon大约 1 分钟

                  # 用户配置

                  ==UserConfig== 中的内容,应该在==UserScript== 后方,表示脚本的一些用户配置.配置信息的描述使用yamlopen in new window格式来进行编写:

                  /* ==UserConfig==
                  group1:
                    configA:                                # 键值为group.config,例如本键为:group1.configA
                      title: 配置A                          # 配置的标题
                      description: 这是一个文本类型的配置     # 配置的描述内容
                      type: text                            # 选项类型,如果不填写会根据数据自动识别
                      default: 默认值                       # 配置的默认值
                      min: 2                                # 文本最短2个字符
                      max: 18                               # 文本最长18个字符
                      password: true                        # 设置为密码
                    configB:
                      title: 配置B
                      description: 这是一个选择框的配置
                      type: checkbox
                      default: true
                    configC:
                      title: 配置C
                      description: 这是一个列表选择的配置
                      type: select
                      default: 1
                      values: [1,2,3,4,5]
                    configD:
                      title: 配置D
                      description: 这是一个动态列表选择的配置
                      type: select
                      bind: $cookies                       # 动态显示绑定的values,值是以$开头的key,value需要是一个数组
                    configE:
                      title: 配置E
                      description: 这是一个多选列表的配置
                      type: mult-select
                      default: [1]
                      values: [1,2,3,4,5]
                    configF:
                      title: 配置F
                      description: 这是一个动态多选列表的配置
                      type: mult-select
                      bind: $cookies
                    configG:
                      title: 配置G
                      description: 这是一个数字的配置
                      type: number
                      default: 1
                      min: 10  # 最小值
                      max: 16  # 最大值
                      unit: 分 # 表示单位
                  ---
                  group2:
                    configX:
                      title: 配置A
                      description: 这是一个文本类型的配置
                      default: 默认值
                   ==/UserConfig== */
                  
                  1
                  2
                  3
                  4
                  5
                  6
                  7
                  8
                  9
                  10
                  11
                  12
                  13
                  14
                  15
                  16
                  17
                  18
                  19
                  20
                  21
                  22
                  23
                  24
                  25
                  26
                  27
                  28
                  29
                  30
                  31
                  32
                  33
                  34
                  35
                  36
                  37
                  38
                  39
                  40
                  41
                  42
                  43
                  44
                  45
                  46
                  47
                  48
                  49
                  50
                  51
                  52

                  在此处定义完成后,将会在控制面板中显示配置按钮,供用户配置,开发者使用GM_getValue获取配置的值,key使用group.config来表示.

                  edit icon编辑此页open in new window
                  上次编辑于: 2022/4/16 05:35:31
                  贡献者: CodFrm,CodFrm,Hangover1230,Junzhou Liu
                  上一页
                  订阅模式
                  下一页
                  API 文档
                  Released under the MIT License Copyright © 2021-2022 ScriptCat 脚本猫