All Zoo's runtime API is available to JavaScript under Zoo
. Every JavaScript file gets their own version of Zoo
, though scripts shouldn't override Zoo's API anyway.
Zoo.meta
An object with all meta information of current Zoo script.
1type Meta = { 2 name?: string 3 /** Description of the script. */ 4 desc?: string 5 scriptUrl?: string 6 version?: string 7 runAt: 'document_start' | 'document_end' | 'document_idle' 8 allFrames: boolean 9 matchAboutBlank: boolean 10 matches?: string[] 11 excludeMatches?: string[] 12 includeGlobs?: string[] 13 excludeGlobs?: string[] 14}
Example:
1console.log(Zoo.meta.name)
Globs
Zoo doesn't support globs (yet), but it can be useful for you to know. Remember, using globs is discouraged for security reasons. includeGlobs
and excludeGlobs
are parsed from @include
and @exclude
keys in GreaseMonkey metadata blocks.
Zoo.clipboard
Version
Available since 1.4.
Clipboard operations.
writeText
Write a string to the clipboard. Unlike the Web Clipboard
API, it can be used on any website with or without a secure protocol. Also, Zoo's version of writeText
returns undefined
instead of a Promise
.
Example:
1Zoo.clipboard.writeText("Hello, clipboard!")