Font Override

Force font for websites

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Font Override
// @version      1.5
// @description  Force font for websites
// @match        *://*/*
// @run-at       document-start
// @icon         https://www.google.com/s2/favicons?sz=64&domain=fifa.com
// @grant        none
// @namespace https://greasyfork.org/users/1538784
// ==/UserScript==

(function () {
    'use strict';

    const STYLE_ID = 'font-override-style';
    const FONT_STACK = '"Bahnschrift", "Segoe UI Variable Text", "Segoe UI", sans-serif';

    const styleText = `
        :root {
            --font-override-family: ${FONT_STACK};
        }

        :where(
            html, body, a, abbr, address, article, aside, b, blockquote, button, caption,
            cite, dd, details, dialog, div, dl, dt, em, figcaption, footer, h1, h2, h3,
            h4, h5, h6, header, input, label, legend, li, main, nav, ol, option, p,
            section, select, small, span, strong, summary, table, td, textarea, th,
            time, ul
        ):not(
            i,
            code,
            pre,
            kbd,
            samp,
            svg,
            canvas,
            [class*="material"],
            [class*="fa-"],
            [class*="icon"],
            [class*="glyph"],
            [class*="symbol"],
            [aria-hidden="true"],
            [role="img"]
        ) {
            font-family: var(--font-override-family) !important;
        }

        code,
        pre,
        kbd,
        samp {
            font-family: ui-monospace, Consolas, "Courier New", monospace !important;
        }
    `;

    function injectStyle(doc) {
        if (!doc || doc.getElementById(STYLE_ID)) return;

        const style = doc.createElement('style');
        style.id = STYLE_ID;
        style.textContent = styleText;
        (doc.head || doc.documentElement).appendChild(style);
    }

    injectStyle(document);
})();