latexToMathJax.js 905 B

1
  1. function afterLoad(){$("img").each(function(a){!/^data:image/.test(this.src)&&-1!=this.src.indexOf("http://")&&(0<=this.src.indexOf("gif.latex")||0<=this.src.indexOf("mathtex.cgi")||0<=this.src.indexOf(".gif?"))&&(a=unescape(this.src.substring(this.src.indexOf("?")+1)),$(this).replaceWith("\x3cspan class\x3d'latex'\x3e\\(\n"+a.replace(/</,"\x3c ")+"\n\\)\x3c/span\x3e"))});if(0!=$(".latex").length){var b=document.createElement("script");b.type="text/javascript";b.src="/js/min/mathjax/MathJax.js?config\x3dTeX-AMS-MML_HTMLorMML";document.getElementsByTagName("head")[0].appendChild(b);var c=setInterval(function(){var a=$(".latex");0==a.length?(clearInterval(c),$(".mtext").remove(),$("#loading").remove()):a.each(function(){""==$(this).find(".MathJax_Preview").html()&&$(this).removeClass("latex")})},50)}}$(function(){$("head").append("\x3cstyle\x3e.latex{display:none}\x3c/style\x3e");afterLoad()});