docs.rs iosevka term font

change the default fonts on rust docs sites

当前为 2024-05-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name docs.rs iosevka term font
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9.4
  5. // @description change the default fonts on rust docs sites
  6. // @author You
  7. // @match *://docs.rs/*
  8. // @match *://doc.rust-lang.org/*
  9. // @match *://crates.io/*
  10. // @match *://rust-lang.github.io/*
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=docs.rs
  12. // @grant none
  13. // @license MIT
  14. // ==/UserScript==
  15.  
  16. (function() {
  17. 'use strict';
  18.  
  19. // Select all elements with a class containing "font" (common for code blocks)
  20. const codeElements = document.querySelectorAll("body, div, a, ol, li, ul, p, pre, code, .font, h1, h2, h3, h4, h5, h6");
  21.  
  22. // Loop through each element
  23. codeElements.forEach(element => {
  24. // https://stackoverflow.com/questions/38454240/using-css-important-with-javascript
  25. element.style = "font-family: Noto Sans Mono Condensed !important";
  26. element.style.fontSize = "1em";
  27. });
  28.  
  29. })();