Difference between revisions of "MediaWiki:Common.js"
From CUGC Wiki
(Wait for $content to be added to page.) |
(Remove debugging statements.) |
||
(8 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
− | + | function waitForMathJax($content) { | |
− | function | + | if (typeof MathJax === 'undefined') { |
− | + | setTimeout(function () { waitForMathJax($content); }, 1000); | |
− | + | } else { | |
− | + | MathJax.Hub.Queue(["Typeset", MathJax.Hub, $content[0]]).execute(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
} | } | ||
− | mw.hook('wikipage.content').add( | + | |
+ | 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);