Github Code Font: Victor Mono

Makes Github's code font Victor Mono. Targets mobile Chrome-based browsers via Adguard for Android. Versions match Victor Mono npm pkg versions.

Από την 04/02/2025. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

You will need to install an extension such as Tampermonkey to install this script.

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         Github Code Font: Victor Mono
// @namespace    https://github.com/holyspiritomb
// @author       spiritomb
// @version      1.5.6
// @description  Makes Github's code font Victor Mono. Targets mobile Chrome-based browsers via Adguard for Android. Versions match Victor Mono npm pkg versions.
// @license      MIT
// @match        https://github.com/*
// @match        https://*.github.com/*
// @run-at       document-start
// @grant        GM_addStyle
// @grant        GM_getResourceURL
// @grant        unsafeWindow
// @icon         https://www.google.com/s2/favicons?domain=github.com
// @homepageURL  https://github.com/holyspiritomb/userscripts
// @homepage     https://github.com/holyspiritomb/userscripts
// @resource     victorR https://cdn.jsdelivr.net/npm/[email protected]/dist/woff/VictorMono-Regular.woff
// @resource     victorRW https://cdn.jsdelivr.net/npm/[email protected]/dist/woff2/VictorMono-Regular.woff2
// @resource     victorI https://cdn.jsdelivr.net/npm/[email protected]/dist/woff/VictorMono-Italic.woff
// @resource     victorIW https://cdn.jsdelivr.net/npm/[email protected]/dist/woff2/VictorMono-Italic.woff2
// ==/UserScript==

(function() {
    // this is hacky but it works?
    let victorRegular = GM_getResourceURL("victorR", false);
    let victorRegular2 = GM_getResourceURL("victorRW", false);
    let victorItalic = GM_getResourceURL("victorI", false);
    let victorItalic2 = GM_getResourceURL("victorIW", false);
    var css = "";
    css += `
            @font-face {
                font-family: "Victor Mono";
                src: url(${victorRegular2}) format("woff2"),
                    url(${victorRegular}) format("woff");
                font-weight: 400;
                font-style: normal;
                font-display: swap;
            }
            
            @font-face {
                font-family: "Victor Mono";
                src: url(${victorItalic2}) format("woff2"),
                    url(${victorItalic}) format("woff");
                font-weight: 400;
                font-style: italic;
                font-display: swap;
            }
            
            .CheckStep-line,
            .blob-code-inner,
            .commit-ref,
            code,
            pre,
            tt,
            .text-mono,
            kbd,
            code .link-gray,
            .markdown-body code,
            .markdown-body tt,
            .highlight pre,
            .markdown-body pre,
            .react-blob-print-hide,
            textarea#read-only-cursor-text-area,
            [class^='pl-']{
                font-family: "Victor Mono" !important;
            }
            .pl-c, .pl-c span{
                font-family: "Victor Mono" !important;
                font-style: italic !important;
            }
    `;
    if (typeof GM_addStyle != "undefined") {
        GM_addStyle(css);
    } else {
        let styleNode = document.createElement("style");
        styleNode.appendChild(document.createTextNode(css));
        (document.querySelector("head") || document.documentElement).appendChild(styleNode);
    }
})();