Skip to content

Latest commit

 

History

History
283 lines (222 loc) · 6.94 KB

File metadata and controls

283 lines (222 loc) · 6.94 KB

Supported Metakeys & Metavalues

Basic Matas

Every script manager support.

name

attr value description
type String nonempty string
example My First Script
type Object default is required in Object type
Object.key String lang(:local) or 'default'
Object.value String
example name-object-example
default 'New Script'
exception InvalidMetaValue empty string in String type
exception InvalidMetaValue no default in Object type

name-object-example

{
  default: 'My First Script',
  'en': 'My First Script',
  'zh-TW': '我的第一個腳本'
}

description

similar to name

namespace

attr value description
type String nonempty string
example https://example.com
default 'npmjs.com/rollup-plugin-userscript-metablock'
exception InvalidMetaValue non String type
exception InvalidMetaValue empty string
exception InvalidMetaValue falsy

match

MatchPattern: https://developer.chrome.com/extensions/match_patterns

attr value description
type String valid MatchPattern
example 'https://*.example.com/'
type String[] every string is valid MatchPattern
example match-array-example
exception InvalidMetaValue invalid MatchPattern in String type
exception InvalidMetaValue include invalid MatchPattern in String[] type
exception InvalidMetaValue empty string
exception InvalidMetaValue falsy

match-array-example

[
  'https://*.example.com/',
  '*://*/*'
]

include

GlobURI: uri with glob * or RegExp string without escape

attr value description
type String valid GlobURI
example 'https://*' uri with glob *
example '/^https?://.*$/' RegExp string without escape
type String[] every string is valid GlobURI
example include-array-example
exception InvalidMetaValue invalid GlobURI in String type
exception InvalidMetaValue include invalid GlobURI in String[] type
exception InvalidMetaValue empty string
exception InvalidMetaValue falsy

include-array-example

[
  'https://www.example*',
  '/^https?://.*$/',
  '*'
]

exclude

similar to include

icon

attr value description
type String valid URI
example 'https://icon.com/favicon.ico'
exception InvalidMetaValue invalid URI in String type
exception InvalidMetaValue empty string
exception InvalidMetaValue falsy

require

attr value description
type String valid URI
example 'https://code.jquery.com/jquery.js'
type String[] every string is valid URI
example require-array-example
exception InvalidMetaValue invalid URI in String type
exception InvalidMetaValue include invalid URI in String[] type
exception InvalidMetaValue empty string
exception InvalidMetaValue falsy

require-array-example

[
  'https://code.jquery.com/jquery.js',
  'https://code.jquery.com/jquery-ui.js'
]

run-at

RUNAT-ENUM:

  • 'document-end'
  • 'document-start'
  • 'document-idle'
  • 'document-body' (only tm support)
  • 'context-menu' (only tm support, only chrome)

If value is not valid RUNAT-ENUM, set to default value.

attr value description
type String valid RUNAT-ENUM
default 'document-end'
example 'document-start'
exception InvalidMetaValue empty string
exception InvalidMetaValue falsy

resource

attr value description
type Object
Object.key String
Object.value String valid URI
example resource-object-example
exception InvalidMetaValue non Object type
exception InvalidMetaValue some Object.value is invalid URI
exception InvalidMetaValue falsy

resource-object-example

{
  css: 'https://example.com/example.css',
  csvdata: 'https://example.com/data.csv'
}

version

SemVer: https://semver.org/

attr value description
type String valid SemVer
example '1.0.0'
exception InvalidMetaValue need guess SemVer from yours
exception InvalidMetaValue empty string
exception InvalidMetaValue falsy

noframes

attr value description
type any non falsy
example true
exception InvalidMetaValue falsy

grant

work in progress

now any value just view as String

API:

attr value description
type String valid API by manager
example 'GM_getValue'
default 'none' always explicit 'none'
type String[] every string is valid API by manager
example grant-array-example
exception InvalidMetaValue invalid API by manager in String type
exception InvalidMetaValue include invalid API by manager in String[] type

grant-array-example

[
  'GM_getValue',
  'GM_setValue',
  'unsafeWindow'
]

antifeature

attr value description
type String valid ANTIFEATURE-ENUM
example 'ads'
type String[]
example antifeature-array-example
exception InvalidMetaValue invalid API by manager in String type
exception InvalidMetaValue include invalid API by manager in String[] type

SANDBOX-ENUM:

  • 'ads'
  • 'tracking'
  • 'miner'

antifeature-array-example

[
  'ads',
  'miner'
]

sandbox

(only tm support)

attr value description
type String valid SANDBOX-ENUM
example 'raw'
exception InvalidMetaValue invalid API by manager in String type

SANDBOX-ENUM:

  • 'raw'
  • 'JavaScript'
  • 'DOM'