// StartMathJax Script
window.MathJax = {loader: {load: [ 'input/asciimath', 'ui/lazy', 'output/chtml', 'ui/menu']} };
(function() {
var script = document.createElement('script'); script.src = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/startup.js";
script.async = true;
document.head.appendChild(script);
})();
---------- (Different files) ----------
// UpdateTypeset Script
config = { attributes: true, childList: true, subtree: true };
// Callback function to execute when mutations are observed
callback = (mutationList, observer) => {
for (mutation of mutationList) {
if (mutation.type === 'childList') {
console.log('A child node has been added or removed.');
MathJax.typeset();
} else if (mutation.type === 'attributes') {
console.log(`The ${mutation.attributeName} attribute was modified.`);
}
}
};
// Create an observer instance linked to the callback function
observer = new MutationObserver(callback);
document.onreadystatechange = () => {
if (document.readyState === 'complete') {
console.log("Loaded fully according to readyState")
targetNode = document.getElementById('content-wrapper')
console.log(targetNode)
// Start observing the target node for configured mutations
observer.observe(targetNode, config);
}
}
top of page
bottom of page
Kommentarer