docs.rs iosevka term font

change the default fonts on rust docs sites

当前为 2024-03-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name docs.rs iosevka term font
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.2
  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. // @icon https://www.google.com/s2/favicons?sz=64&domain=docs.rs
  11. // @grant none
  12. // @license MIT
  13. // ==/UserScript==
  14.  
  15. (function() {
  16. 'use strict';
  17.  
  18. // Select all elements with a class containing "font" (common for code blocks)
  19. const codeElements = document.querySelectorAll("div, a, ol, li, ul, p, pre, code, .font");
  20.  
  21. // Loop through each element
  22. codeElements.forEach(element => {
  23. // Set the font family to Iosevka Term
  24. element.style.fontFamily = "Iosevka Term, monospace";
  25. });
  26.  
  27. })();