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.1
  5. // @description change the default fonts on rust docs sites
  6. // @author You
  7. // @match *://docs.rs/*, *://doc.rust-lang.org/*, *://crates.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=docs.rs
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Select all elements with a class containing "font" (common for code blocks)
  17. const codeElements = document.querySelectorAll("div, a, ol, li, ul, p, pre, code, .font");
  18.  
  19. // Loop through each element
  20. codeElements.forEach(element => {
  21. // Set the font family to Iosevka Term
  22. element.style.fontFamily = "Iosevka Term, monospace";
  23. });
  24.  
  25. })();