Here's what I added to the wp-admin/admin-header.php
file of my wordpress site to re-typeset the preview of the latex-math as I type into the post editor:
<script>
document.addEventListener('DOMContentLoaded',
function()
{
// http://stackoverflow.com/a/4029518/148668
var idleTime = 0;
// Increment every 100 millisecond
setInterval(timerIncrement, 100);
function timerIncrement()
{
idleTime+=100;
if(idleTime>1000)
{
idleTime=0;
if(MathJax.Hub.queue.running == 0 && MathJax.Hub.queue.pending == 0)
{
MathJax.Hub.Typeset();
}
}
}
document.getElementById("content").onkeypress =
function(e)
{
idleTime = 0;
};
},false);
</script>