Skip to content

Commit 74b930e

Browse files
Solve "declaring userscripts in the addon manifest" TODOs
1 parent 0aef308 commit 74b930e

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

content/docs/develop/userscripts/about-userscripts.md

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ Even though Scratch Addons userscripts are part of a browser extension, they can
2020
It's not necessary to reload the extension when changing the source of an already existing userscript JavaScript file. In those cases, reloading the page is enough.
2121
{{< /admonition >}}
2222

23-
<!-- TODO: revamp -->
23+
Userscripts are declared inside a "userscripts" array.
2424

25-
<!-- TODO: create a "matches" page -->
25+
Each item of the array must have the following properties:
26+
- `"url"`: the relative URL to a JavaScript file.
27+
- `"matches"`: the list of Scratch pages where the userscript will run. See [matches](/docs/reference/addon-manifest/#matches) for more information.
2628

27-
Go to the manifest of your addon (addon.json) and add a property called `userscripts"`.
28-
This property must be an array.
29-
Each item of the array must have the following properties: `"url"` and `"matches"`.
30-
`"url"` must be a relative URL to a JavaScript file.
31-
`"matches"` must be an array of URLs where you want to run the userscript on. You can use asterisks.
3229
Example manifest:
3330
```json
3431
{
@@ -37,11 +34,7 @@ Example manifest:
3734
"userscripts": [
3835
{
3936
"url": "userscript.js",
40-
"matches": ["https://scratch.mit.edu/*"]
41-
},
42-
{
43-
"url": "second_userscript.js",
44-
"matches": ["https://scratch.mit.edu/projects/*", "https://scratch.mit.edu/users/*"]
37+
"matches": ["projects", "https://scratch.mit.edu/", "profiles"]
4538
}
4639
],
4740
"tags": ["community"],

0 commit comments

Comments
 (0)