Add a MathPlayer menu item in IE to allow user control over what gets passed to MathPlayer (this allows users with assitive technology to control the setup to suit their needs).

This commit is contained in:
Davide P. Cervone 2012-01-23 06:49:11 -05:00
parent b02429e1ad
commit 92f00c7f5b
14 changed files with 80 additions and 34 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,7 @@
var JAX = OUTPUT[math.jaxID];
var show = (JAX.config.showMathMenu != null ? JAX : HUB).config.showMathMenu;
if (show) {
if (SETTINGS.context === "MathJax") {
if (SETTINGS.context === "MathJax" && !SETTINGS.mpContext) {
if (!ME.noContextMenuBug || event.button !== EVENT.RIGHTBUTTON) return;
} else {
if (!event[EVENT.MENUKEY] || event.button !== EVENT.LEFTBUTTON) return;

View File

@ -42,6 +42,7 @@
closeImg: AJAX.fileURL(OUTPUT.imageDir+"/CloseX-31.png"), // image for close "X" for mobiles
showRenderer: true, // show the "Math Renderer" menu?
showMathPlayer: true, // show the "MathPlayer" menu?
showFontMenu: false, // show the "Font Preference" menu?
showContext: false, // show the "Context Menu" menu?
showDiscoverable: false, // show the "Discoverable" menu?
@ -523,9 +524,9 @@
CONFIG.settings[this.variable] = this.value;
MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie();
SIGNAL.Post(["radio button",this]);
if (this.action) {this.action.call(MENU)}
}
this.Remove(event,menu);
if (this.action && !this.disabled) {this.action.call(MENU,this)}
return FALSE(event);
}
});
@ -552,9 +553,9 @@
CONFIG.settings[this.variable] = !CONFIG.settings[this.variable];
MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie();
SIGNAL.Post(["checkbox",this]);
if (this.action) {this.action.call(MENU)}
}
this.Remove(event,menu);
if (this.action && !this.disabled) {this.action.call(MENU,this)}
return FALSE(event);
}
});
@ -772,6 +773,31 @@
var HTMLCSS = OUTPUT["HTML-CSS"]; if (!HTMLCSS) return;
document.location.reload();
};
/*
* Handle setting MathPlayer events
*/
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?")) {
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;
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.");
}
};
/*************************************************************/
/*************************************************************/
@ -852,6 +878,13 @@
ITEM.RADIO("MathML", "renderer", {action: MENU.Renderer, value:"NativeMML"}),
ITEM.RADIO("SVG", "renderer", {action: MENU.Renderer})
),
ITEM.SUBMENU("MathPlayer", {hidden:!HUB.Browser.isMSIE ||
!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.SUBMENU("Font Preference", {hidden:!CONFIG.showFontMenu},
ITEM.LABEL("For HTML-CSS:"),
ITEM.RADIO("Auto", "font", {action: MENU.Font}),
@ -895,6 +928,10 @@
MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie();
MENU.menu.Find("Math Settings","Math Renderer").hidden = !show;
};
MENU.showMathPlayer = function (show) {
MENU.cookie.showMathPlayer = CONFIG.showMathPlayer = show; MENU.saveCookie();
MENU.menu.Find("Math Settings","MathPlayer").hidden = !show;
};
MENU.showFontMenu = function (show) {
MENU.cookie.showFontMenu = CONFIG.showFontMenu = show; MENU.saveCookie();
MENU.menu.Find("Math Settings","Font Preference").hidden = !show;

View File

@ -216,17 +216,13 @@
//
if (isMSIE) {
if (container.addEventListener) {
container.addEventListener("contextmenu",EVENT.Menu,true);
container.addEventListener("mouseover",EVENT.Mouseover,true);
container.addEventListener("mouseout",EVENT.Mouseout,true);
container.addEventListener("mousedown",EVENT.Mousedown,true);
container.addEventListener("mouseup",EVENT.False,true);
container.addEventListener("click",EVENT.Click,true);
container.addEventListener("dblclick",EVENT.DblClick,true);
for (var id in this.MSIE9events) {if (this.MSIE9events.hasOwnProperty(id)) {
container.addEventListener(id,this.MSIE9event,true);
}}
} else {
var config = (this.config.showMathMenuMSIE != null ? this : HUB).config;
if (config.showMathMenuMSIE) {this.MSIEoverlay(container)}
else {container.style.position = ""}
if (config.showMathMenuMSIE && !this.settings.mpContext && !this.settings.mpMouse)
{this.MSIEoverlay(container)} else {container.style.position = ""}
}
} else {
container.oncontextmenu = EVENT.Menu;
@ -305,6 +301,19 @@
return EVENT.False(event);
},
MSIE9events: {
contextmenu:"Menu", click:"Click", dblclick: "DblClick",
mouseup:"False", mouseover:"Mouseover", mouseout:"Mouseout"
},
MSIE9event: function (event) {
if (event.type === "contextmenu" && nMML.settings.mpContext) {return true}
if (event.type === "mouseup" && nMML.settings.mpMouse) {return true}
if (event.type === "click" && nMML.settings.mpContext)
{return EVENT.AltContextMenu(event,this)}
var type = nMML.MSIE9events[event.type];
return EVENT[type].call(this,event);
},
getJaxFromMath: function (math) {return HUB.getJaxFor(math.parentNode.nextSibling)},
getHoverSpan: function (jax,math) {return math.firstChild},
getHoverBBox: function (jax,span,math) {return EVENT.getBBox(span.parentNode)},