Remove twitter analytics

Remove twitter anayltics button under tweets.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Remove twitter analytics
// @namespace    https://kem.ooo/
// @version      1.1
// @description  Remove twitter anayltics button under tweets.
// @author       Kem0x
// @license      MIT
// @match        *://*twitter.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=twitter.com
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var observer = new MutationObserver(function(mutations) {
        document.querySelectorAll("[d]").forEach(e => {
            if (e.getAttribute("d") == "M8.75 21V3h2v18h-2zM18 21V8.5h2V21h-2zM4 21l.004-10h2L6 21H4zm9.248 0v-7h2v7h-2z")
            {
                const elm = e.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
                // alert(elm.children[0]);
                if(elm.children[0].getAttribute("href") && elm.children[0].getAttribute("href").includes("analytics"))
                {
                    elm.parentNode.removeChild(elm);
                }
            }
        });
    });

    observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true});
})();