Greasy Fork 还支持 简体中文。

docs.rs iosevka term font

change the default fonts on rust docs sites

目前為 2024-07-17 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name docs.rs iosevka term font
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9.7
  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. // @match *//www.linusakesson.net/*
  12. // @icon https://www.google.com/s2/favicons?sz=64&domain=docs.rs
  13. // @grant none
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. // Select all elements with a class containing "font" (common for code blocks)
  21. const codeElements = document.querySelectorAll("div, a, ol, li, ul, p, pre, code, .font, h1, h2, h3, h4, h5, h6");
  22.  
  23. // Loop through each element
  24. codeElements.forEach(element => {
  25. // https://stackoverflow.com/questions/38454240/using-css-important-with-javascript
  26. element.style = "font-family: NotoSansM NFM Cond Med !important";
  27. element.style.fontSize = "1em";
  28. });
  29.  
  30. // Select all elements with a class containing "font"
  31. const bodyElements = document.querySelectorAll("body");
  32.  
  33. // Loop through each element
  34. bodyElements.forEach(element => {
  35. // https://stackoverflow.com/questions/38454240/using-css-important-with-javascript
  36. element.style = "line-height: normal; font-family: NotoSansM NFM Cond Med !important";
  37. });
  38.  
  39.  
  40. })();