MediaWiki:Common.js: Difference between revisions

From openpipeflow.org
Jump to navigation Jump to search
(SimpleMathJax, wait for rendering)
 
mNo edit summary
 
(One intermediate revision by the same user not shown)
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); }, 2000);
   } else {
   } else {
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
     MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();

Latest revision as of 16:07, 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); }, 2000);
  } else {
    MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
  }
}

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