mediawiki-extensions-Math/modules/ext.math.js
Moritz Schubotz 2fc8fa6ccd Fix: Update png fallback
In Ifdd75ce51076b098af67a96b5dcb0fc0726d2b00
I missed to update the png fallback mechanism
given the fact that SVG is now a <img element
as well and no longer a <meta tag.

Bug: T136905
Change-Id: If1b4fb11cfb50eab98f847674fdbef2cd0e43e37
2016-06-03 10:10:06 +02:00

19 lines
818 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/' );
} );
}
}( jQuery ) );