MathJax for Reddit

Enables MathJax on reddit for the TeXtheWorld delimiters [; ... ;].

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(Tôi đã có Trình quản lý tập lệnh người dùng, hãy cài đặt nó!)

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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name       MathJax for Reddit
// @namespace
// @version    0.1
// @description Enables MathJax on reddit for the TeXtheWorld delimiters [; ... ;].
// @match      https://*.reddit.com/*
// @copyright
// @namespace https://greasyfork.org/users/399493
// ==/UserScript==
if (window.MathJax === undefined) {
    var script = document.createElement("script");
    script.type = "text/javascript";
    // script.src = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML";
    script.src = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_HTML";
    var config = 'MathJax.Hub.Config({ ' + 'extensions: ["tex2jax.js"], ' + 'tex2jax: { skipTags: ["script","noscript","style","textarea"],inlineMath: [ ["[;", ";]"] ], displayMath: [["[(;",";)]"]], processEscapes: true }, ' + 'jax: ["input/TeX", "output/HTML-CSS"] ' + ' }); ' + 'MathJax.Hub.Startup.onload(); ';
    if (window.opera) {
        script.innerHTML = config
    } else {
        script.text = config
    }
    document.getElementsByTagName("head")[0].appendChild(script);
    (doMathJax = function () {
        window.setTimeout(doMathJax, 1000);
        MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
    })();

} else {
    MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}