Tag view toggle (Chrome and Safari) for forum.keyboardmaestro.com

Valuable tagging work has recently been undertaken in the KM forum.

For moments when the tagging may feel like slightly too much information and visual clutter for a quick unimpeded glance, or reduces the number of posts that are visible on the screen, this macro toggles between the tagged view and a visually cleaner view without the tags.

The JavaScript (for Chrome and Safari) is an adaption (for toggling) of an original version by Onan of http://insomniacsoftware.com

Tag view toggle for forum.keyboardmaestro.com.kmmacros (23.8 KB)

Onan's original script is at: A tag-free view of the forum?

The source of this (toggling) draft is:

// Toggling version 0.1 is an edit by @complexpoint 

// Based on 
// ==UserScript==
// @name         Hide Discourse Tags
// @namespace    http://insomniacsoftware.com/
// @version      0.1
// @description  Simply hides the Discourse Tags
// @author       Onan of Insomniac Software
// @include      https://forum.keyboardmaestro.com/*
// ==/UserScript==

(function () {
  
    if (document.URL.indexOf(
		"forum.keyboardmaestro.com"
	) === -1) {
	return undefined
    };

    var css = [
        ".list-tags, .discourse-tags",
        "{ display: none !important; }"
    ].join("\n");

    var maybeNode = document.getElementById('tagtoggle'),
        blnMissing = maybeNode === null;

    if (blnMissing || maybeNode.textContent.length === 0) {
        var node = maybeNode || document.createElement("style");
        node.type = "text/css";
        node.id = "tagtoggle";
        node.appendChild(document.createTextNode(css));

        if (blnMissing) {
            var divs = document.getElementsByClassName("list-tags");
            if (divs.length > 0) {
                divs[0].appendChild(node);
            } else {
                document.documentElement.appendChild(node);
            }
        }
    } else {
        maybeNode.textContent = ""
    }
})();
3 Likes

Thank you! Getting rid of the tags is like turning off a loud radio. Some of us have attention issues and the tags were physically disruptive for me. It’s too bad Discourse can turn them on but not turn them off, but I’m grateful that Rob was sensitive to the need and contributed this macro

1 Like