projectdoc Toolbox

Removes projectdoc tools (blueprints and macros) from the current page.

Tags
Identifier
de.smartics.userscripts.confluence.hide-projectdoc-tools
Type
Repository
Since
1.0

The projectdoc tools (doctypes and macros) are removed in the following locations:

  1. Blueprints in the Blueprint Selection Wizard
  2. Macros in the Macro Browser
  3. Macros from the Autocomplete Menu

The userscript removes these elements provided by the projectdoc Toolbox, but the script can be easily adjusted to remove tools from other apps.

Code

The code of the script for reference.

hide-projectoc-tools.js
/*
 * Copyright 2019-2024 Kronseder & Reiner GmbH, smartics
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
"use strict";

AJS.toInit(function () {
  const bodyNodes = document.getElementsByTagName('body');
  if (bodyNodes.length > 0) {
    const targetNode = bodyNodes[0];
    const config = {attributes: true, childList: true, subtree: true};
    const callback = function (_mutationsList, _observer) {
      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();
        });
      } else {
        AJS.log("WARN: AJS not found in context, therefore no adjustment due to modifications.");
      }
    };
    const observer = new MutationObserver(callback);
    observer.observe(targetNode, config);
  } else {
    AJS.log("WARN: No body element found, modifications on this document are not tracked.");
  }
});

Details

The following screenshots show the bookmarklet in action.

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

Related Scripts

NameShort Description
Hide Page Elements
Hides a static set of elements on a Confluence page for different groups of users.
Hide Page Elements from Anonymous
Hides a static set of elements on a Confluence page.
Inspect Menu for projectdoc
Renders a menu with tools to inspect information from a projectdoc document, shown in the browser.
projectdoc Search Tool
Provides an interface to specify and launch queries for projectdoc documents.
Refactor projectdoc Document
Adds a refactor menu and checks the current document for property issues.
View Mode Landing Page
Hide elements to render a landing page for an audience.
View Mode Presentation
Hide elements to render a page for a presentation.

Resources

More information on this topic is available by the following resources.

Hide projectdoc Tools within Browser
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.
Hide projectdoc Tools
Bookmarklet: Hides blueprints and macros from wizards or autocomplete on the current page.
Hide projectdoc Tools
Userscript: Removes projectdoc tools (blueprints and macros) from the current page.
The projectdoc Toolbox for Atlassian Confluence
The projectdoc Toolbox supports agile teams in writing project documentation collaboratively. This is an introduction to use cases for and features of the projectdoc Toolbox.