Sign in to follow this  
Followers 0
zwim

extension issue mathML support

1 post in this topic

This is not an extension request, i'm just willing to share with Maxthon users a simple way to get support of mathML in the browser after having spent time on my own to get things to work properly.

 

You need to install ViolentMonkey extension to be able to run scripts :

http://extension.maxthon.com/detail/index.php?view_id=1680&category_id=

 

Then use the applet coming from this page below, it sends mathML code to MathJax online translater and display it back in the browser.

http://checkmyworking.com/misc/mathjax-bookmarklet/

 

For the sake of simplicity, you can just copy/paste the code below to ViolentMonkey

// ==UserScript==
// @name MathJax Bookmarklet
// @grant GM_addStyle 
// ==/UserScript==

javascript: (function()
{
    function e(e)
    {
        var t = '.MathJax .mn {background: inherit;} .MathJax .mi {color: inherit;} .MathJax .mo {background: inherit;}';
        var a = e.createElement('style');
        a.innerText = t;
        try
        {
            a.textContent = t
        }
        catch (n)
        {}
        e.getElementsByTagName('body')[0].appendChild(a);
        var i = e.createElement('script'),
            o;
        i.src = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML';
        i.type = 'text/javascript';
        o = 'MathJax.Hub.Config({tex2jax:{inlineMath:[[\'$\',\'$\']],displayMath:[[\'\\\\[\',\'\\\\]\']],processEscapes:true}});MathJax.Hub.Startup.onload();';
        if (window.opera) i.innerHTML = o;
        else i.text = o;
        e.getElementsByTagName('head')[0].appendChild(i)
    }

    function t(t)
    {
        if (t.MathJax === undefined)
        {
            e(t.document)
        }
        else
        {
            t.MathJax.Hub.Queue(new t.Array('Typeset', t.MathJax.Hub))
        }
    }
    var a = document.getElementsByTagName('iframe'),
        n, i;
    t(window);
    for (n = 0; n < a.length; n++)
    {
        i = a[n].contentWindow || a[n].contentDocument;
        if (!i.document) i = i.parentNode;
        t(i)
    }
})();

When this is done, activate the script in ViolentMonkey and go to this page for instance in order to test it :

https://developer.mozilla.org/fr/docs/Mozilla/MathML_Project/MathML_Torture_Test

 

Rem: For this to work you need to be in Ultra mode, this won't work in Retro mode.

 

Hope you will find this useful.  :)

1 person likes this

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0