Fix indenting due to insertion of startup hooks for configuration blocks
This commit is contained in:
parent
5950641ee5
commit
bc193eedd2
|
@ -679,81 +679,81 @@
|
|||
|
||||
/*************************************************************/
|
||||
|
||||
HUB.Register.StartupHook("End Config",function () {
|
||||
HUB.Register.StartupHook("End Config",function () {
|
||||
|
||||
/*
|
||||
* Get the menu settings from the HUB (which includes the
|
||||
* data from the cookie already), and add the format, if
|
||||
* it wasn't set in the cookie.
|
||||
*/
|
||||
CONFIG.settings = HUB.config.menuSettings;
|
||||
if (!CONFIG.settings.format)
|
||||
{CONFIG.settings.format = (MathJax.InputJax.TeX ? "Original" : "MathML")}
|
||||
if (typeof(CONFIG.settings.showRenderer) !== "undefined") {CONFIG.showRenderer = CONFIG.settings.showRenderer}
|
||||
if (typeof(CONFIG.settings.showFontMenu) !== "undefined") {CONFIG.showFontMenu = CONFIG.settings.showFontMenu}
|
||||
if (typeof(CONFIG.settings.showContext) !== "undefined") {CONFIG.showContext = CONFIG.settings.showContext}
|
||||
MENU.getCookie();
|
||||
/*
|
||||
* Get the menu settings from the HUB (which includes the
|
||||
* data from the cookie already), and add the format, if
|
||||
* it wasn't set in the cookie.
|
||||
*/
|
||||
CONFIG.settings = HUB.config.menuSettings;
|
||||
if (!CONFIG.settings.format)
|
||||
{CONFIG.settings.format = (MathJax.InputJax.TeX ? "Original" : "MathML")}
|
||||
if (typeof(CONFIG.settings.showRenderer) !== "undefined") {CONFIG.showRenderer = CONFIG.settings.showRenderer}
|
||||
if (typeof(CONFIG.settings.showFontMenu) !== "undefined") {CONFIG.showFontMenu = CONFIG.settings.showFontMenu}
|
||||
if (typeof(CONFIG.settings.showContext) !== "undefined") {CONFIG.showContext = CONFIG.settings.showContext}
|
||||
MENU.getCookie();
|
||||
|
||||
/*
|
||||
* The main menu
|
||||
*/
|
||||
MENU.menu = MENU(
|
||||
ITEM.COMMAND("Show Source",MENU.ShowSource),
|
||||
ITEM.SUBMENU("Format",
|
||||
ITEM.RADIO("MathML", "format"),
|
||||
ITEM.RADIO("Original", "format", {value: "Original"})
|
||||
),
|
||||
ITEM.RULE(),
|
||||
ITEM.SUBMENU("Settings",
|
||||
ITEM.SUBMENU("Zoom Trigger",
|
||||
ITEM.RADIO("Hover", "zoom", {action: MENU.Zoom}),
|
||||
ITEM.RADIO("Click", "zoom", {action: MENU.Zoom}),
|
||||
ITEM.RADIO("Double-Click", "zoom", {action: MENU.Zoom}),
|
||||
ITEM.RADIO("No Zoom", "zoom", {value: "None"}),
|
||||
ITEM.RULE(),
|
||||
ITEM.LABEL("Trigger Requires:"),
|
||||
ITEM.CHECKBOX((HUB.Browser.isMac ? "Option" : "Alt"), "ALT"),
|
||||
ITEM.CHECKBOX("Command", "CMD", {hidden: !HUB.Browser.isMac}),
|
||||
ITEM.CHECKBOX("Control", "CTRL", {hidden: HUB.Browser.isMac}),
|
||||
ITEM.CHECKBOX("Shift", "Shift")
|
||||
),
|
||||
ITEM.SUBMENU("Zoom Factor",
|
||||
ITEM.RADIO("125%", "zscale"),
|
||||
ITEM.RADIO("133%", "zscale"),
|
||||
ITEM.RADIO("150%", "zscale"),
|
||||
ITEM.RADIO("175%", "zscale"),
|
||||
ITEM.RADIO("200%", "zscale"),
|
||||
ITEM.RADIO("250%", "zscale"),
|
||||
ITEM.RADIO("300%", "zscale"),
|
||||
ITEM.RADIO("400%", "zscale")
|
||||
/*
|
||||
* The main menu
|
||||
*/
|
||||
MENU.menu = MENU(
|
||||
ITEM.COMMAND("Show Source",MENU.ShowSource),
|
||||
ITEM.SUBMENU("Format",
|
||||
ITEM.RADIO("MathML", "format"),
|
||||
ITEM.RADIO("Original", "format", {value: "Original"})
|
||||
),
|
||||
ITEM.RULE(),
|
||||
ITEM.SUBMENU("Math Renderer", {hidden:!CONFIG.showRenderer},
|
||||
ITEM.RADIO("HTML-CSS", "renderer", {action: MENU.Renderer}),
|
||||
ITEM.RADIO("MathML", "renderer", {action: MENU.Renderer, value:"NativeMML"})
|
||||
),
|
||||
ITEM.SUBMENU("Font Preference", {hidden:!CONFIG.showFontMenu},
|
||||
ITEM.LABEL("For HTML-CSS:"),
|
||||
ITEM.RADIO("Auto", "font", {action: MENU.Font}),
|
||||
ITEM.SUBMENU("Settings",
|
||||
ITEM.SUBMENU("Zoom Trigger",
|
||||
ITEM.RADIO("Hover", "zoom", {action: MENU.Zoom}),
|
||||
ITEM.RADIO("Click", "zoom", {action: MENU.Zoom}),
|
||||
ITEM.RADIO("Double-Click", "zoom", {action: MENU.Zoom}),
|
||||
ITEM.RADIO("No Zoom", "zoom", {value: "None"}),
|
||||
ITEM.RULE(),
|
||||
ITEM.LABEL("Trigger Requires:"),
|
||||
ITEM.CHECKBOX((HUB.Browser.isMac ? "Option" : "Alt"), "ALT"),
|
||||
ITEM.CHECKBOX("Command", "CMD", {hidden: !HUB.Browser.isMac}),
|
||||
ITEM.CHECKBOX("Control", "CTRL", {hidden: HUB.Browser.isMac}),
|
||||
ITEM.CHECKBOX("Shift", "Shift")
|
||||
),
|
||||
ITEM.SUBMENU("Zoom Factor",
|
||||
ITEM.RADIO("125%", "zscale"),
|
||||
ITEM.RADIO("133%", "zscale"),
|
||||
ITEM.RADIO("150%", "zscale"),
|
||||
ITEM.RADIO("175%", "zscale"),
|
||||
ITEM.RADIO("200%", "zscale"),
|
||||
ITEM.RADIO("250%", "zscale"),
|
||||
ITEM.RADIO("300%", "zscale"),
|
||||
ITEM.RADIO("400%", "zscale")
|
||||
),
|
||||
ITEM.RULE(),
|
||||
ITEM.RADIO("TeX (local)", "font", {action: MENU.Font}),
|
||||
ITEM.RADIO("TeX (web)", "font", {action: MENU.Font}),
|
||||
ITEM.RADIO("TeX (image)", "font", {action: MENU.Font}),
|
||||
ITEM.RULE(),
|
||||
ITEM.RADIO("STIX (local)", "font", {action: MENU.Font})
|
||||
ITEM.SUBMENU("Math Renderer", {hidden:!CONFIG.showRenderer},
|
||||
ITEM.RADIO("HTML-CSS", "renderer", {action: MENU.Renderer}),
|
||||
ITEM.RADIO("MathML", "renderer", {action: MENU.Renderer, value:"NativeMML"})
|
||||
),
|
||||
ITEM.SUBMENU("Font Preference", {hidden:!CONFIG.showFontMenu},
|
||||
ITEM.LABEL("For HTML-CSS:"),
|
||||
ITEM.RADIO("Auto", "font", {action: MENU.Font}),
|
||||
ITEM.RULE(),
|
||||
ITEM.RADIO("TeX (local)", "font", {action: MENU.Font}),
|
||||
ITEM.RADIO("TeX (web)", "font", {action: MENU.Font}),
|
||||
ITEM.RADIO("TeX (image)", "font", {action: MENU.Font}),
|
||||
ITEM.RULE(),
|
||||
ITEM.RADIO("STIX (local)", "font", {action: MENU.Font})
|
||||
),
|
||||
ITEM.SUBMENU("Contextual Menu", {hidden:!CONFIG.showContext},
|
||||
ITEM.RADIO("MathJax", "context"),
|
||||
ITEM.RADIO("Browser", "context")
|
||||
),
|
||||
ITEM.COMMAND("Scale All Math ...",MENU.Scale)
|
||||
),
|
||||
ITEM.SUBMENU("Contextual Menu", {hidden:!CONFIG.showContext},
|
||||
ITEM.RADIO("MathJax", "context"),
|
||||
ITEM.RADIO("Browser", "context")
|
||||
),
|
||||
ITEM.COMMAND("Scale All Math ...",MENU.Scale)
|
||||
),
|
||||
ITEM.RULE(),
|
||||
ITEM.COMMAND("About MathJax",MENU.About),
|
||||
ITEM.COMMAND("MathJax Help",MENU.Help)
|
||||
);
|
||||
ITEM.RULE(),
|
||||
ITEM.COMMAND("About MathJax",MENU.About),
|
||||
ITEM.COMMAND("MathJax Help",MENU.Help)
|
||||
);
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
MENU.showRenderer = function (show) {
|
||||
MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie();
|
||||
|
|
|
@ -2125,151 +2125,150 @@
|
|||
});
|
||||
});
|
||||
|
||||
HUB.Register.StartupHook("End Config",function () {
|
||||
//
|
||||
// Handle browser-specific setup
|
||||
//
|
||||
HUB.Browser.Select({
|
||||
MSIE: function (browser) {
|
||||
var isIE7 = browser.versionAtLeast("7.0");
|
||||
var isIE8 = browser.versionAtLeast("8.0") && document.documentMode > 7;
|
||||
var quirks = (document.compatMode === "BackCompat");
|
||||
// IE doesn't do mouse events on trasparent objects,
|
||||
// so give a background color, but opacity makes it transparent
|
||||
HTMLCSS.config.styles[".MathJax .MathJax_HitBox"]["background-color"] = "white";
|
||||
HTMLCSS.config.styles[".MathJax .MathJax_HitBox"].opacity = 0
|
||||
HTMLCSS.config.styles[".MathJax .MathJax_HitBox"].filter = "alpha(opacity=0)";
|
||||
// FIXME: work out tests for these?
|
||||
HTMLCSS.Augment({
|
||||
getMarginScale: HTMLCSS.getMSIEmarginScale,
|
||||
PaddingWidthBug: true,
|
||||
msieEventBug: browser.isIE9,
|
||||
msieAccentBug: true,
|
||||
msieColorBug: true,
|
||||
msieRelativeWidthBug: quirks,
|
||||
msieMarginWidthBug: true,
|
||||
msiePaddingWidthBug: true,
|
||||
msieCharPaddingWidthBug: (isIE8 && !quirks),
|
||||
msieBorderWidthBug: quirks,
|
||||
msieInlineBlockAlignBug: (!isIE8 || quirks),
|
||||
msieVerticalAlignBug: (isIE8 && !quirks),
|
||||
msiePlaceBoxBug: (isIE8 && !quirks),
|
||||
msieClipRectBug: !isIE8,
|
||||
msieNegativeSpaceBug: quirks,
|
||||
negativeSkipBug: true,
|
||||
msieIE6: !isIE7,
|
||||
msieItalicWidthBug: true,
|
||||
zeroWidthBug: true,
|
||||
FontFaceBug: true,
|
||||
msieFontCSSBug: browser.isIE9,
|
||||
allowWebFonts: "eot"
|
||||
});
|
||||
},
|
||||
HUB.Register.StartupHook("End Config",function () {
|
||||
//
|
||||
// Handle browser-specific setup
|
||||
//
|
||||
HUB.Browser.Select({
|
||||
MSIE: function (browser) {
|
||||
var isIE7 = browser.versionAtLeast("7.0");
|
||||
var isIE8 = browser.versionAtLeast("8.0") && document.documentMode > 7;
|
||||
var quirks = (document.compatMode === "BackCompat");
|
||||
// IE doesn't do mouse events on trasparent objects,
|
||||
// so give a background color, but opacity makes it transparent
|
||||
HTMLCSS.config.styles[".MathJax .MathJax_HitBox"]["background-color"] = "white";
|
||||
HTMLCSS.config.styles[".MathJax .MathJax_HitBox"].opacity = 0
|
||||
HTMLCSS.config.styles[".MathJax .MathJax_HitBox"].filter = "alpha(opacity=0)";
|
||||
// FIXME: work out tests for these?
|
||||
HTMLCSS.Augment({
|
||||
getMarginScale: HTMLCSS.getMSIEmarginScale,
|
||||
PaddingWidthBug: true,
|
||||
msieEventBug: browser.isIE9,
|
||||
msieAccentBug: true,
|
||||
msieColorBug: true,
|
||||
msieRelativeWidthBug: quirks,
|
||||
msieMarginWidthBug: true,
|
||||
msiePaddingWidthBug: true,
|
||||
msieCharPaddingWidthBug: (isIE8 && !quirks),
|
||||
msieBorderWidthBug: quirks,
|
||||
msieInlineBlockAlignBug: (!isIE8 || quirks),
|
||||
msieVerticalAlignBug: (isIE8 && !quirks),
|
||||
msiePlaceBoxBug: (isIE8 && !quirks),
|
||||
msieClipRectBug: !isIE8,
|
||||
msieNegativeSpaceBug: quirks,
|
||||
negativeSkipBug: true,
|
||||
msieIE6: !isIE7,
|
||||
msieItalicWidthBug: true,
|
||||
zeroWidthBug: true,
|
||||
FontFaceBug: true,
|
||||
msieFontCSSBug: browser.isIE9,
|
||||
allowWebFonts: "eot"
|
||||
});
|
||||
},
|
||||
|
||||
Firefox: function (browser) {
|
||||
var webFonts = false;
|
||||
if (browser.versionAtLeast("3.5")) {
|
||||
var root = String(document.location).replace(/[^\/]*$/,"");
|
||||
if (document.location.protocol !== "file:" ||
|
||||
(HUB.config.root+"/").substr(0,root.length) === root) {webFonts = "otf"}
|
||||
}
|
||||
HTMLCSS.Augment({
|
||||
useProcessingFrame: true,
|
||||
ffVerticalAlignBug: true,
|
||||
AccentBug: true,
|
||||
allowWebFonts: webFonts
|
||||
});
|
||||
},
|
||||
|
||||
Safari: function (browser) {
|
||||
var v3p0 = browser.versionAtLeast("3.0");
|
||||
var v3p1 = browser.versionAtLeast("3.1");
|
||||
browser.isMobile = (navigator.appVersion.match(/Mobile/i) != null);
|
||||
var android = (navigator.appVersion.match(/ Android (\d+)\.(\d+)/));
|
||||
var forceImages = (v3p1 && browser.isMobile && (
|
||||
(navigator.platform.match(/iPad|iPod|iPhone/) && !browser.versionAtLeast("5.0.2")) ||
|
||||
(android != null && (android[1] < 2 || (android[1] == 2 && android[2] < 2)))
|
||||
));
|
||||
HTMLCSS.Augment({
|
||||
config: {
|
||||
styles: {
|
||||
".MathJax img, .MathJax nobr, .MathJax a": {
|
||||
// "none" seems to work like "0px" when width is initially 0
|
||||
"max-width": "5000em", "max-height": "5000em"
|
||||
}
|
||||
}
|
||||
},
|
||||
useProcessingFrame: true,
|
||||
rfuzz: .05,
|
||||
AccentBug: true,
|
||||
AdjustSurd: true,
|
||||
safariContextMenuBug: true,
|
||||
safariNegativeSpaceBug: true,
|
||||
safariVerticalAlignBug: !v3p1,
|
||||
safariTextNodeBug: !v3p0,
|
||||
safariWebFontSerif: ["serif"],
|
||||
allowWebFonts: (v3p1 && !forceImages ? (browser.isPC ? "svg" : "otf") : false)
|
||||
});
|
||||
if (forceImages) {
|
||||
// Force image mode for iOS prior to 4.2 and Droid prior to 2.2
|
||||
// (iPhone should do SVG web fonts, but crashes with MathJax)
|
||||
var config = HUB.config["HTML-CSS"];
|
||||
if (config) {config.availableFonts = []; config.preferredFont = null}
|
||||
else {HUB.config["HTML-CSS"] = {availableFonts: [], preferredFont: null}}
|
||||
}
|
||||
},
|
||||
|
||||
Chrome: function (browser) {
|
||||
HTMLCSS.Augment({
|
||||
useProcessingFrame: true,
|
||||
rfuzz: .05,
|
||||
AccentBug: true,
|
||||
AdjustSurd: true,
|
||||
allowWebFonts: "svg",
|
||||
safariNegativeSpaceBug: true,
|
||||
safariWebFontSerif: [""]
|
||||
});
|
||||
},
|
||||
|
||||
Opera: function (browser) {
|
||||
browser.isMini = (navigator.appVersion.match("Opera Mini") != null);
|
||||
HTMLCSS.config.styles[".MathJax .merror"]["vertical-align"] = null;
|
||||
HTMLCSS.Augment({
|
||||
useProcessingFrame: true,
|
||||
operaHeightBug: true,
|
||||
operaVerticalAlignBug: true,
|
||||
operaFontSizeBug: browser.versionAtLeast("10.61"),
|
||||
negativeSkipBug: true,
|
||||
zeroWidthBug: true,
|
||||
FontFaceBug: true,
|
||||
PaddingWidthBug: true,
|
||||
allowWebFonts: (browser.versionAtLeast("10.0") && !browser.isMini ? "otf" : false),
|
||||
//
|
||||
// Opera doesn't display many STIX characters, so remove it
|
||||
// from the availableFonts array, if it is there.
|
||||
//
|
||||
adjustAvailableFonts: function (fonts) {
|
||||
for (var i = 0, m = fonts.length; i < m; i++) {
|
||||
if (fonts[i] === "STIX") {fonts.splice(i,1); m--; i--;}
|
||||
}
|
||||
if (this.config.preferredFont === "STIX") {this.config.preferredFont = fonts[0]}
|
||||
Firefox: function (browser) {
|
||||
var webFonts = false;
|
||||
if (browser.versionAtLeast("3.5")) {
|
||||
var root = String(document.location).replace(/[^\/]*$/,"");
|
||||
if (document.location.protocol !== "file:" ||
|
||||
(HUB.config.root+"/").substr(0,root.length) === root) {webFonts = "otf"}
|
||||
}
|
||||
});
|
||||
},
|
||||
HTMLCSS.Augment({
|
||||
useProcessingFrame: true,
|
||||
ffVerticalAlignBug: true,
|
||||
AccentBug: true,
|
||||
allowWebFonts: webFonts
|
||||
});
|
||||
},
|
||||
|
||||
Konqueror: function (browser) {
|
||||
HTMLCSS.Augment({
|
||||
konquerorVerticalAlignBug: true,
|
||||
noContextMenuBug: true
|
||||
});
|
||||
}
|
||||
});
|
||||
Safari: function (browser) {
|
||||
var v3p0 = browser.versionAtLeast("3.0");
|
||||
var v3p1 = browser.versionAtLeast("3.1");
|
||||
browser.isMobile = (navigator.appVersion.match(/Mobile/i) != null);
|
||||
var android = (navigator.appVersion.match(/ Android (\d+)\.(\d+)/));
|
||||
var forceImages = (v3p1 && browser.isMobile && (
|
||||
(navigator.platform.match(/iPad|iPod|iPhone/) && !browser.versionAtLeast("5.0.2")) ||
|
||||
(android != null && (android[1] < 2 || (android[1] == 2 && android[2] < 2)))
|
||||
));
|
||||
HTMLCSS.Augment({
|
||||
config: {
|
||||
styles: {
|
||||
".MathJax img, .MathJax nobr, .MathJax a": {
|
||||
// "none" seems to work like "0px" when width is initially 0
|
||||
"max-width": "5000em", "max-height": "5000em"
|
||||
}
|
||||
}
|
||||
},
|
||||
useProcessingFrame: true,
|
||||
rfuzz: .05,
|
||||
AccentBug: true,
|
||||
AdjustSurd: true,
|
||||
safariContextMenuBug: true,
|
||||
safariNegativeSpaceBug: true,
|
||||
safariVerticalAlignBug: !v3p1,
|
||||
safariTextNodeBug: !v3p0,
|
||||
safariWebFontSerif: ["serif"],
|
||||
allowWebFonts: (v3p1 && !forceImages ? (browser.isPC ? "svg" : "otf") : false)
|
||||
});
|
||||
if (forceImages) {
|
||||
// Force image mode for iOS prior to 4.2 and Droid prior to 2.2
|
||||
// (iPhone should do SVG web fonts, but crashes with MathJax)
|
||||
var config = HUB.config["HTML-CSS"];
|
||||
if (config) {config.availableFonts = []; config.preferredFont = null}
|
||||
else {HUB.config["HTML-CSS"] = {availableFonts: [], preferredFont: null}}
|
||||
}
|
||||
},
|
||||
|
||||
Chrome: function (browser) {
|
||||
HTMLCSS.Augment({
|
||||
useProcessingFrame: true,
|
||||
rfuzz: .05,
|
||||
AccentBug: true,
|
||||
AdjustSurd: true,
|
||||
allowWebFonts: "svg",
|
||||
safariNegativeSpaceBug: true,
|
||||
safariWebFontSerif: [""]
|
||||
});
|
||||
},
|
||||
|
||||
Opera: function (browser) {
|
||||
browser.isMini = (navigator.appVersion.match("Opera Mini") != null);
|
||||
HTMLCSS.config.styles[".MathJax .merror"]["vertical-align"] = null;
|
||||
HTMLCSS.Augment({
|
||||
useProcessingFrame: true,
|
||||
operaHeightBug: true,
|
||||
operaVerticalAlignBug: true,
|
||||
operaFontSizeBug: browser.versionAtLeast("10.61"),
|
||||
negativeSkipBug: true,
|
||||
zeroWidthBug: true,
|
||||
FontFaceBug: true,
|
||||
PaddingWidthBug: true,
|
||||
allowWebFonts: (browser.versionAtLeast("10.0") && !browser.isMini ? "otf" : false),
|
||||
//
|
||||
// Opera doesn't display many STIX characters, so remove it
|
||||
// from the availableFonts array, if it is there.
|
||||
//
|
||||
adjustAvailableFonts: function (fonts) {
|
||||
for (var i = 0, m = fonts.length; i < m; i++)
|
||||
{if (fonts[i] === "STIX") {fonts.splice(i,1); m--; i--;}}
|
||||
if (this.config.preferredFont === "STIX") {this.config.preferredFont = fonts[0]}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
Konqueror: function (browser) {
|
||||
HTMLCSS.Augment({
|
||||
konquerorVerticalAlignBug: true,
|
||||
noContextMenuBug: true
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
MathJax.Hub.Register.StartupHook("End Cookie", function () {
|
||||
if (HUB.config.menuSettings.zoom !== "None")
|
||||
{AJAX.Require("[MathJax]/extensions/MathZoom.js")}
|
||||
});
|
||||
MathJax.Hub.Register.StartupHook("End Cookie", function () {
|
||||
if (HUB.config.menuSettings.zoom !== "None")
|
||||
{AJAX.Require("[MathJax]/extensions/MathZoom.js")}
|
||||
});
|
||||
|
||||
})(MathJax.Ajax, MathJax.Hub, MathJax.OutputJax["HTML-CSS"]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user