User:Kxx/mathjax.js

(function {   var window = this, document = window.document, $ = window.$;    window.mathJax = {        Config: function {            var Hub = window.MathJax.Hub;            Hub.Config({ config: 'TeX-AMS_HTML.js', displayAlign: 'left', extensions: ['tex2jax.js'], jax: ['input/TeX', 'output/HTML-CSS'], menuSettings: { zoom: 'Click' },               tex2jax: { inlineMath: ',, ',, displayMath: '$', '$', processEscapes: true },               'v1.0-compatible': false, 'HTML-CSS': { mtextFontInherit: true, styles: { '.MathJax_Display': { margin: '0.8em 0em' }                   }                },            });            Hub.Startup.onload;        }    };    var spans = $('body span.tex');    if (spans.length > 0) {        var head = document.head;        var script = document.createElement('script');        script.type = 'text/x-mathjax-config';        script.text = 'mathJax.Config;'        head.appendChild(script);        script = document.createElement('script');        script.src = 'https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js';        head.appendChild(script);        spans.each(function { var node; for (node = this.previousSibling; node; node = node.previousSibling) if (node.nodeType === 1 || node.nodeType === 3 && node.data.trim.length !== 0) return; for (node = this.nextSibling; node; node = node.nextSibling) if (node.nodeType === 1 || node.nodeType === 3 && node.data.trim.length !== 0) return; this.textContent = '$\\displaystyle' + this.textContent.substr(1); });   } });