Anonymous

Changes

From CUGC Wiki

MediaWiki:Common.js

427 bytes removed, 17:52, 12 March 2019
See if MathJax can typeset detached elements.
/* Any JavaScript here will be loaded for all users on every page load. */
mw.hook('wikipage.content').add(function waitForMathJax(element$content) {
if (typeof MathJax === 'undefined') {
setTimeout(waitForMathJax, 1000);
console.log('Waiting for MathJax.');
} else {
MathJax.Hub.Queue(["Typeset", MathJax.Hub, element$content[0]).execute();
console.log('Found MathJax; typeset done.');
}
}
 
mw.hook('wikipage.content').add(function ($content) {
var element = $content[0];
var observer = new MutationObserver(function(mutations) {
if (document.contains(element)) {
console.log("It's in the DOM!");
observer.disconnect();
waitForMathJax(element);
} else {
console.log("Still waiting");
}
});
observer.observe(document, {attributes: false, childList: true, characterData: false, subtree: true});
});