Replace Favicon for x.com

Replace the favicon of x.com with Twitter's favicon

  1. // ==UserScript==
  2. // @name Replace Favicon for x.com
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.1
  5. // @description Replace the favicon of x.com with Twitter's favicon
  6. // @author 6m
  7. // @license MIT
  8. // @match https://twitter.com/*
  9. // @match https://mobile.twitter.com/*
  10. // @match https://tweetdeck.twitter.com/*
  11. // @match https://x.com/*
  12. // @match https://mobile.x.com/*
  13. // @match https://tweetdeck.x.com/*
  14. // @exclude https://twitter.com/account/*
  15. // @exclude https://x.com/account/*
  16. // @grant none
  17. // ==/UserScript==
  18.  
  19. (function() {
  20. 'use strict';
  21.  
  22. // 创建新的 favicon 链接元素
  23. const newFavicon = document.createElement('link');
  24. newFavicon.rel = 'icon';
  25. newFavicon.type = 'image/x-icon';
  26. newFavicon.href = 'https://abs.twimg.com/favicons/twitter.ico';
  27.  
  28. // 查找并替换旧的 favicon
  29. const oldFavicon = document.querySelector('link[rel="icon"]');
  30. if (oldFavicon) {
  31. oldFavicon.parentNode.removeChild(oldFavicon);
  32. }
  33.  
  34. // 添加新的 favicon
  35. document.head.appendChild(newFavicon);
  36. })();

QingJ © 2025

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