Difference between revisions of "MediaWiki:Common.js"
| Line 4: | Line 4: | ||
function waitForMathJax($content) { | function waitForMathJax($content) { | ||
if (typeof MathJax === 'undefined') { | if (typeof MathJax === 'undefined') { | ||
setTimeout(function () { waitForMathJax($content); }, | setTimeout(function () { waitForMathJax($content); }, 4000); | ||
} else { | } else { | ||
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute(); | MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute(); | ||
Revision as of 10:54, 16 February 2022
/* Any JavaScript here will be loaded for all users on every page load. */
/* add extra time to load math equations on mobile screens */
function waitForMathJax($content) {
if (typeof MathJax === 'undefined') {
setTimeout(function () { waitForMathJax($content); }, 4000);
} else {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute();
}
}
mw.hook('wikipage.content').add(waitForMathJax);