Greasy Fork is available in English.

lib:strict

none

ผู้เขียน
rssa_romeo
จำนวนติดตั้งประจำวัน
0
จำนวนติดตั้งทั้งหมด
3
คะแนน
0 0 0
เวอร์ชัน
3
สร้างเมื่อ
10-04-2024
อัปเดตเมื่อ
15-05-2024
สัญญาอนุญาต
GPLv3
ปรับใช้กับ
ไซต์ทั้งหมด

example:

with (loadlib("strict")) {
      obj.forEach((obj) =>
        testformat(obj, {
          text: condfunc(({ key }) =>
            setformat({ type: key ? ["string", "none"] : ["string"] })
          ),
          key: condfunc(({ text }) =>
            setformat({ type: text ? ["string", "none"] : ["string"] })
          ),
          type: setformat({
            value: [
              "button",
              "boolean",
              "text",
              "number",
              "key",
              "none",
              "select",
              "range",
              "color",
              "array",
            ],
          }),
          forcelower: condfunc((obj) => {
            return setformat({
              value: ["text", "key"].includes(obj.type)
                ? [true, false, undefined]
                : [undefined],
            })
          }),
          tab: optional(setformat({ type: "number" })),
          innerstyle: optional(
            setformat(
              {},
              { allowextras: true, extrasformat: { type: ["string"] } }
            )
          ),
          outerstyle: optional(
            setformat(
              {},
              { allowextras: true, extrasformat: { type: ["string"] } }
            )
          ),
          buttontext: condfunc((obj) => {
            return setformat({
              type: obj.type == "button" ? ["string"] : ["none"],
            })
          }),
          hint: optional(setformat({ type: ["string"] })),
          onclick: condfunc((obj) => {
            return setformat({
              type:
                obj.type == "button" ? ["function", "asyncfunction"] : ["none"],
            })
          }),
          options: condfunc((obj) => {
            return setformat({
              type: obj.type == "select" ? ["array"] : ["none"],
            })
          }),
          oncontextmenu: condfunc((obj) => {
            return setformat({
              type:
                obj.type == "button" ? ["function", "asyncfunction"] : ["none"],
            })
          }),
          min: condfunc((obj) => {
            return setformat({
              type: obj.type == "range" ? ["number"] : ["none"],
            })
          }),
          max: condfunc((obj) => {
            return setformat({
              type: obj.type == "range" ? ["number"] : ["none"],
            })
          }),
          hinttype: condfunc((obj) => {
            return setformat({
              value: "hint" in obj ? ["text", "html"] : [undefined],
            })
          }),
          allowmodifiers: condfunc((obj) => {
            return setformat({
              value: obj.type == "key" ? [true, false] : [undefined],
            })
          }),
          keyreturntype: condfunc((obj) => {
            return setformat({
              value: obj.type == "key" ? ["object", "string"] : [undefined],
            })
          }),
        })
      )
    }

example used in https://greasyfork.org/en/scripts/492112-options-menu-lib-menu