Last active
August 5, 2023 18:30
-
-
Save hykilpikonna/f6afdd8382e2e989965a7cc408cb6762 to your computer and use it in GitHub Desktop.
Universal LXGW Wenkai Font Userscript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Universal Font | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.2 | |
| // @description Take over the world with your favorite font | |
| // @author Azalea | |
| // @match *://*/* | |
| // @grant GM_addStyle | |
| // @downloadURL https://gist.github.com/hykilpikonna/f6afdd8382e2e989965a7cc408cb6762/raw/userscript.js | |
| // @updateURL https://gist.github.com/hykilpikonna/f6afdd8382e2e989965a7cc408cb6762/raw/userscript.js | |
| // ==/UserScript== | |
| (function() { | |
| 'use strict'; | |
| const excludedStarting = ["fa-", "TEX-", "mjx-", "icon-"] | |
| const excludedEnding = ["-icon"] | |
| const excludedClasses = ['google-symbols', 'site-nav-icon'] | |
| const nots = excludedStarting.map(it => `:not([class^="${it}"]):not([class*=" ${it}"])`).join("") + | |
| excludedEnding.map(it => `:not([class$="${it}"]):not([class*="${it} "])`).join("") + | |
| excludedClasses.map(it => `:not(.${it})`).join("") | |
| const codeClasses = ['blob-code-content', 'CodeMirror'].map(it => `, .${it} *:not(i)${nots}`).join("") | |
| const style = ` | |
| *:not(i)${nots} { | |
| font-family: "LXGW Wenkai" !important; | |
| font-synthesis: none; | |
| } | |
| code *, pre *${codeClasses} { | |
| font-family: "LXGW Wenkai Mono" !important | |
| } | |
| ` | |
| GM_addStyle(style) | |
| console.log("Font added.") | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment