Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • M MathJax
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 304
    • Issues 304
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • MathJax
  • MathJax
  • Issues
  • #2913
Closed
Open
Issue created Aug 09, 2022 by Administrator@rootContributor

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. image image

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

Assignee
Assign to
Time tracking