mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-24 07:34:22 +00:00
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:
parent
11ef4d7a9a
commit
261310bad9
Notes:
Brion Vibber
2012-03-06 21:57:12 +00:00
19
Math.php
19
Math.php
|
@ -126,23 +126,8 @@ $moduleTemplate = array(
|
||||||
$wgResourceModules['ext.math.mathjax'] = array(
|
$wgResourceModules['ext.math.mathjax'] = array(
|
||||||
'scripts' => array(
|
'scripts' => array(
|
||||||
'MathJax/MathJax.js',
|
'MathJax/MathJax.js',
|
||||||
'ext.math.mathjax.preload.js',
|
// We'll let the other parts be loaded by MathJax's
|
||||||
'MathJax/jax/input/TeX/config.js',
|
// own module/config loader.
|
||||||
'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'
|
|
||||||
),
|
),
|
||||||
'group' => 'ext.math.mathjax',
|
'group' => 'ext.math.mathjax',
|
||||||
) + $moduleTemplate;
|
) + $moduleTemplate;
|
||||||
|
|
6
modules/MathJax/config/TeX-AMS-texvc_HTML.js
vendored
Normal file
6
modules/MathJax/config/TeX-AMS-texvc_HTML.js
vendored
Normal 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");
|
|
@ -11,33 +11,14 @@ mathJax.loaded = false;
|
||||||
mathJax.Config = function() {
|
mathJax.Config = function() {
|
||||||
MathJax.Hub.Config({
|
MathJax.Hub.Config({
|
||||||
root: mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax',
|
root: mediaWiki.config.get('wgExtensionAssetsPath') + '/Math/modules/MathJax',
|
||||||
//config: "TeX-AMS-texvc_HTML.js",
|
config: ["TeX-AMS-texvc_HTML.js"],
|
||||||
"v1.0-compatible": false,
|
"v1.0-compatible": false,
|
||||||
styles: { ".mtext": { "font-family": "sans-serif ! important", "font-size": "80%" } },
|
styles: { ".mtext": { "font-family": "sans-serif ! important", "font-size": "80%" } },
|
||||||
displayAlign: "left",
|
displayAlign: "left",
|
||||||
menuSettings: { zoom: "click" },
|
menuSettings: { zoom: "click" },
|
||||||
"HTML-CSS": { imageFont: null, availableFonts: ["TeX"] }
|
"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.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) {
|
mathJax.Load = function(element) {
|
||||||
|
|
|
@ -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"
|
|
||||||
);
|
|
||||||
|
|
Loading…
Reference in a new issue