Tweak MathJax loading per recommendations from mathjax-users list:

* drop some of the init lines that don't appear to work/be needed
* only load MathJax.js through ResourceLoader; let MathJax's loader handle the rest

This gets us working in Chrome, where previously we hadn't initialized correctly. Should also help in IE, still needs testing.
Will probably want to swap in the pre-minimized versions of the files at some point, but the expanded ones are fine at this stage of work.
This commit is contained in:
Brion Vibber 2012-03-06 21:57:12 +00:00
parent 11ef4d7a9a
commit 261310bad9
Notes: Brion Vibber 2012-03-06 21:57:12 +00:00
6 changed files with 9 additions and 54 deletions

View file

@ -126,23 +126,8 @@ $moduleTemplate = array(
$wgResourceModules['ext.math.mathjax'] = array(
'scripts' => array(
'MathJax/MathJax.js',
'ext.math.mathjax.preload.js',
'MathJax/jax/input/TeX/config.js',
'MathJax/jax/output/HTML-CSS/config.js',
'MathJax/extensions/MathEvents.js',
'MathJax/extensions/MathZoom.js',
'MathJax/extensions/MathMenu.js',
'MathJax/jax/element/mml/jax.js',
'MathJax/extensions/toMathML.js',
'MathJax/extensions/TeX/noErrors.js',
'MathJax/extensions/TeX/noUndefined.js',
'MathJax/jax/input/TeX/jax.js',
'MathJax/extensions/TeX/AMSmath.js',
'MathJax/extensions/TeX/AMSsymbols.js',
'MathJax/jax/output/HTML-CSS/jax.js',
'MathJax/jax/output/HTML-CSS/autoload/mtable.js',
'MathJax-custom/extensions/wiki2jax.js',
'MathJax-custom/extensions/TeX/texvc.js'
// We'll let the other parts be loaded by MathJax's
// own module/config loader.
),
'group' => 'ext.math.mathjax',
) + $moduleTemplate;

View file

@ -0,0 +1,6 @@
MathJax.Hub.Config({
extensions: ["wiki2jax.js","TeX/texvc.js","MathEvents.js","MathZoom.js","MathMenu.js","toMathML.js"],
jax: ["input/TeX","output/HTML-CSS"],
TeX: {extensions: ["noErrors.js","noUndefined.js","AMSmath.js","AMSsymbols.js"]}
});
MathJax.Ajax.loadComplete("[MathJax]/config/TeX-AMS-texvc_HTML.js");

View file

@ -11,33 +11,14 @@ mathJax.loaded = false;
mathJax.Config = function() {
MathJax.Hub.Config({
root: mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax',
//config: "TeX-AMS-texvc_HTML.js",
config: ["TeX-AMS-texvc_HTML.js"],
"v1.0-compatible": false,
styles: { ".mtext": { "font-family": "sans-serif ! important", "font-size": "80%" } },
displayAlign: "left",
menuSettings: { zoom: "click" },
"HTML-CSS": { imageFont: null, availableFonts: ["TeX"] }
});
MathJax.Message.styles["#MathJax_Message"].right = MathJax.Message.styles["#MathJax_Message"].left;
delete MathJax.Message.styles["#MathJax_Message"].left;
if ( typeof(mathJax.userConfig) !== "undefined" ) MathJax.Hub.Config( mathJax.userConfig );
//if ( typeof(mathJax.fontDir) !== "undefined" ) MathJax.OutputJax.fontDir = mathJax.fontDir; else MathJax.Hub.Config({ NativeMML: {webFont: null} });
MathJax.OutputJax.fontDir = mathJax.fontDir = mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax/fonts';
MathJax.Hub.Register.StartupHook("End Extensions", function() {
var TEX = MathJax.InputJax.TeX;
var MACROS = TEX.config.Macros;
for (var id in MACROS) {
if (typeof(MACROS[id]) === "string") TEX.Macro(id, MACROS[id]);
else TEX.Macro(id, MACROS[id][0], MACROS[id][1]);
}
TEX.Parse.Augment({
Cr: function(name) {
this.GetBrackets(name);
this.Push(TEX.Stack.Item.cell().With({isCR: true, name: name}));
}
});
});
MathJax.Hub.Startup.onload();
}
mathJax.Load = function(element) {

View file

@ -1,17 +0,0 @@
MathJax.Ajax.Preloading(
"[MathJax]/jax/input/TeX/config.js",
"[MathJax]/jax/output/HTML-CSS/config.js",
"[MathJax]/extensions/MathEvents.js",
"[MathJax]/extensions/MathZoom.js",
"[MathJax]/extensions/MathMenu.js",
"[MathJax]/jax/element/mml/jax.js",
"[MathJax]/extensions/toMathML.js",
"[MathJax]/extensions/TeX/noErrors.js",
"[MathJax]/extensions/TeX/noUndefined.js",
"[MathJax]/jax/input/TeX/jax.js",
"[MathJax]/extensions/TeX/AMSmath.js",
"[MathJax]/extensions/TeX/AMSsymbols.js",
"[MathJax]/jax/output/HTML-CSS/jax.js",
"[MathJax]/jax/output/HTML-CSS/autoload/mtable.js"
);