MathJax.Hub.Register.StartupHook("End", function () {} in version 3.
Created by: apatel401
Hi I am working in a project where we use brightspace and brightspace is injecting math script which is not needed because we are already hosting it on our end. The problem is brightspace is injecting v3 and we have hosted version of 2.7.5 and there is conflict in the version and v3 takes over v2 and some of our dynamic widgets are not loading math and the one that are loaded are very gigantic size font compare to regular text.
Now the problem is we had a script running after math was loaded using MathJax.Hub.Register.StartupHook("End", function () {} but not sure what to use in version 3. I have tried this but it doesn't work either
window.MathJax = {
options: {
menuOptions: {
settings: {
inTabOrder: false
}
},
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
startup: {
ready: () => {
MathJax.startup.defaultReady();
console.log('MathJax initial typesetting complete');
const mathElements = document.getElementsByTagName("mjx-container"); // getting math element
// var brightspace_check = document
// .getElementsByTagName("img")[0]
// .getAttribute("src"); //checking the src tag of image
var another_check = window.location.href;
var not_local = another_check.includes("https"); // checkingif the srclink has d2lSession included or not. When in brightspace it will have that d2lSession in the src tag
if (
( not_local === true ) &&
parseFloat(
window
.getComputedStyle(mathElements[0], null)
.getPropertyValue("font-size")
) /
(parseFloat(
window
.getComputedStyle(document.getElementsByTagName("p")[0], null)
.getPropertyValue("font-size")
) >
0.9)
) {
var style = document.createElement("style");
style.type = "text/css";
style.innerHTML = ".MathJax, mjx-container { font-size:1.3rem !important}";
document.getElementsByTagName("head")[0].appendChild(style);
};
$('.MathJax').removeAttr('tabindex');
$('mjx-container').removeAttr('tabindex');
}
}}
I want to run this similar script in version 3 which I can use