Better handling of MathPlayer settings. In particular, allow Alt-Click in IE8 and lower when math menu is disabled.

This commit is contained in:
Davide P. Cervone 2012-01-23 10:06:52 -05:00
parent 92f00c7f5b
commit 344f832e1e
14 changed files with 48 additions and 39 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -175,7 +175,8 @@
var JAX = OUTPUT[math.jaxID];
var show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu;
if (show) {
if (SETTINGS.context === "MathJax" && !SETTINGS.mpContext) {
show = (JAX.config.showMathMenuMSIE != null ? JAX : HUB).config.showMathMenuMSIE;
if (SETTINGS.context === "MathJax" && !SETTINGS.mpContext && show) {
if (!ME.noContextMenuBug || event.button !== EVENT.RIGHTBUTTON) return;
} else {
if (!event[EVENT.MENUKEY] || event.button !== EVENT.LEFTBUTTON) return;

View File

@ -33,7 +33,7 @@
signal: SIGNAL
};
var isPC = HUB.Browser.isPC, isMSIE = HUB.Browser.isMSIE;
var isPC = HUB.Browser.isPC, isMSIE = HUB.Browser.isMSIE, isIE9 = ((document.documentMode||0) > 8);
var ROUND = (isPC ? null : "5px");
var CONFIG = HUB.CombineConfig("MathMenu",{
@ -681,7 +681,7 @@
return;
}
} else {
if (MENU.jax.originalText == null) {alert("No TeX form available"); return}
if (MENU.jax.originalText == null) {alert("No original form available"); return}
MENU.ShowSource.Text(MENU.jax.originalText,event);
}
};
@ -779,23 +779,23 @@
*/
MENU.MPEvents = function (item) {
var discoverable = CONFIG.settings.discoverable;
if ((document.documentMode||0) < 9) {
if (!confirm("This will disable the MathJax menu and MathJax Zoom features, " +
"and you will have to delete the cookies for this site to " +
"reactivate them.\n\n" +
"Really change the MathPlayer settings?")) {
if (!isIE9) {
if (CONFIG.settings.mpMouse && !confirm(
"This will disable the MathJax menu and zoom features, " +
"but you can Alt-Click on an expression to obtain the MathJax " +
"menu instead.\n\nReally change the MathPlayer settings?")) {
delete MENU.cookie.mpContext; delete CONFIG.settings.mpContext;
delete MENU.cookie.mpMouse; delete CONFIG.settings.mpMouse;
MENU.saveCookie();
return;
}
CONFIG.settings.mpContext = CONFIG.settings.mpMouse = true;
MENU.cookie.mpContext = MENU.cookie.mpMouse = true;
CONFIG.settings.mpContext = CONFIG.settings.mpMouse;
MENU.cookie.mpContext = MENU.cookie.mpMouse = CONFIG.settings.mpMouse;
MENU.saveCookie();
MathJax.Hub.Queue(["Rerender",MathJax.Hub])
} else if (!discoverable && item.name === "Menu Events" && CONFIG.settings.mpContext) {
alert("The MathJax contextual menu will be disabled; instead " +
"Alt-Click on an expression to obtain the MathJax menu.");
alert("The MathJax contextual menu will be disabled, but you can " +
"Alt-Click on an expression to obtain the MathJax menu instead.");
}
};
@ -812,7 +812,7 @@
msieFixedPositionBug: (quirks || !isIE8),
msieAboutBug: quirks
});
if (document.documentMode >= 9) {
if (isIE9) {
delete CONFIG.styles["#MathJax_About"].filter;
delete CONFIG.styles[".MathJax_Menu"].filter;
}
@ -882,8 +882,9 @@
!CONFIG.showMathPlayer,
disabled:!HUB.Browser.hasMathPlayer},
ITEM.LABEL("Let MathPlayer Handle:"),
ITEM.CHECKBOX("Menu Events", "mpContext", {action: MENU.MPEvents}),
ITEM.CHECKBOX("Mouse Events", "mpMouse", {action: MENU.MPEvents})
ITEM.CHECKBOX("Menu Events", "mpContext", {action: MENU.MPEvents, hidden:!isIE9}),
ITEM.CHECKBOX("Mouse Events", "mpMouse", {action: MENU.MPEvents, hidden:!isIE9}),
ITEM.CHECKBOX("Mouse and Menu Events", "mpMouse", {action: MENU.MPEvents, hidden:isIE9})
),
ITEM.SUBMENU("Font Preference", {hidden:!CONFIG.showFontMenu},
ITEM.LABEL("For HTML-CSS:"),

View File

@ -222,7 +222,8 @@
} else {
var config = (this.config.showMathMenuMSIE != null ? this : HUB).config;
if (config.showMathMenuMSIE && !this.settings.mpContext && !this.settings.mpMouse)
{this.MSIEoverlay(container)} else {container.style.position = ""}
{this.MSIEoverlay(container)} else
{container.style.position = ""; mspan.firstChild.onmousedown = this.MSIEaltMenu}
}
} else {
container.oncontextmenu = EVENT.Menu;
@ -296,10 +297,16 @@
if (event.srcElement.className === "MathJax_MathPlayer_Overlay" && this.msieMath.fireEvent) {
// for now, ignore all other events. This will disable MathPlayer's zoom
// feature, but also its <maction> support.
if (type === "ContextMenu") {this.msieMath.fireEvent("on"+event.type,event)}
if (type === "ContextMenu" || type === "Mouseover" || type === "Mouseout")
{this.msieMath.fireEvent("on"+event.type,event)}
}
return EVENT.False(event);
},
MSIEaltMenu: function () {
var container = this.parentNode.parentNode;
while (!container.jaxID) {container = container.parentNode}
EVENT.AltContextMenu(window.event,container);
},
MSIE9events: {
contextmenu:"Menu", click:"Click", dblclick: "DblClick",