mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Gadgets
synced 2024-12-18 18:00:36 +00:00
72cbb64069
Adds a contentModels option to gadget definitions to restrict gadgets to run in pages of the given content models only. Use-cases include gadgets for tabular data[1] (for Tabular .JsonConfig model), for editing map data[2] (for Map.JsonConfig model), and for showing links in code pages[3] (restricted to javascript, css, json, and scribunto models), as well as common gadgets like ProveIt[4] which can be restricted to wikitext model. [1]: https://commons.wikimedia.org/wiki/MediaWiki:Gadget-TabularImportExport.js [2]: https://fr.wikipedia.org/wiki/MediaWiki:Gadget-KartoEditor.js [3]: https://en.wiktionary.org/wiki/MediaWiki:Gadget-CodeLinks.js [4]: https://commons.wikimedia.org/wiki/Help:Gadget-ProveIt Bug: T204201 Bug: T63007 Change-Id: I7dcfc21d674ead8d710e7f77d13bf18bcad15079
114 lines
2.8 KiB
JSON
114 lines
2.8 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/schema#",
|
|
"description": "Gadget definition schema",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"settings": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"rights": {
|
|
"description": "The rights required to be able to enable/load this gadget",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"default": {
|
|
"description": "Whether this gadget is enabled by default",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"package": {
|
|
"description": "Whether this is gadget a packaged ResourceLoader module",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"hidden": {
|
|
"description": "Whether this gadget is hidden from preferences",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"targets": {
|
|
"description": "List of ResourceLoader targets the module can run on",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"default": [ "desktop" ]
|
|
},
|
|
"skins": {
|
|
"description": "Skins supported by this gadget; empty or true if all skins are supported",
|
|
"type": [ "array", "boolean" ],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"actions": {
|
|
"description": "Page actions on which to load the gadget",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"namespaces": {
|
|
"description": "Page namespaces in which to load the gadget",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "number"
|
|
}
|
|
},
|
|
"contentModels": {
|
|
"description": "Content models on which the gadget is supported",
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"category": {
|
|
"description": "Key of the category this gadget belongs to",
|
|
"type": "string",
|
|
"default": ""
|
|
},
|
|
"supportsUrlLoad": {
|
|
"description": "Whether this gadget supports ?withgadget query parameter",
|
|
"type": "boolean",
|
|
"default": false
|
|
},
|
|
"requiresES6": {
|
|
"description": "Whether this gadget requires ES6",
|
|
"type": "boolean",
|
|
"default": false
|
|
}
|
|
}
|
|
},
|
|
"module": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"scripts": {
|
|
"type": "array",
|
|
"description": "List of JavaScript pages included in this gadget"
|
|
},
|
|
"styles": {
|
|
"type": "array",
|
|
"description": "List of CSS pages included in this gadget"
|
|
},
|
|
"datas": {
|
|
"type": "array",
|
|
"description": "List of JSON pages included in this gadget"
|
|
},
|
|
"dependencies": {
|
|
"type": "array",
|
|
"description": "ResourceLoader modules this gadget depends upon"
|
|
},
|
|
"messages": {
|
|
"type": "array",
|
|
"description": "Messages this gadget depends upon"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|