Open main menu

CUGC Wiki β

MediaWiki:Common.js

Revision as of 16:22, 12 March 2019 by TW466 (talk | contribs) (Wait for MathJax; debugging.)
/* Any JavaScript here will be loaded for all users on every page load. */

// MathJax typesetting in edit previews
function mathJaxTypeset() {
  function waitForMathJax() {
    if (typeof MathJax === 'undefined') {
      setTimeout(waitForMathJax, 1000);
      console.log('Waiting for MathJax.');
    } else {
      MathJax.Hub.Queue(["Typeset", MathJax.Hub, "wikiPreview"]).execute();
      alert('Found MathJax; typeset done.');
    }
  }
  waitForMathJax();
}
mw.hook('wikipage.content').add(mathJaxTypeset);