mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 23:46:39 +00:00
d8822169ab
Renders formulae via mathoid without to run mathoid as a service. Mathoid 0.7.1 or later must be installed locally and configured to be accessed directly from the math extension. It has been tested with the config.dev.yaml of version 0.7.1. If mathoid is installed in '/srv/mathoid' the following line might be added to LocalSettings.php $wgMathoidCli = ['/srv/mathoid/cli.js', '-c', '/srv/mathoid/config.dev.yaml']; i.e., make sure to specify the -c parameter with an absolute path. In addition mathoid uses more memory than the the default. With the config.dev.yaml a value of $wgMaxShellMemory = 2097152; has been tested to work well. Change-Id: I0600f056d21927963267cf979d342e313419e9fa
20 lines
885 B
JavaScript
20 lines
885 B
JavaScript
( function ( $ ) {
|
|
'use strict';
|
|
|
|
// If MathPlayer is installed we show the MathML rendering.
|
|
if ( navigator.userAgent.indexOf( 'MathPlayer' ) > -1 ) {
|
|
$( '.mwe-math-mathml-a11y' ).removeClass( 'mwe-math-mathml-a11y' );
|
|
$( '.mwe-math-fallback-image-inline, .mwe-math-fallback-image-display' ).css( 'display', 'none' );
|
|
return;
|
|
}
|
|
|
|
// We verify whether SVG as <img> is supported and otherwise use the
|
|
// PNG fallback. See https://github.com/Modernizr/Modernizr/blob/master/feature-detects/svg/asimg.js
|
|
if ( !document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
|
|
$( '.mwe-math-fallback-image-inline, .mwe-math-fallback-image-display' ).each( function () {
|
|
this.src = this.src.replace( 'media/math/render/svg/', 'media/math/render/png/' );
|
|
this.src = this.src.replace( 'mode=mathml', 'mode=mathml-png' );
|
|
} );
|
|
}
|
|
}( jQuery ) );
|