diff --git a/data-crystal.js b/data-crystal.js index e7c64b6..795fc4b 100644 --- a/data-crystal.js +++ b/data-crystal.js @@ -1,10 +1,10 @@ // ==UserScript== // @name Data Crystal monospace // @namespace github.com/euamotubaina -// @version 2024-12-15 +// @version 2024-12-28 // @description Upgrade monospace font // @author euamotubaina -// @match https://datacrystal.tcrf.net/* +// @match https://*.tcrf.net/* // @icon https://www.google.com/s2/favicons?sz=64&domain=tcrf.net // @grant none // @downloadURL https://raw.githubusercontent.com/euamotubaina/userscripts/main/data-crystal.js @@ -14,15 +14,12 @@ (() => { 'use strict'; - window.addEventListener("load", () => { - // console.log(document.querySelectorAll("link[rel=stylesheet]")) - const linkEls = document.querySelectorAll("link[rel=stylesheet]"); - if (linkEls) { - const preStyle = [...linkEls[1].sheet.cssRules].find(rule => rule.selectorText == 'textarea, pre, code, tt'); - if (preStyle) { - preStyle.style.fontFamily = `"Roboto Mono", ${preStyle.style.fontFamily}`; - } - } - }); + const customMonoEl = document.createElement('style'); + customMonoEl.textContent = ` +textarea, pre, code, tt { + font-family: 'Roboto Mono', 'DejaVu Sans Mono', 'Droid Sans Mono', 'Lucida Console', monospace; +}`; + document.head.appendChild(customMonoEl); + })();