Files
edx-platform/common/templates/mathjax_include.html
David Ormsbee 66be836363 fix: remove MathJax loading status bar in courseware (TNL-8448)
Loading messages for MathJax are distracting and not actionable. They
also delay the time to final render for many pages that do not actually
have math on them. This removes them.
2021-06-30 09:13:08 -04:00

95 lines
2.9 KiB
HTML

## mako
## File: templates/mathjax_include.html
##
## Note that this file is only used by LMS.
## MathJax configuration for Studio lives in
## cms/js/require-config.js.
<%page args="disable_fast_preview=True" expression_filter="h"/>
## Avoid loading mathjax if already loaded on the page
%if context.get('load_mathjax', True):
%if disable_fast_preview:
<script type="text/javascript">
// Fast Preview was introduced in 2.5. However, it
// causes undesirable flashing/font size changes when
// MathJax is used for interactive preview (equation editor).
// Setting processSectionDelay to 0 (see below) fully eliminates
// fast preview, but to reduce confusion, we are also setting
// the option as displayed in the context menu to false.
// When upgrading to 2.6, check if this variable name changed.
window.MathJax = {
menuSettings: {CHTMLpreview: false}
};
</script>
%endif
%if mathjax_mode is not Undefined and mathjax_mode == 'wiki':
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: {inlineMath: [ ['$','$'], ["\\(","\\)"]],
displayMath: [ ['$$','$$'], ["\\[","\\]"]]}
});
</script>
%else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
messageStyle: "none",
tex2jax: {
inlineMath: [
["\\(","\\)"],
['[mathjaxinline]','[/mathjaxinline]']
],
displayMath: [
["\\[","\\]"],
['[mathjax]','[/mathjax]']
]
}
});
</script>
%endif
<script type="text/x-mathjax-config">
%if disable_fast_preview:
// In order to eliminate all flashing during interactive
// preview, it is necessary to set processSectionDelay to 0
// (remove delay between input and output phases). This
// effectively disables fast preview, regardless of
// the fast preview setting as shown in the context menu.
MathJax.Hub.processSectionDelay = 0;
%endif
MathJax.Hub.signal.Interest(function(message) {
if(message[0] === "End Math") {
set_mathjax_display_div_settings();
}
});
function set_mathjax_display_div_settings() {
$('.MathJax_Display').each(function( index ) {
this.setAttribute('tabindex', '0');
this.setAttribute('aria-live', 'off');
this.removeAttribute('role');
this.removeAttribute('aria-readonly');
});
}
</script>
<script type="text/javascript">
// Activating Mathjax accessibility files
window.MathJax = {
menuSettings: {
collapsible: true,
autocollapse: false,
explorer: true
}
};
</script>
<!-- This must appear after all mathjax-config blocks, so it is after the imports from the other templates.
It can't be run through static.url because MathJax uses crazy url introspection to do lazy loading of
MathJax extension libraries -->
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mathjax@2.7.5/MathJax.js?config=TeX-MML-AM_SVG"></script>
%endif