remove t.co

Bypass t.co redirection from Twitter external links

  1. // ==UserScript==
  2. // @name remove t.co
  3. // @description Bypass t.co redirection from Twitter external links
  4. // @namespace https://github.com/kkren
  5. // @match *://twitter.com/*
  6. // @grant none
  7. // @require https://cdn.jsdelivr.net/npm/jquery@2.2.4/dist/jquery.min.js
  8. // @run-at document-end
  9. // @version 0.5
  10. // ==/UserScript==
  11.  
  12.  
  13. function replace() {
  14. var i = 0;
  15. var urls = $("[href*='t.co']").length;
  16. for (; i < urls; i++) {
  17. if ($("[href*='t.co']").eq(i).attr("data-expanded-url") != undefined) {
  18. var expanded = $("[href*='t.co']").eq(i).attr("data-expanded-url");
  19. } else {
  20. var expanded = $("[href*='t.co']").eq(i).attr("title");
  21. }
  22. $("[href*='t.co']").eq(i).attr("href", expanded);
  23. }
  24. }
  25. //滚动加载
  26. mo = new MutationObserver(function(allmutations) {
  27. //alert();
  28. replace();
  29. });
  30. var targets = document.body;
  31. mo.observe(targets, {
  32. 'childList': true,
  33. 'characterData': true,
  34. 'subtree': true
  35. });
  36. replace();

QingJ © 2025

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