Github Code Font: Victor Mono

Makes Github's code font Victor Mono. Targets mobile Chrome-based browsers via Adguard for Android. Versions match Victor Mono npm pkg versions.

目前為 2024-11-28 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Github Code Font: Victor Mono
  3. // @namespace https://github.com/holyspiritomb
  4. // @author spiritomb
  5. // @version 1.5.6
  6. // @description Makes Github's code font Victor Mono. Targets mobile Chrome-based browsers via Adguard for Android. Versions match Victor Mono npm pkg versions.
  7. // @license MIT
  8. // @match https://github.com/*
  9. // @match https://*.github.com/*
  10. // @run-at document-start
  11. // @grant GM_addStyle
  12. // @grant GM_getResourceURL
  13. // @grant unsafeWindow
  14. // @homepageURL https://github.com/holyspiritomb/userscripts
  15. // @resource victorR https://cdn.jsdelivr.net/npm/victormono@1.5.6/dist/woff2/VictorMono-Regular.woff
  16. // @resource victorRW https://cdn.jsdelivr.net/npm/victormono@1.5.6/dist/woff2/VictorMono-Regular.woff2
  17. // @resource victorI https://cdn.jsdelivr.net/npm/victormono@1.5.6/dist/woff/VictorMono-Italic.woff
  18. // @resource victorIW https://cdn.jsdelivr.net/npm/victormono@1.5.6/dist/woff2/VictorMono-Italic.woff2
  19. // ==/UserScript==
  20. (function() {
  21. // this is hacky but it works?
  22. let victorRegular = GM_getResourceURL("victorR", false);
  23. let victorRegular2 = GM_getResourceURL("victorRW", false);
  24. let victorItalic = GM_getResourceURL("victorI", false);
  25. let victorItalic2 = GM_getResourceURL("victorIW", false);
  26. var css = "";
  27. css += `
  28. @font-face {
  29. font-family: "Victor Mono";
  30. src: url(${victorRegular2}) format("woff2"),
  31. url(${victorRegular}) format("woff");
  32. font-weight: 400;
  33. font-style: normal;
  34. font-display: swap;
  35. }
  36. @font-face {
  37. font-family: "Victor Mono";
  38. src: url(${victorItalic2}) format("woff2"),
  39. url(${victorItalic}) format("woff");
  40. font-weight: 400;
  41. font-style: italic;
  42. font-display: swap;
  43. }
  44. .CheckStep-line,
  45. .blob-code-inner,
  46. .commit-ref,
  47. code,
  48. pre,
  49. tt,
  50. .text-mono,
  51. kbd,
  52. code .link-gray,
  53. .markdown-body code,
  54. .markdown-body tt,
  55. .highlight pre,
  56. .markdown-body pre,
  57. .react-blob-print-hide,
  58. textarea#read-only-cursor-text-area,
  59. [class^='pl-']{
  60. font-family: "Victor Mono" !important;
  61. }
  62. .pl-c, .pl-c span{
  63. font-family: "Victor Mono" !important;
  64. font-style: italic !important;
  65. }
  66. `;
  67. if (typeof GM_addStyle != "undefined") {
  68. GM_addStyle(css);
  69. } else {
  70. let styleNode = document.createElement("style");
  71. styleNode.appendChild(document.createTextNode(css));
  72. (document.querySelector("head") || document.documentElement).appendChild(styleNode);
  73. }
  74. })();