MathJax for All

Uses MathJax to properly display LaTeX code, on any site

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name       MathJax for All
// @version    0.4
// @description Uses MathJax to properly display LaTeX code, on any site
// @namespace 1993.uk
// @match https://mail.google.com/*
// @match file:///*
// ==/UserScript==
if (window.MathJax === undefined) {
    var mjscr = document.createElement("script");
    mjscr.type = "text/javascript";
    mjscr.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js";
    mjscr.text = 'MathJax.Hub.Config({extensions:["tex2jax.js"],'+"tex2jax:{inlineMath:[['$','$']]"
        +',skipTags:["script","noscript","pre","code"]},jax:["input/TeX","output/CommonHTML"],'
        +'TeX:{extensions:["autoload-all.js","noUndefined.js"]}'
        +'});MathJax.Hub.Startup.onload();';
    document.getElementsByTagName("head")[0].appendChild(mjscr);

    (new MutationObserver(function(mutationsList, observer) {
        let el = [];
        for (const mutation of mutationsList) {
            const node = mutation.addedNodes.item(0);
            if (node === null || node.nodeType !== 1 || node.className == "MathJax_Preview" || node.id.substring(0,7) == "MathJax" || node.className.substring(0,4) == "mjx-" || node.isContentEditable) break;
            if (node.offsetParent !== null && node.innerText != "") el.push(node);
        }
        if (el.length != 0) MathJax.Hub.Queue(["Typeset", MathJax.Hub,el,{}]);
    })).observe(document,{subtree: true, childList: true});
}