Remove twitter analytics

Remove twitter anayltics button under tweets.

  1. // ==UserScript==
  2. // @name Remove twitter analytics
  3. // @namespace https://kem.ooo/
  4. // @version 1.1
  5. // @description Remove twitter anayltics button under tweets.
  6. // @author Kem0x
  7. // @license MIT
  8. // @match *://*twitter.com/*
  9. // @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. var observer = new MutationObserver(function(mutations) {
  17. document.querySelectorAll("[d]").forEach(e => {
  18. if (e.getAttribute("d") == "M8.75 21V3h2v18h-2zM18 21V8.5h2V21h-2zM4 21l.004-10h2L6 21H4zm9.248 0v-7h2v7h-2z")
  19. {
  20. const elm = e.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
  21. // alert(elm.children[0]);
  22. if(elm.children[0].getAttribute("href") && elm.children[0].getAttribute("href").includes("analytics"))
  23. {
  24. elm.parentNode.removeChild(elm);
  25. }
  26. }
  27. });
  28. });
  29.  
  30. observer.observe(document, {attributes: false, childList: true, characterData: false, subtree:true});
  31. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址