MediaWiki:Common.js: Difference between revisions

From EvoLudo
No edit summary
Tag: Manual revert
No edit summary
Line 3: Line 3:
  */
  */
mw.loader.load( 'https://wiki.evoludo.org/gwt/evoludoweb/evoludoweb.nocache.js' );
mw.loader.load( 'https://wiki.evoludo.org/gwt/evoludoweb/evoludoweb.nocache.js' );
/* 250221 doesn't enable equation numbering... why?
* see https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html
window.MathJax = {
window.MathJax = {
   tex: {
   tex: {
Line 8: Line 10:
   }
   }
};
};
*/
var mathTags = $('.mwe-math-mathml-a11y');
if (mathTags.length > 0){ //only do something when there's math on the page
  window.MathJax = { //hook into MathJax's configuration
    AuthorInit: function () {
      MathJax.Hub.Register.StartupHook("End",function () { //when MathJax is done...
        MathJax.Hub.Queue(
            function(){
            mathTags.removeClass('mwe-math-mathml-a11y'); // .. make the span around MathML (now MathJax output) visible
            $('.mwe-math-fallback-image-inline').addClass('mwe-math-mathml-a11y'); //hide fallback images
            }
        );
      });
    }
  };
}

Revision as of 02:33, 21 February 2025

/* Any JavaScript here will be loaded for all users on every page load. 
 * Ignored on mobile devices, see MediaWiki:Mobile.js
 */
mw.loader.load( 'https://wiki.evoludo.org/gwt/evoludoweb/evoludoweb.nocache.js' );
/* 250221 doesn't enable equation numbering... why?
 * see https://docs.mathjax.org/en/latest/input/tex/eqnumbers.html
window.MathJax = {
  tex: {
    tags: 'ams'
  }
};
 */
var mathTags = $('.mwe-math-mathml-a11y');
if (mathTags.length > 0){ //only do something when there's math on the page
  window.MathJax = { //hook into MathJax's configuration
    AuthorInit: function () {
      MathJax.Hub.Register.StartupHook("End",function () { //when MathJax is done...
        MathJax.Hub.Queue(
            function(){
             mathTags.removeClass('mwe-math-mathml-a11y'); // .. make the span around MathML (now MathJax output) visible
             $('.mwe-math-fallback-image-inline').addClass('mwe-math-mathml-a11y'); //hide fallback images
            }
        );
      });
    }
  };
}