MediaWiki:Common.js: Difference between revisions

From openpipeflow.org
Jump to navigation Jump to search
(SimpleMathJax, wait for rendering)
 
mNo edit summary
Line 3: Line 3:
function waitForMathJax($content) {
function waitForMathJax($content) {
   if (typeof MathJax === 'undefined') {
   if (typeof MathJax === 'undefined') {
     setTimeout(function () { waitForMathJax($content); }, 1000);
     setTimeout(function () { waitForMathJax($content); }, 1500);
   } else {
   } else {
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();

Revision as of 16:51, 28 January 2020

/* Any JavaScript here will be loaded for all users on every page load. */

function waitForMathJax($content) {
  if (typeof MathJax === 'undefined') {
    setTimeout(function () { waitForMathJax($content); }, 1500);
  } else {
    MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
  }
}

mw.hook('wikipage.content').add(waitForMathJax);