Greasy Fork is available in English.

Hide red dot from Slack icon

Hides the notification dot from Slack at all times. Rotates the Slack icon 90 degrees to confirm that it is working when you install it.

// ==UserScript==
// @name         Hide red dot from Slack icon
// @namespace    http://tampermonkey.net/
// @version      2024-10-16
// @description  Hides the notification dot from Slack at all times.  Rotates the Slack icon 90 degrees to confirm that it is working when you install it.
// @author       Yann Kaiser
// @match        https://app.slack.com/client/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=slack.com
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const iconUrl = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAKMWlDQ1BJQ0MgcHJvZmlsZQAASImdlndUU9kWh8+9N71QkhCKlNBraFICSA29SJEuKjEJEErAkAAiNkRUcERRkaYIMijggKNDkbEiioUBUbHrBBlE1HFwFBuWSWStGd+8ee/Nm98f935rn73P3Wfvfda6AJD8gwXCTFgJgAyhWBTh58WIjYtnYAcBDPAAA2wA4HCzs0IW+EYCmQJ82IxsmRP4F726DiD5+yrTP4zBAP+flLlZIjEAUJiM5/L42VwZF8k4PVecJbdPyZi2NE3OMErOIlmCMlaTc/IsW3z2mWUPOfMyhDwZy3PO4mXw5Nwn4405Er6MkWAZF+cI+LkyviZjg3RJhkDGb+SxGXxONgAoktwu5nNTZGwtY5IoMoIt43kA4EjJX/DSL1jMzxPLD8XOzFouEiSniBkmXFOGjZMTi+HPz03ni8XMMA43jSPiMdiZGVkc4XIAZs/8WRR5bRmyIjvYODk4MG0tbb4o1H9d/JuS93aWXoR/7hlEH/jD9ld+mQ0AsKZltdn6h21pFQBd6wFQu/2HzWAvAIqyvnUOfXEeunxeUsTiLGcrq9zcXEsBn2spL+jv+p8Of0NffM9Svt3v5WF485M4knQxQ143bmZ6pkTEyM7icPkM5p+H+B8H/nUeFhH8JL6IL5RFRMumTCBMlrVbyBOIBZlChkD4n5r4D8P+pNm5lona+BHQllgCpSEaQH4eACgqESAJe2Qr0O99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tMc+JHKxKiItiYCj1/weOlnsFEQtwiX7f5u+fkoyLjVZN0Kf5TRiSnsfmqcLf9dp85YDC79QYz6IdzXAh32gzCnTbDI7mIBjwqlVxIdNZT7wNFAIgCcYl2/kbjb7zeXPa/AGAUXEj0srS8/vyWb89taj1atm3YV/FQKeaVOfmyMHXUsAF4pYEbkhIgdIDbELEMp5722LPDBlBRy5fRhzYKwO27osEpEKdkc7VJTrfV11cLpiEDAiittBdVGZ0VvXkeiXqy8usXdmWBSA1bDi+AfpmwV9WVuOruXQ/YQ8HUs7TSXuTxUkHOYcVlPV+2aX/zupt1rms9gNrsFtet5itYIVMTp2BtP121r+Xg+S3E7eED2f4HEtJRUNYNafoAAAAASUVORK5CYII=";

    function replaceLink(linkNode) {
        if (linkNode.href !== iconUrl) {
            linkNode.href = iconUrl;
        }
    }


    new MutationObserver((mutationList, observer) => {
        for(const mutationRecord of mutationList) {
            console.log("mutationList", mutationRecord);
            switch (mutationRecord.type) {
                case "childList":
                    for(const addedNode of mutationRecord.addedNodes) {
                        console.log("addedNode", addedNode);
                        if (addedNode.tagName === "LINK" && addedNode.rel.includes("icon")) {
                            observer.observe(addedNode, {attributes: true, childList: false, characterData: false});
                            replaceLink(addedNode);
                        }
                    }
                    break;
                case "attributes":
                    if (mutationRecord.attributeName === "href") {
                        replaceLink(mutationRecord.target);
                    }
                    break;
                default:
            }
        }
    }).observe(document.head, {childList: true, attributes: false, characterData: false})

})();