Add some comments to separate the methods from one another

This commit is contained in:
Davide P. Cervone 2015-03-07 11:00:49 -05:00
parent f9849b87d3
commit 3619421fab

View File

@ -118,6 +118,8 @@
} }
})(); })();
/************************************************************/
var BIGDIMEN = 1000000; var BIGDIMEN = 1000000;
var V = "V", H = "H"; var V = "V", H = "H";
@ -125,6 +127,8 @@
settings: HUB.config.menuSettings, settings: HUB.config.menuSettings,
config: {styles: STYLES}, config: {styles: STYLES},
/********************************************/
Config: function () { Config: function () {
if (!this.require) {this.require = []} if (!this.require) {this.require = []}
this.SUPER(arguments).Config.call(this); var settings = this.settings; this.SUPER(arguments).Config.call(this); var settings = this.settings;
@ -160,6 +164,8 @@
InitializeCHTML: function () { InitializeCHTML: function () {
}, },
/********************************************/
preTranslate: function (state) { preTranslate: function (state) {
var scripts = state.jax[this.id], i, m = scripts.length, var scripts = state.jax[this.id], i, m = scripts.length,
script, prev, span, div, jax; script, prev, span, div, jax;
@ -205,6 +211,8 @@
*/ */
}, },
/********************************************/
Translate: function (script,state) { Translate: function (script,state) {
if (!script.parentNode) return; if (!script.parentNode) return;
@ -263,6 +271,10 @@
} }
}, },
initCHTML: function (math,span) {},
/********************************************/
postTranslate: function (state) { postTranslate: function (state) {
var scripts = state.jax[this.id]; var scripts = state.jax[this.id];
if (!this.hideProcessedMath) return; if (!this.hideProcessedMath) return;
@ -314,6 +326,8 @@
*/ */
}, },
/********************************************/
getJaxFromMath: function (math) { getJaxFromMath: function (math) {
if (math.parentNode.className === "MathJax_CHTML_Display") {math = math.parentNode} if (math.parentNode.className === "MathJax_CHTML_Display") {math = math.parentNode}
do {math = math.nextSibling} while (math && math.nodeName.toLowerCase() !== "script"); do {math = math.nextSibling} while (math && math.nodeName.toLowerCase() !== "script");
@ -345,8 +359,6 @@
return {Y:-EVENT.getBBox(span).h, mW:mW, mH:mH, zW:zW, zH:zH}; return {Y:-EVENT.getBBox(span).h, mW:mW, mH:mH, zW:zW, zH:zH};
}, },
initCHTML: function (math,span) {},
Remove: function (jax) { Remove: function (jax) {
var span = document.getElementById(jax.inputID+"-Frame"); var span = document.getElementById(jax.inputID+"-Frame");
if (span) { if (span) {
@ -356,6 +368,8 @@
delete jax.CHTML; delete jax.CHTML;
}, },
/********************************************/
ID: 0, idPostfix: "", ID: 0, idPostfix: "",
GetID: function () {this.ID++; return this.ID}, GetID: function () {this.ID++; return this.ID},
@ -418,6 +432,8 @@
min_rule_thickness: 1.25 // in pixels min_rule_thickness: 1.25 // in pixels
}, },
/********************************************************/
getUnicode: function (string) { getUnicode: function (string) {
var n = string.text.charCodeAt(string.i); string.i++; var n = string.text.charCodeAt(string.i); string.i++;
if (n >= 0xD800 && n < 0xDBFF) { if (n >= 0xD800 && n < 0xDBFF) {
@ -496,6 +512,8 @@
}, },
unknownChar: function (variant,n) {}, unknownChar: function (variant,n) {},
/********************************************************/
addCharList: function (node,list,bbox) { addCharList: function (node,list,bbox) {
var text = "", className; var text = "", className;
for (var i = 0, m = list.length; i < m; i++) { for (var i = 0, m = list.length; i < m; i++) {
@ -527,8 +545,7 @@
} }
}, },
/********************************************************/
// ### FIXME: add more here
DELIMITERS: { DELIMITERS: {
"(": {dir:V}, "(": {dir:V},
@ -560,6 +577,8 @@
"\u23B1": {dir:V, w:.6} "\u23B1": {dir:V, w:.6}
}, },
/********************************************************/
// //
// ### FIXME: Handle mu's // ### FIXME: Handle mu's
// //
@ -594,6 +613,8 @@
return parseFloat(m); return parseFloat(m);
}, },
/********************************************************/
zeroBBox: function () { zeroBBox: function () {
return {h:0, d:0, w:0, l:0, r:0, D:0, H:0, t:0, b:0}; return {h:0, d:0, w:0, l:0, r:0, D:0, H:0, t:0, b:0};
}, },
@ -629,13 +650,19 @@
if (scale*cbox.b - y > bbox.b) bbox.b = scale*cbox.b - y; if (scale*cbox.b - y > bbox.b) bbox.b = scale*cbox.b - y;
}, },
/********************************************************/
arrayEntry: function (a,i) {return a[Math.max(0,Math.min(i,a.length-1))]} arrayEntry: function (a,i) {return a[Math.max(0,Math.min(i,a.length-1))]}
}); });
/**********************************************************/
MathJax.Hub.Register.StartupHook("mml Jax Ready",function () { MathJax.Hub.Register.StartupHook("mml Jax Ready",function () {
MML = MathJax.ElementJax.mml; MML = MathJax.ElementJax.mml;
/********************************************************/
MML.mbase.Augment({ MML.mbase.Augment({
toCommonHTML: function (node,options) { toCommonHTML: function (node,options) {
return this.CHTMLdefaultNode(node,options); return this.CHTMLdefaultNode(node,options);
@ -807,6 +834,8 @@
}); });
/********************************************************/
MML.chars.Augment({ MML.chars.Augment({
toCommonHTML: function (node,options) { toCommonHTML: function (node,options) {
if (options == null) options = {}; if (options == null) options = {};
@ -826,6 +855,8 @@
} }
}); });
/********************************************************/
MML.math.Augment({ MML.math.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node); node = this.CHTMLdefaultNode(node);
@ -834,6 +865,8 @@
} }
}); });
/********************************************************/
MML.mi.Augment({ MML.mi.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node); node = this.CHTMLdefaultNode(node);
@ -846,6 +879,8 @@
} }
}); });
/********************************************************/
MML.mo.Augment({ MML.mo.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLcreateNode(node); node = this.CHTMLcreateNode(node);
@ -956,6 +991,8 @@
} }
}); });
/********************************************************/
MML.mspace.Augment({ MML.mspace.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLcreateNode(node); node = this.CHTMLcreateNode(node);
@ -975,6 +1012,8 @@
} }
}); });
/********************************************************/
MML.mpadded.Augment({ MML.mpadded.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node,{childNodes:"mjx-block", forceChild:true}); node = this.CHTMLdefaultNode(node,{childNodes:"mjx-block", forceChild:true});
@ -1033,6 +1072,8 @@
} }
}); });
/********************************************************/
MML.munderover.Augment({ MML.munderover.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
var values = this.getValues("displaystyle","scriptlevel","accent","accentunder","align"); var values = this.getValues("displaystyle","scriptlevel","accent","accentunder","align");
@ -1238,6 +1279,8 @@
} }
}); });
/********************************************************/
MML.msubsup.Augment({ MML.msubsup.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
var values = this.getValues("displaystyle","scriptlevel", var values = this.getValues("displaystyle","scriptlevel",
@ -1335,6 +1378,8 @@
} }
}); });
/********************************************************/
MML.mfrac.Augment({ MML.mfrac.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node,{ node = this.CHTMLdefaultNode(node,{
@ -1418,6 +1463,8 @@
} }
}); });
/********************************************************/
MML.msqrt.Augment({ MML.msqrt.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node,{ node = this.CHTMLdefaultNode(node,{
@ -1452,6 +1499,8 @@
} }
}); });
/********************************************************/
MML.mroot.Augment({ MML.mroot.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node,{ node = this.CHTMLdefaultNode(node,{
@ -1473,6 +1522,8 @@
CHTMLlayoutRoot: MML.msqrt.prototype.CHTMLlayoutRoot CHTMLlayoutRoot: MML.msqrt.prototype.CHTMLlayoutRoot
}); });
/********************************************************/
MML.mfenced.Augment({ MML.mfenced.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLcreateNode(node); node = this.CHTMLcreateNode(node);
@ -1503,6 +1554,8 @@
} }
}); });
/********************************************************/
MML.mrow.Augment({ MML.mrow.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node); node = this.CHTMLdefaultNode(node);
@ -1512,6 +1565,8 @@
} }
}); });
/********************************************************/
MML.mstyle.Augment({ MML.mstyle.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node); node = this.CHTMLdefaultNode(node);
@ -1526,6 +1581,8 @@
} }
}); });
/********************************************************/
MML.TeXAtom.Augment({ MML.TeXAtom.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node); node = this.CHTMLdefaultNode(node);
@ -1535,6 +1592,8 @@
} }
}); });
/********************************************************/
MML.mtable.Augment({ MML.mtable.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLdefaultNode(node,{noBBox:true}); node = this.CHTMLdefaultNode(node,{noBBox:true});
@ -1597,6 +1656,8 @@
} }
}); });
/********************************************************/
MML.semantics.Augment({ MML.semantics.Augment({
toCommonHTML: function (node) { toCommonHTML: function (node) {
node = this.CHTMLcreateNode(node); node = this.CHTMLcreateNode(node);
@ -1610,6 +1671,8 @@
MML.annotation.Augment({toCommonHTML: function(node) {}}); MML.annotation.Augment({toCommonHTML: function(node) {}});
MML["annotation-xml"].Augment({toCommonHTML: function(node) {}}); MML["annotation-xml"].Augment({toCommonHTML: function(node) {}});
/********************************************************/
// //
// Loading isn't complete until the element jax is modified, // Loading isn't complete until the element jax is modified,
// but can't call loadComplete within the callback for "mml Jax Ready" // but can't call loadComplete within the callback for "mml Jax Ready"