add accessibility message if mathjax is detected

use ie conditional html tags to detect for compatible ie versions
This commit is contained in:
Adam Palay
2013-09-13 15:07:23 -04:00
parent 75b7514c4f
commit 34362b88a6
3 changed files with 39 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
$ ->
isMPInstalled = (boolean) ->
# check if MathPlayer is installed
# (from http://www.dessci.com/en/products/mathplayer/check.htm)
try
oMP = new ActiveXObject("MathPlayer.Factory.1")
true
catch e
false
# detect if there is mathjax on the page
# if not, set 'aria-hidden' to 'true'
if MathJax? and not isMPInstalled()
$("#mathjax-accessibility-message").attr("aria-hidden", "false")
else
$("#mathjax-accessibility-message").attr("aria-hidden", "true")

View File

@@ -76,6 +76,7 @@
</head>
<body class="<%block name='bodyclass'/>">
<%include file="mathjax_accessible.html" />
% if theme_enabled():
<%include file="theme-header.html" />

View File

@@ -0,0 +1,22 @@
<%! from django.utils.translation import ugettext as _ %>
<div class="sr message-accessibility message" id="mathjax-accessibility-message" aria-hidden="false">
<p class="copy">${
_("This page features MathJax technology to render mathematical "
"formulae. To make math accessibile, we suggest using the MathPlayer "
"plugin. Please visit the {link_start}MathPlayer Download "
"Page{link_end} to download the plugin for your browser.").format(
link_start = u'<a href="//www.dessci.com/en/products/mathplayer/'
'download.htm">',
link_end = u'</a>')
}</p>
</div>
<!--[if (lt IE6)|(gt IE 9)|!(IE)]><!-->
<div class="sr message-accessibility message" id="mathplayer-browser-message" aria-hidden="false">
<p class="copy">
${_("Your browser does not support the MathPlayer plugin. To use "
"MathPlayer, please use Internet Explorer 6 through 9.")}
</p>
</div>
<!--[endif]-->