MDL-43856 MathJax: Delay setting of lang until after MathJax startup

This commit is contained in:
Damyon Wiese 2014-04-09 16:44:40 +08:00
parent f1dce5734e
commit 16ad61bf55
4 changed files with 13 additions and 4 deletions

View File

@ -75,7 +75,10 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || {
*/
_setLocale: function() {
if (!this._configured) {
MathJax.Localization.setLocale(this._lang);
var lang = this._lang;
MathJax.Hub.Queue(function () {
MathJax.Localization.setLocale(lang);
});
MathJax.Hub.Configured();
this._configured = true;
}

View File

@ -1 +1 @@
YUI.add("moodle-filter_mathjaxloader-loader",function(e,t){M.filter_mathjaxloader=M.filter_mathjaxloader||{_lang:"",_configured:!1,configure:function(t){var n=document.createElement("script");n.type="text/x-mathjax-config",n[window.opera?"innerHTML":"text"]=t.mathjaxconfig,document.getElementsByTagName("head")[0].appendChild(n),this._lang=t.lang,e.on(M.core.event.FILTER_CONTENT_UPDATED,this.contentUpdated,this)},_setLocale:function(){this._configured||(MathJax.Localization.setLocale(this._lang),MathJax.Hub.Configured(),this._configured=!0)},typeset:function(){if(!this._configured){var t=this;e.use("mathjax",function(){t._setLocale(),e.all(".filter_mathjaxloader_equation").each(function(e){MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.getDOMNode()])})})}},contentUpdated:function(t){var n=this;e.use("mathjax",function(){n._setLocale(),t.nodes.each(function(e){e.all(".filter_mathjaxloader_equation").each(function(e){MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.getDOMNode()])})})})}}},"@VERSION@",{requires:["moodle-core-event"]});
YUI.add("moodle-filter_mathjaxloader-loader",function(e,t){M.filter_mathjaxloader=M.filter_mathjaxloader||{_lang:"",_configured:!1,configure:function(t){var n=document.createElement("script");n.type="text/x-mathjax-config",n[window.opera?"innerHTML":"text"]=t.mathjaxconfig,document.getElementsByTagName("head")[0].appendChild(n),this._lang=t.lang,e.on(M.core.event.FILTER_CONTENT_UPDATED,this.contentUpdated,this)},_setLocale:function(){if(!this._configured){var e=this._lang;MathJax.Hub.Queue(function(){MathJax.Localization.setLocale(e)}),MathJax.Hub.Configured(),this._configured=!0}},typeset:function(){if(!this._configured){var t=this;e.use("mathjax",function(){t._setLocale(),e.all(".filter_mathjaxloader_equation").each(function(e){MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.getDOMNode()])})})}},contentUpdated:function(t){var n=this;e.use("mathjax",function(){n._setLocale(),t.nodes.each(function(e){e.all(".filter_mathjaxloader_equation").each(function(e){MathJax.Hub.Queue(["Typeset",MathJax.Hub,e.getDOMNode()])})})})}}},"@VERSION@",{requires:["moodle-core-event"]});

View File

@ -75,7 +75,10 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || {
*/
_setLocale: function() {
if (!this._configured) {
MathJax.Localization.setLocale(this._lang);
var lang = this._lang;
MathJax.Hub.Queue(function () {
MathJax.Localization.setLocale(lang);
});
MathJax.Hub.Configured();
this._configured = true;
}

View File

@ -73,7 +73,10 @@ M.filter_mathjaxloader = M.filter_mathjaxloader || {
*/
_setLocale: function() {
if (!this._configured) {
MathJax.Localization.setLocale(this._lang);
var lang = this._lang;
MathJax.Hub.Queue(function () {
MathJax.Localization.setLocale(lang);
});
MathJax.Hub.Configured();
this._configured = true;
}