Change Website Font (Online Hosting)

Use an externally hosted font on all websites

  1. // ==UserScript==
  2. // @name Change Website Font (Online Hosting)
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Use an externally hosted font on all websites
  6. // @author You
  7. // @match https://www.milkywayidle.com/*
  8. // @match https://www.bilibili.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. // Use a font from GitHub or Dropbox
  16. const fontURL = "https://raw.githubusercontent.com/MatoAsakura/fontsupport.github.io/main/ComicNeue-Bold.ttf"; // Replace with your direct link
  17.  
  18. const fontName = "MyOnlineFont";
  19. const fontSize = "14px";
  20.  
  21. let style = document.createElement('style');
  22. style.innerHTML = `
  23. @font-face {
  24. font-family: '${fontName}';
  25. src: url('${fontURL}') format('woff2');
  26. font-weight: normal;
  27. font-style: normal;
  28. }
  29.  
  30. * {
  31. font-family: '${fontName}', sans-serif !important;
  32. font-weight: 550 !important;
  33. font-size: ${fontSize} !important;
  34. }
  35. `;
  36. document.head.appendChild(style);
  37. })();