Annyoying Font Remover

Remove annoying fonts to let the browser use less annoying fallbacks

当前为 2020-08-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Annyoying Font Remover
  3. // @description Remove annoying fonts to let the browser use less annoying fallbacks
  4. // @version 1.3
  5. // @author Me
  6. // @namespace gf.qytechs.cn/en/users/301031
  7. // @homepageURL https://gf.qytechs.cn/scripts/407513-annyoying-font-remover
  8. // @match *://*/*
  9. // @grant GM_addStyle
  10. // @run-at document-start
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. // ↓ Keep this list alphabetical otherwise it can become unmanageable.
  15. var badFnt = new RegExp ('"?'+
  16. ['arial[^",]*',
  17. 'courier[^",]*',
  18. 'dejavu sans mono',
  19. 'franklin gothic',
  20. 'freesans',
  21. 'georgia',
  22. 'helvetica[^",]*',
  23. 'liberation mono',
  24. 'libre baskerville',
  25. 'lucida[^",]*',
  26. 'roboto',
  27. 'roboto mono',
  28. 'roman',
  29. 'times[^",]*'].join('"?, ?|"?')+
  30. '"?, ?', 'gi');
  31. console.log(badFnt);
  32. document.addEventListener('DOMContentLoaded', function() {
  33. var elem = document.body.getElementsByTagName('*');
  34. for (var i = 0; i < elem.length; i++) {
  35. var fonts = window.getComputedStyle(elem[i]).getPropertyValue('font-family');
  36. if(fonts) {
  37. elem[i].style.fontFamily = fonts.replace(badFnt, '');
  38. // The "bug" is that the last listed fallback is selected,
  39. // even if it is one of the annoying fonts.
  40. }
  41. }
  42. });
  43. })();

QingJ © 2025

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