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

Compare with Current View Page History

Version 1 Next »

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 nobody needs, for instance a collection of macros, could be deactivated by the Confluence admins. Blueprints may be demoted by space admins. But this approach has 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. 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 brower 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 the bookmarklet there are no prerequisites.

For userscripts the browser needs to install a plugin like Grease Monkey or Tampermonkey.

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.

Bookmarklet Solution

The bookmarklet solution is easily installed as a bookmark in the 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.

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 within Browser.

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. The browser plugin may also take care of automatically update the scripts. It is recommended that the source of the script is hosted in a trusted environment. We recommend to copy the script to your server and alter it to meet your specific requirements.

Resources

Bookmarklets
Using free bookmarklets in the context of projectdoc.
Community Resources
Information for users of the projectdoc Toolbox to extend the platform on Confluence.

  • No labels