Remove social media fact checks

Removes Twitter's fact checking info links on political tweets

目前为 2020-10-01 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Remove social media fact checks
  3. // @namespace Violentmonkey Scripts
  4. // @match *://twitter.com/*
  5. // @grant none
  6. // @version 1.0
  7. // @author qsniyg
  8. // @description Removes Twitter's fact checking info links on political tweets
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. var remove_editorial_svgs = function() {
  13. var svgs = document.querySelectorAll("article a > div > svg");
  14. for (var i = 0; i < svgs.length; i++) {
  15. var svg = svgs[i];
  16. var parent = svg.parentElement;
  17. if (parent.children.length !== 2)
  18. continue;
  19. if (parent.children[0] !== svg)
  20. continue;
  21. if (parent.children[1].tagName !== "SPAN")
  22. continue;
  23. var dparent = parent.parentElement;
  24. if (!/\/i\/+events\/+[0-9]{10,}(?:[?#].*)?$/.test(dparent.href))
  25. continue;
  26. dparent.style.setProperty("display", "none", "important");
  27. }
  28. };
  29. // 0.2% of script time, according to chrome's profiler on my computer
  30. setInterval(remove_editorial_svgs, 100);
  31. })();