Jump to content

Extension:Math/MathJaxMenu

From mediawiki.org

How to Modify the MathJax Contextual Menu After it has Loaded

[edit]
  • You do not need access to the server. This is done without changing the MathJax source.
  • Edit the MediaWiki:Common.js page.
  • Use the function
mw.loader.using()

with the hook 'ext.math.mathjax.mathjax' to run the code when MathJax has loaded. Otherwise, the code will start running before MathJax has loaded, which will cause an error.

  • If you want to use a different hook, there is a list of the available hooks if you enter mw.loader.getModuleNames() into the web console.
  • Add
 MathJax.Callback.Queue(
    MathJax.Hub.Register.StartupHook("MathMenu Ready",function () { /* your code goes here */} ))

This will tell the program to wait until the MathMenu is loaded to begin executing.

  • Now you can add your modifications to the menu.
  • Here is a link to an example source code
  • Note: The changes you add will be executed after all configuration and annotations have been retrieved. Thus, click on the links below if you want to add an annotation type or you want to override the configuration, as this will not work for you.

How to Create an MediaWiki Hook to Customize MathJax

How to Expose an Additional Annotation Type to the Contextual Menu