1
0
Fork 0
mirror of https://github.com/futurepress/epub.js.git synced 2025-10-05 15:32:55 +02:00

update mathjax to wait to display content until end signal

This commit is contained in:
Fred Chasen 2013-11-07 14:27:35 -08:00
parent 9f95e66670
commit 2ed69e951f
3 changed files with 16 additions and 5 deletions

2
books

@ -1 +1 @@
Subproject commit e5b73d727bd3f073d330a195e4655be969ad12f0
Subproject commit ab9755a74714b647290c861f666515de220935d8

View file

@ -85,6 +85,7 @@
<li><a href="promises.html">Promises</a></li>
<li><a href="fixed.html">Fixed</a></li>
<li><a href="custom-elements.html">Custom Element</a></li>
<li><a href="mathml.html">MathML</a></li>
</ol>
</div>

View file

@ -3,14 +3,24 @@ EPUBJS.Hooks.register("beforeChapterDisplay").mathml = function(callback, render
// check of currentChapter properties contains 'mathml'
if(renderer.currentChapter.properties.indexOf("mathml") !== -1 ){
// Assign callback to be inside iframe window
renderer.iframe.contentWindow.mathmlCallback = callback;
// add MathJax config script tag to the renderer body
var s = document.createElement("script");
s.type = 'text/x-mathjax-config';
s.innerHTML = 'MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"});';
s.innerHTML = '\
MathJax.Hub.Register.StartupHook("End",function () { \
console.log("The TeX input jax is loaded and ready!"); \
// window.mathmlCallback() \
});\
MathJax.Hub.Config({jax: ["input/TeX","input/MathML","output/SVG"],extensions: ["tex2jax.js","mml2jax.js","MathEvents.js"],TeX: {extensions: ["noErrors.js","noUndefined.js","autoload-all.js"]},MathMenu: {showRenderer: false},menuSettings: {zoom: "Click"},messageStyle: "none"}); \
';
renderer.doc.body.appendChild(s);
// add MathJax.js to renderer head
EPUBJS.core.addScript("http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML", null, renderer.doc.head);
}
} else {
if(callback) callback();
}
}