Whitespace cleanup.

This commit is contained in:
zorkow 2015-08-21 12:37:26 +01:00
parent 4c54fe224e
commit 64e8419ff1
2 changed files with 103 additions and 103 deletions

View File

@ -4,20 +4,20 @@
/************************************************************* /*************************************************************
* *
* MathJax/extensions/MathEvents.js * MathJax/extensions/MathEvents.js
* *
* Implements the event handlers needed by the output jax to perform * Implements the event handlers needed by the output jax to perform
* menu, hover, and other events. * menu, hover, and other events.
* *
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
* *
* Copyright (c) 2011-2015 The MathJax Consortium * Copyright (c) 2011-2015 The MathJax Consortium
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -27,12 +27,12 @@
(function (HUB,HTML,AJAX,CALLBACK,LOCALE,OUTPUT,INPUT) { (function (HUB,HTML,AJAX,CALLBACK,LOCALE,OUTPUT,INPUT) {
var VERSION = "2.5.0"; var VERSION = "2.5.0";
var EXTENSION = MathJax.Extension; var EXTENSION = MathJax.Extension;
var ME = EXTENSION.MathEvents = {version: VERSION}; var ME = EXTENSION.MathEvents = {version: VERSION};
var SETTINGS = HUB.config.menuSettings; var SETTINGS = HUB.config.menuSettings;
var CONFIG = { var CONFIG = {
hover: 500, // time required to be considered a hover hover: 500, // time required to be considered a hover
frame: { frame: {
@ -41,7 +41,7 @@
bcolor: "#A6D", // frame border color bcolor: "#A6D", // frame border color
hwidth: "15px", // haze width hwidth: "15px", // haze width
hcolor: "#83A" // haze color hcolor: "#83A" // haze color
}, },
button: { button: {
x: -6, y: -3, // menu button offsets x: -6, y: -3, // menu button offsets
wx: -2 // button offset for full-width equations wx: -2 // button offset for full-width equations
@ -99,12 +99,12 @@
} }
}; };
// //
// Common event-handling code // Common event-handling code
// //
var EVENT = ME.Event = { var EVENT = ME.Event = {
LEFTBUTTON: 0, // the event.button value for left button LEFTBUTTON: 0, // the event.button value for left button
RIGHTBUTTON: 2, // the event.button value for right button RIGHTBUTTON: 2, // the event.button value for right button
MENUKEY: "altKey", // the event value for alternate context menu MENUKEY: "altKey", // the event value for alternate context menu
@ -131,7 +131,7 @@
Click: function (event) {return EVENT.Handler(event,"Click",this)}, Click: function (event) {return EVENT.Handler(event,"Click",this)},
DblClick: function (event) {return EVENT.Handler(event,"DblClick",this)}, DblClick: function (event) {return EVENT.Handler(event,"DblClick",this)},
Menu: function (event) {return EVENT.Handler(event,"ContextMenu",this)}, Menu: function (event) {return EVENT.Handler(event,"ContextMenu",this)},
// //
// Call the output jax's event handler or the zoom handler // Call the output jax's event handler or the zoom handler
// //
@ -143,7 +143,7 @@
if (jax[type]) {return jax[type](event,math)} if (jax[type]) {return jax[type](event,math)}
if (EXTENSION.MathZoom) {return EXTENSION.MathZoom.HandleEvent(event,type,math)} if (EXTENSION.MathZoom) {return EXTENSION.MathZoom.HandleEvent(event,type,math)}
}, },
// //
// Try to cancel the event in every way we can // Try to cancel the event in every way we can
// //
@ -156,12 +156,12 @@
} }
return false; return false;
}, },
// //
// Keydown event handler. Should only fire on Space key. // Keydown event handler. Should only fire on Space key.
// //
// TODO: (sorge) Fit this into the Handler function. // TODO: (sorge) Fit this into the Handler function.
// //
Keydown: function (event, math) { Keydown: function (event, math) {
var jax = OUTPUT[this.jaxID]; var jax = OUTPUT[this.jaxID];
if (event.keyCode === EVENT.KEY.SPACE) { if (event.keyCode === EVENT.KEY.SPACE) {
@ -169,7 +169,7 @@
EVENT.ContextMenu(event, this); EVENT.ContextMenu(event, this);
}; };
}, },
// //
// Load the contextual menu code, if needed, and post the menu // Load the contextual menu code, if needed, and post the menu
// //
@ -192,7 +192,7 @@
} }
// //
// If the menu code is loaded, // If the menu code is loaded,
// Check if localization needs loading; // Check if localization needs loading;
// If not, post the menu, and return. // If not, post the menu, and return.
// Otherwise wait for the localization to load // Otherwise wait for the localization to load
@ -206,12 +206,12 @@
if (!load) { if (!load) {
MENU.jax = jax; MENU.jax = jax;
var source = MENU.menu.Find("Show Math As").submenu; var source = MENU.menu.Find("Show Math As").submenu;
source.items[0].name = jax.sourceMenuTitle; source.items[0].name = jax.sourceMenuTitle;
source.items[0].format = (jax.sourceMenuFormat||"MathML"); source.items[0].format = (jax.sourceMenuFormat||"MathML");
source.items[1].name = INPUT[jax.inputJax].sourceMenuTitle; source.items[1].name = INPUT[jax.inputJax].sourceMenuTitle;
source.items[5].disabled = !INPUT[jax.inputJax].annotationEncoding; source.items[5].disabled = !INPUT[jax.inputJax].annotationEncoding;
// //
// Try and find each known annotation format and enable the menu // Try and find each known annotation format and enable the menu
// items accordingly. // items accordingly.
// //
@ -253,7 +253,7 @@
); );
return EVENT.False(event); return EVENT.False(event);
}, },
// //
// Mousedown handler for alternate means of accessing menu // Mousedown handler for alternate means of accessing menu
// //
@ -270,26 +270,26 @@
return JAX.ContextMenu(event,math,true); return JAX.ContextMenu(event,math,true);
} }
}, },
ClearSelection: function () { ClearSelection: function () {
if (ME.safariContextMenuBug) {setTimeout("window.getSelection().empty()",0)} if (ME.safariContextMenuBug) {setTimeout("window.getSelection().empty()",0)}
if (document.selection) {setTimeout("document.selection.empty()",0)} if (document.selection) {setTimeout("document.selection.empty()",0)}
}, },
getBBox: function (span) { getBBox: function (span) {
span.appendChild(ME.topImg); span.appendChild(ME.topImg);
var h = ME.topImg.offsetTop, d = span.offsetHeight-h, w = span.offsetWidth; var h = ME.topImg.offsetTop, d = span.offsetHeight-h, w = span.offsetWidth;
span.removeChild(ME.topImg); span.removeChild(ME.topImg);
return {w:w, h:h, d:d}; return {w:w, h:h, d:d};
} }
}; };
// //
// Handle hover "discoverability" // Handle hover "discoverability"
// //
var HOVER = ME.Hover = { var HOVER = ME.Hover = {
// //
// Check if we are moving from a non-MathJax element to a MathJax one // Check if we are moving from a non-MathJax element to a MathJax one
// and either start fading in again (if it is fading out) or start the // and either start fading in again (if it is fading out) or start the
@ -336,7 +336,7 @@
return EVENT.False(event); return EVENT.False(event);
} }
}, },
// //
// Clear the old timer and start a new one // Clear the old timer and start a new one
// //
@ -347,7 +347,7 @@
ClearHoverTimer: function () { ClearHoverTimer: function () {
if (this.hoverTimer) {clearTimeout(this.hoverTimer); delete this.hoverTimer} if (this.hoverTimer) {clearTimeout(this.hoverTimer); delete this.hoverTimer}
}, },
// //
// Handle putting up the hover frame // Handle putting up the hover frame
// //
@ -458,7 +458,7 @@
jax.hover.timer = setTimeout(CALLBACK(["HoverFade",this,jax]),(delay||CONFIG.fadeDelay)); jax.hover.timer = setTimeout(CALLBACK(["HoverFade",this,jax]),(delay||CONFIG.fadeDelay));
} }
}, },
// //
// Handle a click on the menu button // Handle a click on the menu button
// //
@ -466,7 +466,7 @@
if (!event) {event = window.event} if (!event) {event = window.event}
return OUTPUT[this.jax].ContextMenu(event,this.math,true); return OUTPUT[this.jax].ContextMenu(event,this.math,true);
}, },
// //
// Clear all hover timers // Clear all hover timers
// //
@ -476,7 +476,7 @@
HOVER.ClearHoverTimer(); HOVER.ClearHoverTimer();
delete jax.hover; delete jax.hover;
}, },
// //
// Make a measurement in pixels // Make a measurement in pixels
// //
@ -496,9 +496,9 @@
} }
}; };
// //
// Handle touch events. // Handle touch events.
// //
// Use double-tap-and-hold as a replacement for context menu event. // Use double-tap-and-hold as a replacement for context menu event.
// Use double-tap as a replacement for double click. // Use double-tap as a replacement for double click.
@ -507,7 +507,7 @@
last: 0, // time of last tap event last: 0, // time of last tap event
delay: 500, // delay time for double-click delay: 500, // delay time for double-click
// //
// Check if this is a double-tap, and if so, start the timer // Check if this is a double-tap, and if so, start the timer
// for the double-tap and hold (to trigger the contextual menu) // for the double-tap and hold (to trigger the contextual menu)
@ -521,9 +521,9 @@
event.preventDefault(); event.preventDefault();
} }
}, },
// //
// Check if there is a timeout pending, i.e., we have a // Check if there is a timeout pending, i.e., we have a
// double-tap and were waiting to see if it is held long // double-tap and were waiting to see if it is held long
// enough for the menu. Since we got the end before the // enough for the menu. Since we got the end before the
// timeout, it is a double-click, not a double-tap-and-hold. // timeout, it is a double-click, not a double-tap-and-hold.
@ -539,7 +539,7 @@
return EVENT.Handler((event.touches[0]||event.touch),"DblClick",this); return EVENT.Handler((event.touches[0]||event.touch),"DblClick",this);
} }
}, },
// //
// If the timeout passes without an end event, we issue // If the timeout passes without an end event, we issue
// the contextual menu event. // the contextual menu event.
@ -548,10 +548,10 @@
delete TOUCH.timeout; TOUCH.last = 0; TOUCH.up = false; delete TOUCH.timeout; TOUCH.last = 0; TOUCH.up = false;
return EVENT.Handler((event.touches[0]||event.touch),"ContextMenu",math); return EVENT.Handler((event.touches[0]||event.touch),"ContextMenu",math);
} }
}; };
/* /*
* // * //
* // Mobile screens are small, so use larger version of arrow * // Mobile screens are small, so use larger version of arrow
* // * //
@ -561,7 +561,7 @@
* CONFIG.button.x = -6; * CONFIG.button.x = -6;
* } * }
*/ */
// //
// Set up browser-specific values // Set up browser-specific values
// //
@ -584,7 +584,7 @@
ME.noContextMenuBug = true; // doesn't produce contextmenu event ME.noContextMenuBug = true; // doesn't produce contextmenu event
} }
}); });
// //
// Used in measuring zoom and hover positions // Used in measuring zoom and hover positions
// //
@ -605,7 +605,7 @@
haze["-moz-box-shadow"] = haze["-khtml-box-shadow"] = haze["-moz-box-shadow"] = haze["-khtml-box-shadow"] =
"0px 0px "+CONFIG.frame.hwidth+" "+CONFIG.frame.hcolor; "0px 0px "+CONFIG.frame.hwidth+" "+CONFIG.frame.hcolor;
}; };
// //
// Queue the events needed for startup // Queue the events needed for startup
// //
@ -617,6 +617,6 @@
["Post",HUB.Startup.signal,"MathEvents Ready"], ["Post",HUB.Startup.signal,"MathEvents Ready"],
["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"] ["loadComplete",AJAX,"[MathJax]/extensions/MathEvents.js"]
); );
})(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback, })(MathJax.Hub,MathJax.HTML,MathJax.Ajax,MathJax.Callback,
MathJax.Localization,MathJax.OutputJax,MathJax.InputJax); MathJax.Localization,MathJax.OutputJax,MathJax.InputJax);

View File

@ -4,21 +4,21 @@
/************************************************************* /*************************************************************
* *
* MathJax/extensions/MathMenu.js * MathJax/extensions/MathMenu.js
* *
* Implements a right-mouse (or CTRL-click) menu over mathematics * Implements a right-mouse (or CTRL-click) menu over mathematics
* elements that gives the user the ability to copy the source, * elements that gives the user the ability to copy the source,
* change the math size, and zoom settings. * change the math size, and zoom settings.
* *
* --------------------------------------------------------------------- * ---------------------------------------------------------------------
* *
* Copyright (c) 2010-2015 The MathJax Consortium * Copyright (c) 2010-2015 The MathJax Consortium
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -30,7 +30,7 @@
var VERSION = "2.5.0"; var VERSION = "2.5.0";
var SIGNAL = MathJax.Callback.Signal("menu"); // signal for menu events var SIGNAL = MathJax.Callback.Signal("menu"); // signal for menu events
MathJax.Extension.MathMenu = { MathJax.Extension.MathMenu = {
version: VERSION, version: VERSION,
signal: SIGNAL signal: SIGNAL
@ -45,7 +45,7 @@
var isPC = HUB.Browser.isPC, isMSIE = HUB.Browser.isMSIE, isIE9 = ((document.documentMode||0) > 8); var isPC = HUB.Browser.isPC, isMSIE = HUB.Browser.isMSIE, isIE9 = ((document.documentMode||0) > 8);
var ROUND = (isPC ? null : "5px"); var ROUND = (isPC ? null : "5px");
var CONFIG = HUB.CombineConfig("MathMenu",{ var CONFIG = HUB.CombineConfig("MathMenu",{
delay: 150, // the delay for submenus delay: 150, // the delay for submenus
@ -72,7 +72,7 @@
left: Math.round((screen.width - 400)/2), left: Math.round((screen.width - 400)/2),
top: Math.round((screen.height - 300)/3) top: Math.round((screen.height - 300)/3)
}, },
styles: { styles: {
"#MathJax_About": { "#MathJax_About": {
position:"fixed", left:"50%", width:"auto", "text-align":"center", position:"fixed", left:"50%", width:"auto", "text-align":"center",
@ -143,28 +143,28 @@
padding: (isPC ? "2px 2em 4px 1.33em" : "1px 2em 3px 1.33em"), padding: (isPC ? "2px 2em 4px 1.33em" : "1px 2em 3px 1.33em"),
"font-style":"italic" "font-style":"italic"
}, },
".MathJax_MenuRule": { ".MathJax_MenuRule": {
"border-top": (isPC ? "1px solid #CCCCCC" : "1px solid #DDDDDD"), "border-top": (isPC ? "1px solid #CCCCCC" : "1px solid #DDDDDD"),
margin: (isPC ? "4px 1px 0px" : "4px 3px") margin: (isPC ? "4px 1px 0px" : "4px 3px")
}, },
".MathJax_MenuDisabled": { ".MathJax_MenuDisabled": {
color:"GrayText" color:"GrayText"
}, },
".MathJax_MenuActive": { ".MathJax_MenuActive": {
"background-color": (isPC ? "Highlight" : "#606872"), "background-color": (isPC ? "Highlight" : "#606872"),
color: (isPC ? "HighlightText" : "white") color: (isPC ? "HighlightText" : "white")
}, },
"#MathJax_AboutClose": { "#MathJax_AboutClose": {
top:".2em", right:".2em" top:".2em", right:".2em"
}, },
".MathJax_Menu .MathJax_MenuClose": { ".MathJax_Menu .MathJax_MenuClose": {
top:"-10px", left:"-10px" top:"-10px", left:"-10px"
}, },
".MathJax_MenuClose": { ".MathJax_MenuClose": {
position:"absolute", position:"absolute",
cursor:"pointer", cursor:"pointer",
@ -184,7 +184,7 @@
"-webkit-border-radius": "18px", // Safari and Chrome "-webkit-border-radius": "18px", // Safari and Chrome
"-moz-border-radius": "18px", // Firefox "-moz-border-radius": "18px", // Firefox
"-khtml-border-radius": "18px", // Konqueror "-khtml-border-radius": "18px", // Konqueror
"line-height":0, "line-height":0,
padding:"8px 0 6px" // may need to be browser-specific padding:"8px 0 6px" // may need to be browser-specific
}, },
".MathJax_MenuClose:hover": { ".MathJax_MenuClose:hover": {
@ -197,7 +197,7 @@
} }
}); });
var FALSE, HOVER, KEY; var FALSE, HOVER, KEY;
HUB.Register.StartupHook("MathEvents Ready",function () { HUB.Register.StartupHook("MathEvents Ready",function () {
FALSE = MathJax.Extension.MathEvents.Event.False; FALSE = MathJax.Extension.MathEvents.Event.False;
@ -247,7 +247,7 @@
Down: function(event, menu) { }, Down: function(event, menu) { },
Space: function(event, menu) { } Space: function(event, menu) { }
}, {}); }, {});
/*************************************************************/ /*************************************************************/
/* /*
@ -259,7 +259,7 @@
posted: false, posted: false,
title: null, title: null,
margin: 5, margin: 5,
Init: function (def) {this.items = [].slice.call(arguments,0)}, Init: function (def) {this.items = [].slice.call(arguments,0)},
With: function (def) {if (def) {HUB.Insert(this,def)}; return this}, With: function (def) {if (def) {HUB.Insert(this,def)}; return this},
@ -290,7 +290,7 @@
ontouchstart: MENU.Close, ontouchend: FALSE, onmousedown: MENU.Close, onmouseup: FALSE ontouchstart: MENU.Close, ontouchend: FALSE, onmousedown: MENU.Close, onmouseup: FALSE
},[["span",{},"\u00D7"]]); },[["span",{},"\u00D7"]]);
} }
div.appendChild(menu); div.appendChild(menu);
this.posted = true; this.posted = true;
menu.style.width = (menu.offsetWidth+2) + "px"; menu.style.width = (menu.offsetWidth+2) + "px";
@ -332,9 +332,9 @@
menu.style["KhtmlBorderRadiusTop"+side] = 0; // Konqueror menu.style["KhtmlBorderRadiusTop"+side] = 0; // Konqueror
} }
} }
menu.style.left = x+"px"; menu.style.top = y+"px"; menu.style.left = x+"px"; menu.style.top = y+"px";
if (document.selection && document.selection.empty) {document.selection.empty()} if (document.selection && document.selection.empty) {document.selection.empty()}
MENU.Focus(menu); MENU.Focus(menu);
return FALSE(event); return FALSE(event);
@ -376,7 +376,7 @@
} }
return null; return null;
}, },
/* /*
* Find the index of a menu item (so we can insert before or after it) * Find the index of a menu item (so we can insert before or after it)
*/ */
@ -387,7 +387,7 @@
{if (this.items[i].name[n] === name) {return i}} {if (this.items[i].name[n] === name) {return i}}
return null; return null;
}, },
Right: function(event, menu) { Right: function(event, menu) {
MENU.Right(event, menu); MENU.Right(event, menu);
}, },
@ -403,7 +403,7 @@
item.Activate(event, item.GetNode()); item.Activate(event, item.GetNode());
} }
},{ },{
config: CONFIG, config: CONFIG,
div: null, // the DOM elements for the menu and submenus div: null, // the DOM elements for the menu and submenus
@ -484,7 +484,7 @@
node: null, // The node the menu was activated on. node: null, // The node the menu was activated on.
active: null, // The currently focused item. There can only be one! active: null, // The currently focused item. There can only be one!
posted: false, // Is a menu open? posted: false, // Is a menu open?
GetJaxs: function() { GetJaxs: function() {
var nodes = document.getElementsByClassName('MathJax'); var nodes = document.getElementsByClassName('MathJax');
for (var i = 0, node; node = nodes[i]; i++) { for (var i = 0, node; node = nodes[i]; i++) {
@ -555,14 +555,14 @@
Mod: function(a, n) { Mod: function(a, n) {
return ((a % n) + n) % n; return ((a % n) + n) % n;
}, },
saveCookie: function () {HTML.Cookie.Set("menu",this.cookie)}, saveCookie: function () {HTML.Cookie.Set("menu",this.cookie)},
getCookie: function () {this.cookie = HTML.Cookie.Get("menu")} getCookie: function () {this.cookie = HTML.Cookie.Get("menu")}
}); });
MathJax.Menu.NAV = NAV; MathJax.Menu.NAV = NAV;
/*************************************************************/ /*************************************************************/
/* /*
* Abstract class of menu items. * Abstract class of menu items.
@ -572,7 +572,7 @@
name: "", // The menu item's label as [id,label] pair. name: "", // The menu item's label as [id,label] pair.
node: null, // The HTML node of the item. node: null, // The HTML node of the item.
menu: null, // The parent menu containing that item. HTML node. menu: null, // The parent menu containing that item. HTML node.
/* /*
* Accessor method for node. * Accessor method for node.
*/ */
@ -608,7 +608,7 @@
Mouseover: function (event,menu) { Mouseover: function (event,menu) {
if (menu.parentNode === MENU.active.parentNode) { if (menu.parentNode === MENU.active.parentNode) {
this.Deactivate(MENU.active); this.Deactivate(MENU.active);
} }
this.Activate(event, menu); this.Activate(event, menu);
}, },
@ -639,7 +639,7 @@
m--; m--;
} }
}, },
Touchstart: function (event,menu) {return this.TouchEvent(event,menu,"Mousedown")}, Touchstart: function (event,menu) {return this.TouchEvent(event,menu,"Mousedown")},
Touchend: function (event,menu) {return this.TouchEvent(event,menu,"Mouseup")}, Touchend: function (event,menu) {return this.TouchEvent(event,menu,"Mouseup")},
TouchEvent: function (event,menu,type) { TouchEvent: function (event,menu,type) {
@ -652,7 +652,7 @@
MENU.Event(event,menu,type); MENU.Event(event,menu,type);
return false; return false;
}, },
Remove: function (event,menu) { Remove: function (event,menu) {
menu = menu.parentNode.menuItem; menu = menu.parentNode.menuItem;
return menu.Remove(event,menu); return menu.Remove(event,menu);
@ -673,7 +673,7 @@
menu.className = menu.className.replace(/ MathJax_MenuActive/,"")}, menu.className = menu.className.replace(/ MathJax_MenuActive/,"")},
With: function (def) {if (def) {HUB.Insert(this,def)}; return this}, With: function (def) {if (def) {HUB.Insert(this,def)}; return this},
isRTL: function () {return MENU.isRTL}, isRTL: function () {return MENU.isRTL},
rtlClass: function () {return (this.isRTL() ? " RTL" : "")} rtlClass: function () {return (this.isRTL() ? " RTL" : "")}
}); });
@ -685,7 +685,7 @@
MENU.ENTRY = MENU.ITEM.Subclass({ MENU.ENTRY = MENU.ITEM.Subclass({
role: "menuitem", // Aria role. role: "menuitem", // Aria role.
Attributes: function() { Attributes: function() {
var def = this.SUPER(arguments).Attributes.call( var def = this.SUPER(arguments).Attributes.call(
this, this,
@ -739,7 +739,7 @@
Space: function (event, menu) { Space: function (event, menu) {
this.Mouseup(event, menu); this.Mouseup(event, menu);
}, },
Activate: function (event, menu) { Activate: function (event, menu) {
this.Deactivate(menu); this.Deactivate(menu);
if (!this.disabled) { if (!this.disabled) {
@ -753,7 +753,7 @@
} }
}); });
/*************************************************************/ /*************************************************************/
/* /*
* A menu item that performs a command when selected * A menu item that performs a command when selected
@ -766,7 +766,7 @@
this.name = name; this.action = action; this.name = name; this.action = action;
this.With(def); this.With(def);
}, },
Label: function (def,menu) {return [this.Name()]}, Label: function (def,menu) {return [this.Name()]},
//TODO: Focus the popup. //TODO: Focus the popup.
Mouseup: function (event,menu) { Mouseup: function (event,menu) {
@ -866,7 +866,7 @@
variable: null, // the variable name variable: null, // the variable name
marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark marker: (isPC ? "\u25CF" : "\u2713"), // the checkmark
role: "menuitemradio", role: "menuitemradio",
Init: function (name,variable,def) { Init: function (name,variable,def) {
if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair if (!(name instanceof Array)) {name = [name,name]} // make [id,label] pair
this.name = name; this.variable = variable; this.With(def); this.name = name; this.variable = variable; this.With(def);
@ -885,7 +885,7 @@
if (item && item.variable === this.variable) if (item && item.variable === this.variable)
{child[i].firstChild.style.display = "none"} {child[i].firstChild.style.display = "none"}
} }
menu.firstChild.display = ""; menu.firstChild.display = "";
CONFIG.settings[this.variable] = this.value; CONFIG.settings[this.variable] = this.value;
MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie(); MENU.cookie[this.variable] = CONFIG.settings[this.variable]; MENU.saveCookie();
SIGNAL.Post(["radio button",this]); SIGNAL.Post(["radio button",this]);
@ -930,7 +930,7 @@
/*************************************************************/ /*************************************************************/
/* /*
* A menu item that is a label * A menu item that is a label
*/ */
MENU.ITEM.LABEL = MENU.ENTRY.Subclass({ MENU.ITEM.LABEL = MENU.ENTRY.Subclass({
role: "menuitem", // Aria role. role: "menuitem", // Aria role.
@ -959,7 +959,7 @@
return null; return null;
} }
}); });
/*************************************************************/ /*************************************************************/
/*************************************************************/ /*************************************************************/
@ -968,7 +968,7 @@
*/ */
MENU.About = function () { MENU.About = function () {
var HTMLCSS = OUTPUT["HTML-CSS"] || {}; var HTMLCSS = OUTPUT["HTML-CSS"] || {};
var font = var font =
(HTMLCSS.imgFonts ? "image" : (HTMLCSS.imgFonts ? "image" :
(HTMLCSS.fontInUse ? (HTMLCSS.fontInUse ?
(HTMLCSS.webFonts ? "web" : "local")+" "+HTMLCSS.fontInUse : (HTMLCSS.webFonts ? "web" : "local")+" "+HTMLCSS.fontInUse :
@ -983,7 +983,7 @@
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]); jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}]);
MENU.About.GetJax(jax,MathJax.Extension,["Extension","%1 Extension v%2"],true); MENU.About.GetJax(jax,MathJax.Extension,["Extension","%1 Extension v%2"],true);
jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[ jax.push(["div",{style:{"border-top":"groove 2px",margin:".25em 0"}}],["center",{},[
HUB.Browser + " v"+HUB.Browser.version + (format ? HUB.Browser + " v"+HUB.Browser.version + (format ?
" \u2014 " + _(format.replace(/ /g,""),format) : "") " \u2014 " + _(format.replace(/ /g,""),format) : "")
]]); ]]);
MENU.About.div = MENU.Background(MENU.About); MENU.About.div = MENU.Background(MENU.About);
@ -994,7 +994,7 @@
_(font.replace(/ /g,""),"using "+font),["br"],["br"], _(font.replace(/ /g,""),"using "+font),["br"],["br"],
["span",{style:{ ["span",{style:{
display:"inline-block", "text-align":"left", "font-size":"80%", display:"inline-block", "text-align":"left", "font-size":"80%",
"max-height":"20em", overflow:"auto", "max-height":"20em", overflow:"auto",
"background-color":"#E4E4E4", padding:".4em .6em", border:"1px inset" "background-color":"#E4E4E4", padding:".4em .6em", border:"1px inset"
}},jax],["br"],["br"], }},jax],["br"],["br"],
["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]], ["a",{href:"http://www.mathjax.org/"},["www.mathjax.org"]],
@ -1027,7 +1027,7 @@
return jax; return jax;
}; };
/* /*
* Handle the MathJax HELP menu * Handle the MathJax HELP menu
*/ */
@ -1035,7 +1035,7 @@
AJAX.Require("[MathJax]/extensions/HelpDialog.js", AJAX.Require("[MathJax]/extensions/HelpDialog.js",
function () {MathJax.Extension.Help.Dialog()}); function () {MathJax.Extension.Help.Dialog()});
}; };
/* /*
* Handle showing of element's source * Handle showing of element's source
*/ */
@ -1119,7 +1119,7 @@
},50); },50);
} }
}; };
/* /*
* Handle rescaling all the math * Handle rescaling all the math
*/ */
@ -1143,14 +1143,14 @@
"The scale should be a percentage (e.g., 120%%)"))} "The scale should be a percentage (e.g., 120%%)"))}
} }
}; };
/* /*
* Handle loading the zoom code * Handle loading the zoom code
*/ */
MENU.Zoom = function () { MENU.Zoom = function () {
if (!MathJax.Extension.MathZoom) {AJAX.Require("[MathJax]/extensions/MathZoom.js")} if (!MathJax.Extension.MathZoom) {AJAX.Require("[MathJax]/extensions/MathZoom.js")}
}; };
/* /*
* Handle changing the renderer * Handle changing the renderer
*/ */
@ -1164,7 +1164,7 @@
switch (CONFIG.settings.renderer) { switch (CONFIG.settings.renderer) {
case "NativeMML": case "NativeMML":
if (!CONFIG.settings.warnedMML) { if (!CONFIG.settings.warnedMML) {
if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit} if (BROWSER.isChrome && BROWSER.version.substr(0,3) !== "24.") {message = MESSAGE.MML.WebKit}
else if (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0")) {message = MESSAGE.MML.WebKit} else if (BROWSER.isSafari && !BROWSER.versionAtLeast("5.0")) {message = MESSAGE.MML.WebKit}
else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}} else if (BROWSER.isMSIE) {if (!BROWSER.hasMathPlayer) {message = MESSAGE.MML.MSIE}}
else {message = MESSAGE.MML[BROWSER]} else {message = MESSAGE.MML[BROWSER]}
@ -1176,7 +1176,7 @@
if (!CONFIG.settings.warnedSVG) { if (!CONFIG.settings.warnedSVG) {
if (BROWSER.isMSIE && !isIE9) {message = MESSAGE.SVG.MSIE} if (BROWSER.isMSIE && !isIE9) {message = MESSAGE.SVG.MSIE}
} }
break; break;
} }
if (message) { if (message) {
message = _(message[0],message[1]); message = _(message[0],message[1]);
@ -1209,7 +1209,7 @@
MSIE: ["MSIENativeMMLWarning", MSIE: ["MSIENativeMMLWarning",
"Internet Explorer requires the MathPlayer plugin " + "Internet Explorer requires the MathPlayer plugin " +
"in order to process MathML output."], "in order to process MathML output."],
Opera: ["OperaNativeMMLWarning", Opera: ["OperaNativeMMLWarning",
"Opera's support for MathML is limited, so switching to " + "Opera's support for MathML is limited, so switching to " +
"MathML output may cause some expressions to render poorly."], "MathML output may cause some expressions to render poorly."],
@ -1222,7 +1222,7 @@
"Your browser's native MathML does not implement all the features " + "Your browser's native MathML does not implement all the features " +
"used by MathJax, so some expressions may not render properly."] "used by MathJax, so some expressions may not render properly."]
}, },
SVG: { SVG: {
MSIE: ["MSIESVGWarning", MSIE: ["MSIESVGWarning",
"SVG is not implemented in Internet Explorer prior to " + "SVG is not implemented in Internet Explorer prior to " +
@ -1231,7 +1231,7 @@
"not display properly."] "not display properly."]
} }
}; };
/* /*
* Handle setting the HTMLCSS fonts * Handle setting the HTMLCSS fonts
*/ */
@ -1239,7 +1239,7 @@
var HTMLCSS = OUTPUT["HTML-CSS"]; if (!HTMLCSS) return; var HTMLCSS = OUTPUT["HTML-CSS"]; if (!HTMLCSS) return;
document.location.reload(); document.location.reload();
}; };
/* /*
* Handle selection of locale and rerender the page * Handle selection of locale and rerender the page
*/ */
@ -1261,7 +1261,7 @@
}); });
} }
}; };
/* /*
* Handle setting MathPlayer events * Handle setting MathPlayer events
*/ */
@ -1294,7 +1294,7 @@
"The MathJax contextual menu will be disabled, but you can " + "The MathJax contextual menu will be disabled, but you can " +
"Alt-Click on an expression to obtain the MathJax menu instead."] "Alt-Click on an expression to obtain the MathJax menu instead."]
}; };
/*************************************************************/ /*************************************************************/
/*************************************************************/ /*************************************************************/
@ -1475,7 +1475,7 @@
trigger.items[0].disabled = trigger.items[1].disabled = true; trigger.items[0].disabled = trigger.items[1].disabled = true;
if (settings.zoom === "Hover" || settings.zoom == "Click") {settings.zoom = "None"} if (settings.zoom === "Hover" || settings.zoom == "Click") {settings.zoom = "None"}
trigger.items = trigger.items.slice(0,4); trigger.items = trigger.items.slice(0,4);
if (navigator.appVersion.match(/[ (]Android[) ]/)) { if (navigator.appVersion.match(/[ (]Android[) ]/)) {
MENU.ITEM.SUBMENU.Augment({marker: "\u00BB"}); MENU.ITEM.SUBMENU.Augment({marker: "\u00BB"});
} }
@ -1485,7 +1485,7 @@
MENU.CreateLocaleMenu(); MENU.CreateLocaleMenu();
MENU.CreateAnnotationMenu(); MENU.CreateAnnotationMenu();
}); });
MENU.showRenderer = function (show) { MENU.showRenderer = function (show) {
MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie(); MENU.cookie.showRenderer = CONFIG.showRenderer = show; MENU.saveCookie();
MENU.menu.Find("Math Settings","Math Renderer").hidden = !show; MENU.menu.Find("Math Settings","Math Renderer").hidden = !show;
@ -1511,12 +1511,12 @@
MENU.cookie.showLocale = CONFIG.showLocale = show; MENU.saveCookie(); MENU.cookie.showLocale = CONFIG.showLocale = show; MENU.saveCookie();
MENU.menu.Find("Language").hidden = !show; MENU.menu.Find("Language").hidden = !show;
}; };
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () { MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
if (!MathJax.OutputJax["HTML-CSS"].config.imageFont) if (!MathJax.OutputJax["HTML-CSS"].config.imageFont)
{MENU.menu.Find("Math Settings","Font Preference","TeX (image)").disabled = true} {MENU.menu.Find("Math Settings","Font Preference","TeX (image)").disabled = true}
}); });
/*************************************************************/ /*************************************************************/
CALLBACK.Queue( CALLBACK.Queue(