Page tree

 

A userscript is JavaScript code plus metadata that is executed on a web page rendered in a user's browser.

Userscripts for Confluence defines a userscript in form of a descriptor with a reference to the actual script code.

The userscript is configured for users by the administration team. Hence users can benefit from additional functions without bothering to validate the fitness of a script for their task by themselves. This makes extending Confluence easier, especially for team members without programming skills. While these additional features can be implemented in form of Confluence apps, many utilities simply rely on a short amount of JavaScript code. These few lines of code are easily shared and boost the productivity of teams.

The userscript consists of

  1. an identifier consisting of namespacename, and version
  2. a reference to the userscript code (script)
  3. metadata, like a description, a reference to further information (documentation), and an support
  4. an activation record (activation) that defines when the userscript is actually executed

The following fragment shows the basic structure of a userscript in JSON.

Userscript Descriptor in JSON
{
  "namespace": "...",
  "name": "...",
  "version": "...",

  "script": "...",

  "description": "...",
  "documentation": "...",
  "support": "...",

  "activation": {
    "space": ["...", ...],
    "category": ["...", ...],
    "label": ["...", ...],
    "group": ["...", ...],
    "user": ["...", ...]
  }
}

Differences to

The term userscript may refer to the JavaScript code or the userscript descriptor.

A userscript is typically JavaScript code that is executed on a web page when rendered in a user's browser. These scripts are usually configured by users to add additional functions on web pages they are visiting. A browser add-on allows users to add userscripts and define on which web pages they should run- These userscripts as supported by browser add-ons. The code contains its metadata in a comment section.

Userscripts for Confluence provides the metadata in form of an JSON external descriptor with a reference to the script. Both, the descriptor and the JavaScript code form the userscript.

Subordinate Glossary Items

The information a userscript provides can be categorizes by the following bundles.

Identifier
Identifies a userscript uniquely within a userscript service.
Code
Information relating to the Userscript code.
Metadata
Information relating to the Userscript.
Activation
Defines the context in which a userscript is actually executed.

Resources

More information on userscripts:

Userscript
Entry on Userscript on Wikipedia.
Userscript
A representation of a userscript resource.