Skip to content

Commit e3d0e5c

Browse files
Complete "matches" documentation
1 parent 74b930e commit e3d0e5c

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

content/docs/reference/addon-manifest.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,33 @@ Each object must specify the url to the userscript/userstyle through the `url` p
239239
| - | - |
240240
| Type | `Array` |
241241

242-
Matches that allow the userscript/userstyle to run on. Values can be a URL match pattern, or `projects`, `projectEmbeds`, `studios`, `profiles`, `topics`, `newPostScreens`, `editingScreens`, `forums`, `scratchWWWNoProject`.
242+
{{< admonition info >}}
243+
Userscripts and userstyles are matched against the **initial URL** of the page. For example, userscripts/userstyles that only intend to affect the insides of the project editor must also run if the user is navigating to a project page, and vice versa.
244+
{{< /admonition >}}
245+
246+
Matches for the userscript/userstyle to run on. Values can be well-known matchers, URL match patterns, or regex patterns.
247+
248+
Well-known matchers:
249+
- `projects` (project page and editor routes, excluding project embeds)
250+
- `projectEmbeds`
251+
- `studios` (includes all 4 tabs inside studios)
252+
- `profiles`
253+
- `topics` (forum topics)
254+
- `newPostScreens`
255+
- `editingScreens` (forum routes with editing screens, including "change signature" page)
256+
- `forums` (all forum pages, except mobile forums)
257+
- `scratchWWWNoProject` (all scratch-www routes, except project pages)
258+
259+
URL match pattern examples:
260+
- `https://scratch.mit.edu/` (front page)
261+
- `https://scratch.mit.edu/*` (all pages)
262+
- `https://scratch.mit.edu/users/*/followers/` (Followers pages from all users)
263+
- `https://scratch.mit.edu/404` (pages that returned HTTP 404 status code - scratch-www pages usually never return 404)
264+
265+
Regex patterns:
266+
- `^https:(absolute-regex)`
267+
- `^(relative-regex)`
268+
243269
```json
244270
{
245271
"userscripts": [
@@ -249,7 +275,7 @@ Matches that allow the userscript/userstyle to run on. Values can be a URL match
249275
},
250276
{
251277
"url": "second_userscript.js",
252-
"matches": ["projects", "https://scratch.mit.edu/users/*"]
278+
"matches": ["projects", "https://scratch.mit.edu/users/*/followers/"]
253279
}
254280
]
255281
}

0 commit comments

Comments
 (0)