projectdoc Toolbox

The projectdoc Toolbox installs a lot of macros and additional doctype add-ons install a lot of doctypes. This tips shows ways that allow to remove the projectdoc tools from the current page.

Type
Level of Experience

A Confluence installation may be used by a large number of users. Not all users will actually do use macros and doctypes from all installed add-ons.

The projectdoc Toolbox installs about 100 macros and with its extensions possibly even more blueprints. While this is typically good news for users of the projectdoc Toolbox, users that do not use it in their daily work would rather pass on having these tools in their views.

Those tools no member of any team needs could be deactivated by the Confluence admins. Blueprints may be demoted by space admins. But these approaches have two major short comings.

First, removing a macro or blueprint at Confluence level is an all-or-nothing solution. A small amount of users could take advantage the removed macros, but no longer have access to it.

Second: Demotion of blueprints would be needed on space level for every space. This includes a lot of manual work. Once new doctypes are installed, the related blueprints again needs to be handled in every space.

This short tip shows two approaches using scripts that can be executed from within the browser of a user. The scripts could be stored on a central server and installed to the browser. The first solution shows the use of a simple bookmarklet, the second solution introduces a userscript.

Prerequisites

For bookmarklets there are no prerequisites.

For userscripts a userscript manager like Grease Monkey or Tampermonkey must be installed to the browser. The userscript manager builds the context in which the script is executed.

Common Approach

The common approach to both solutions is that a JavaScript is run in the browser that matches HTML elements and alters them to be hidden. Therefore all elements are rendered as normal and then are hidden by the script.

Space Blueprint Wizard with projectdoc Blueprints

Space Blueprint Wizard without projectdoc Blueprints

Page Blueprint Wizard with projectdoc Blueprints

Screenshot showing the Blueprint Wizard with projectdoc Blueprints

Page Blueprint Wizard without projectdoc Blueprints

Screenshot showing the Blueprint Wizard without projectdoc Blueprints

Macro Browser with projectdoc Macros

Screenshot showing the Macro Browser with projectdoc Macros

Macro Browser without projectdoc Macros

Screenshot showing the Macro Browser without projectdoc Macros

Macro Suggestions with projectdoc Macros

Screenshot showing the Macro Suggestions with projectdoc Macros

Macro Suggestions without projectdoc Macros

Macro Suggestions without projectdoc Macros

Note that this use case is not properly supported the bookmarklet. A user will probably not run the bookmarklet manually when using the autocomplete function to select a macro.

Hide selectively?

 

The following examples show how to remove all macros or doctypes from the view.

In case you need to remove these tools selectively, you would need to adjust the CSS selectors in the scripts.

Bookmarklet Solution

The bookmarklet solution is easily installed as a bookmark in a browser. The advantage is that no additional tools are required. The disadvantage is that the user needs to open the bookmarklet to remove the elements from the page manually each time.

This solution may be appropriate in case the user only occasionally wants to remove the element.

hide-projectoc-tools.js
if (AJS) {
  AJS.toInit(function () {
    function hideElements($element) {
      if ($element) {
        $element.css("display", "none");
      }
    }

    function hideSpaceBlueprints() {
      const $templateElements = AJS.$('#create-dialog .templates .template[data-blueprint-module-complete-key*="projectdoc"][data-create-result="space"]');
      hideElements($templateElements);
    }
    function hidePageBlueprints() {
      const $templateElements = AJS.$('#create-dialog .templates .template[data-blueprint-module-complete-key*="projectdoc"]:not([data-create-result="space"])');
      hideElements($templateElements);
    }
    function hideMacros() {
      const $macroElements = AJS.$('#select-macro-page .dialog-page-body .macro-list-item[id*="projectdoc"]');
      hideElements($macroElements);
    }
    function hideAutocompleteMacros() {
      const $macroElements = AJS.$('li>a[class*="autocomplete-macro-projectdoc"]');
      if ($macroElements) {
        $macroElements.parent().css("display", "none");
      }
    }

    hideSpaceBlueprints();
    hidePageBlueprints();
    hideMacros();
    hideAutocompleteMacros();
  });
}

For more information on the bookmarklet, please visit Hide projectdoc Tools.

Userscript Solution

The userscript can be configured to be automatically executed on every page whose URL matches a regular expression. This way a user may select the script to remove element only on certain spaces, while leave them untouched on others.

A userscript is a JavaScript script with some metadata. It may also use services provided by the userscript manager context.

Failed to render

Cannot find resource 'https://bitbucket.org/smartics/projectdoc-bookmarklets/raw/master/src/main/resources/de/smartics/projectdoc/userscripts/Hide%20projectdoc%20Tools.user.js' (404: Not Found).

The following screenshot shows the script installed with Tampermonkey.

Screenshot showing the installed userscript in with Tampermonkey

You may want to edit the script and adjust the match URL to your Confluence server.

// @match        https://*/confluence/*

The browser plugin may also take care of automatically update the scripts. The source of the script could be hosted in a controlled environment. We recommend to copy the script to your server and alter it to meet your specific requirements.

For more information on the userscript, please visit Hide projectdoc Tools.

Deactivation of Blueprints

As mentioned in the introduction, blueprints can be deactivated in your Confluence instance.

This short example walks you through the steps to deactivate the projectdoc Blank Document Doctype. This doctype is a meant as a simple starter for new users. Once the team uses the Core Doctypes or has designed their own doctypes, this doctype is no longer needed.

Internal Problems after deactivating Module?

 

If modules are deactivated, the space blueprint wizard may fail. This is related to Space Wizard Dialog fails after deactivating Add-on.

So in case you have deactivated modules you may want to check if the space wizard dialog still opens.

  1. As an admin, go to Manage apps
  2. Select the app that contains the blueprint you want to deactivate
  3. Open the list of modules by clicking on the plus sign
     
  4. Deactivate the following modules for each doctype: The doctype template, the home and index page template, the blueprint and the wizard module.

For information on how to control blueprints on space level, please refer to the tip Overwhelmed with Blueprints?.

Resources

Hide projectdoc Tools
Hides blueprints and macros from wizards or autocomplete on the current page.
Bookmarklets
Using free bookmarklets in the context of projectdoc.
Community Resources
Information for users of the projectdoc Toolbox to extend the platform on Confluence.
Tampermonkey
The homepage of Tampermonkey.
Tampermonkey Documentation
Describes how the Tampermonkey API can be used and what is different to Geasemonkey.
Overwhelmed with Blueprints?
Templates are a great tool to make creating and maintaining documents very easy. Blueprints support authors to create documents based on templates. But a large number of blueprints may make it difficult for authors to select the appropriate template. Here are a few tips on dealing with larger amounts of blueprints.