MediaWiki:Gadget-mathjax.js

// adapted from https://ja.wikisource.org/wiki/MediaWiki:Gadget-mathjax.js // originally https://gist.github.com/pkra/794a1d9a35ae2428eaff

var mathTags = $('.mjax'); if (mathTags.length > 0){ //only do something when there's math on the page window.MathJax = { //hook into MathJax's configuration AuthorInit: function { MathJax.Hub.Register.StartupHook("End",function { //when MathJax is done...        MathJax.Hub.Queue( function{ mathTags.show; // .. make the span around the mathy part visible $('.mjax-fallback').hide; //hide fallback }       );      });    }  };  mw.loader.load('https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML');//load MathJax with a suitable combined config file }