Files
browser-scripts-builder/meta.schema.json
2022-06-11 00:05:32 -05:00

124 lines
5.8 KiB
JSON

{
"$schema": "http://json-schema.org/draft-04/schema",
"$id": "https://git.zomo.dev/zomo/browser-scripts-builder/raw/branch/main/meta.schema.json",
"title": "UserScriptMeta",
"description": "UserScript metadata fields, from https://violentmonkey.github.io/api/metadata-block/",
"type": "object",
"properties": {
"$schema": {
"type": "string",
"description": "Read https://violentmonkey.github.io/api/metadata-block/ for more examples and information about metadata"
},
"name": {
"description": "The name of the script, shown in script list and menus",
"type": ["string", "object"],
"properties": {
"default": {
"type": "string"
}
},
"additionalProperties": {
"type": "string"
},
"required": ["default"]
},
"namespace": {
"description": "The combination of namespace and name is the unique identifier for a userscript",
"type": "string"
},
"match": {
"description": "Define rules to decide whether a script should be executed",
"type": ["string", "array"],
"uniqueItems": true,
"items": {
"type": "string"
}
},
"excludematch": {
"description": "Define rules to decide whether a script should be executed",
"type": ["string", "array"],
"uniqueItems": true,
"items": {
"type": "string"
}
},
"version": {
"description": "Version of the script, it can be used to check if a script has new versions",
"type": "string"
},
"description": {
"description": "A brief summary to describe the script",
"type": ["string", "object"],
"properties": {
"default": {
"type": "string"
}
},
"additionalProperties": {
"type": "string"
},
"required": ["default"]
},
"icon": {
"description": "Specify an icon for the script",
"type": "string"
},
"require": {
"description": "Require another script to execute before the current one\n\nThe value is the URL to the required script, which may be relative to the URL the script is being installed from",
"type": ["string", "array"],
"uniqueItems": true,
"items": {
"type": "string"
}
},
"resource": {
"description": "Static resources that can be accessed in the script by GM_getResourceText and GM_getResourceURL\n\nThe value is composed of two parts, joined with one or more white spaces\n\nThe first part is the name of the resource, no white space is allowed in it\n\nThe second part is the URL to the resource, which may be relative to the URL the script is being installed from",
"type": ["string", "array"],
"uniqueItems": true,
"items": {
"type": "string"
}
},
"runat": {
"description": "Decide when the script will execute\n\ndocument-end: (default) The script executes when DOMContentLoaded is fired\n\ndocument-start: The script executes as soon as possible\n\ndocument-idle: The script executes after DOMContentLoaded is fired, ensuring other resources like images are loaded",
"type": "string",
"enum": ["document-end", "document-idle", "document-start"]
},
"noframes": {
"description": "When present, the script will execute only in top level document, but not in nested frames",
"type": "boolean"
},
"grant": {
"description": "Specify which special APIs should be granted and can be used when the script executes\n\nIf nothing is present, \"none\" is assumed\n\nAny GM_ or GM. function used, including window.close and window.focus",
"type": ["string", "array"],
"uniqueItems": true,
"items": {
"type": "string"
}
},
"injectinto": {
"description": "Decide which context the script will be injected into\n\npage: Inject into context of the web page\nIn this mode, unsafeWindow refers to the window object, allowing the script to access JavaScript objects of the web page, just like normal page scripts can\n\ncontent: Inject into context of content scripts.\nIn this mode, unsafeWindow refers to the global object in content script. As a result, the script can access and modify the page's DOM, but cannot access JavaScript objects of the web page.\n\nauto: Try to inject into context of the web page. If blocked by CSP rules, inject as a content script.",
"type": "string",
"enum": ["page", "content", "auto"]
},
"downloadURL": {
"description": "The URL the script can be downloaded from",
"type": "string"
},
"supportURL": {
"description": "If supplied, the question mark icon in the user scripts list will link to this.",
"type": "string"
},
"homepageURL": {
"description": "If supplied, the home icon in the user scripts list will link to this.",
"type": "string"
},
"unwrap": {
"description": "If supplied, the script will be injected as is into the global scope of the page, i.e. without our standard wrapper like window.VMxxx=function(){...}.\n\nThe @grant key is ignored so the script won't have access to GM.* or GM_* API. ",
"type": "boolean"
}
},
"additionalProperties": false,
"required": ["name", "namespace", "version"]
}