Page tree

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

 

Userscripts for Confluence is one way to implement userscripts for users of a Confluence server. This article introduces alternatives.

Audience
Level of Experience

Userscripts allow to execute code in the browser of a website user. The code is controlled by the user, hence the term 'userscript'.

A userscript may alter styles of page elements, for instance to increase the font size or alter the contrast for better readability. The script may remove or add page element, like removing images or multimedia elements. They may also provide actions users often want to execute on a page per shortcut or they may be executed automatically dependent on a given context.

There are a couple of ways to put userscripts to execution in the browser of Confluence users. This short article introduces a couple of approaches.

Browser Userscripts

Userscripts managed by users in their browsers by a userscript manager is the classical way of using userscripts. Greasmonkey and Tampermonkey are tools to be installed by users in their browsers as plugins to control the execution of userscripts.

These tools allow users to specify the context in which installed userscripts should be executed. This may be as simple as a URL or URL pattern.

The userscripts are managed by the users themselves. This puts the freedom to choose as well as the burden to find, install, and update userscripts in the hand of the users.

Bookmarklets

Bookmarklets are Javascript code stored as bookmarks in the browser users. They can be used without any further technology, like plugins required by browser userscripts, but are sometimes not easy to use because of security barriers imposed by the browser. The script also needs to be encoded to be stored in a bookmark. Although this is an easy transformation of the original JavaScript code, this is also an obstacle preventing easy use for unexperienced users.

When userscripts can be executed manually or automatically, bookmarklets are only available for manual execution. Users need to click a bookmark stored in their browser to execute the code. Besides this limitations bookmarklets have the same advantages for users in the sense that they are free to choose their tools, but need to find, install, and update their bookmarklets individually.

Userscripts for Confluence

Userscripts for Confluence allow to adminstrate userscripts on a Confluence server on behalf of the users. The advantage is that the administration team of a Confluence servers tightly controls the code that is executed on their users' browsers. They can centrally select, install, and update userscripts, making it easier for unexperienced users to take advantage of userscript functions. Although the team has certainly the expertise to check the code for security or other issues.

In this scenario users are no longer free to use the scripts they need. So if the administration team does not install a particular userscript, it is not available.

Confluence Apps

Confluence allows to install apps to enlarge the functions of Confluence. These apps may provide userscripts and configure them to execute in specific contexts.

Basically the userscripts written for Userscripts for Confluence can be easily adapted, bundled in an app and deployed by the Confluence administration team. From the users' view the result would not be any different as the approach with the Userscripts for Confluence app.

The advantage of Userscripts for Confluence would be that it is more lightweight. The administration of the userscripts is only dependent on the code and does not require an additional project, knowledge of app development, including Maven as a build management tool etc. It may also be considered easier to activate individual scripts, although this could be realized by putting a single JavaScript in each app.

Summary

Experienced users may be best served by classic userscripts or bookmarklets. This way they are in full control over which code to execute under which circumstances.

For unexperienced users it is probably easier to allow the administration team to provide the additional services by central installation. The burden of selecting the tools, checking the code for security and other issues, and updating the code for new versions or due to alteration of the Conflunce server is then located on the administration team. The administration team may choose between a simple app like Userscripts for Confluence or choose to create one or more projects to provide these additional features by their own app.

  • No labels