2019-01-08 23:17:15 +00:00
|
|
|
/* eslint-disable jquery/no-global-selector */
|
2018-11-12 16:14:43 +00:00
|
|
|
( function () {
|
2014-10-10 10:38:23 +00:00
|
|
|
'use strict';
|
2016-04-12 20:27:02 +00:00
|
|
|
|
2014-10-10 10:38:23 +00:00
|
|
|
// If MathPlayer is installed we show the MathML rendering.
|
2015-09-14 18:46:13 +00:00
|
|
|
if ( navigator.userAgent.indexOf( 'MathPlayer' ) > -1 ) {
|
2014-10-10 10:38:23 +00:00
|
|
|
$( '.mwe-math-mathml-a11y' ).removeClass( 'mwe-math-mathml-a11y' );
|
2014-10-12 09:26:57 +00:00
|
|
|
$( '.mwe-math-fallback-image-inline, .mwe-math-fallback-image-display' ).css( 'display', 'none' );
|
2014-10-10 19:25:42 +00:00
|
|
|
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
|
2015-09-14 18:46:13 +00:00
|
|
|
if ( !document.implementation.hasFeature( 'http://www.w3.org/TR/SVG11/feature#Image', '1.1' ) ) {
|
2016-10-28 18:11:26 +00:00
|
|
|
$( '.mwe-math-fallback-image-inline, .mwe-math-fallback-image-display' ).each( function () {
|
2016-06-03 08:10:06 +00:00
|
|
|
this.src = this.src.replace( 'media/math/render/svg/', 'media/math/render/png/' );
|
2017-08-16 05:50:44 +00:00
|
|
|
this.src = this.src.replace( 'mode=mathml', 'mode=mathml-png' );
|
2016-06-03 08:10:06 +00:00
|
|
|
} );
|
2014-10-10 10:38:23 +00:00
|
|
|
}
|
2018-11-12 16:14:43 +00:00
|
|
|
}() );
|