Difference between revisions of "MediaWiki:Common.js"

From CUGC Wiki
(Fix mistakes.)
(Remove debugging statements.)
 
Line 4: Line 4:
 
   if (typeof MathJax === 'undefined') {
 
   if (typeof MathJax === 'undefined') {
 
     setTimeout(function () { waitForMathJax($content); }, 1000);
 
     setTimeout(function () { waitForMathJax($content); }, 1000);
    console.log('Waiting for MathJax.');
 
 
   } else {
 
   } else {
 
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
 
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
    console.log('Found MathJax; typeset done.');
 
 
   }
 
   }
 
}
 
}
  
 
mw.hook('wikipage.content').add(waitForMathJax);
 
mw.hook('wikipage.content').add(waitForMathJax);

Latest revision as of 16:55, 12 March 2019

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

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

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